Document structure for RavenDB

穿精又带淫゛_ 提交于 2019-12-12 19:11:04

问题


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 to collection and save them.

How I can do it?

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


回答1:


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



来源:https://stackoverflow.com/questions/6019288/document-structure-for-ravendb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!