开发者

Document structure for RavenDB

I have class

class UserActivity
{
    private IList<Activity> _activities = new List<Activity>();

    public void AddActivity(Activity activity)
    {
        _activities.Add(activity);
    }

    public IEnumerable<Activity> ActivityHistory
    {
        return _activities;
    }
}

Activity history can have a lot of elements.

I wish store UserActivity in RavenDB with history. But, when I get UserActivity first time from DB, ActivityHistory should have last 10 items, for example, and I should have possibility load other items or add new t开发者_Go百科o collection and save them.

How I can do it?

As I understand, i have only one way - store apart UserActivity and history items.


Gengzu, Yes, you need to deal with the document as a whole. You can project parts of the documents out into an index, but that is a projection, not an entity

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜