This is a migrated thread and some comments may be shown as answers.

Entity Aspect in the Cache

1 Answer 24 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sakar
Top achievements
Rank 1
Sakar asked on 05 Dec 2012, 12:05 PM
is there a way, to find an entity aspect is new(added), is modified, or marked for deletion, in the memory cache.




1 Answer, 1 is accepted

Sort by
0
Hristo Marinov
Telerik team
answered on 10 Dec 2012, 08:43 AM
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.
Tags
General Discussions
Asked by
Sakar
Top achievements
Rank 1
Answers by
Hristo Marinov
Telerik team
Share this question
or