Entity Aspect in the Cache

Thread is closed for posting
2 posts, 0 answers
  1. Sakar
    Sakar avatar
    3 posts
    Member since:
    Nov 2012

    Posted 05 Dec 2012 Link to this post

    is there a way, to find an entity aspect is new(added), is modified, or marked for deletion, in the memory cache.

  2. Hristo Marinov
    Hristo Marinov avatar
    13 posts

    Posted 10 Dec 2012 Link to this post

    Hello Sakar,

    With the OpenAccessContext the state of an object is retrieved by the GetState method.  Here is an example of how to use the GetState method:

    ObjectState state = OpenAccessContext.PersistenceState.GetState(car);

    Additional helpful information can be found in this article.

    Also, the OpenAccessContext can retrieve collection of objects, grouped by state and type. This is accomplished by the methods: GetInserts, GetUpdates and GetDeletes. Here is a code-snippet: 

    IList<Category> inserts = contextChanges.GetInserts<Category>();
    IList<Category> updates = contextChanges.GetUpdates<Category>();
    IList<Category> deletes = contextChanges.GetDeletes<Category>();

    Let me know if you need any additional directions.

    All the best,
    Hristo Marinov
    the Telerik team
    Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Back to Top