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

Calling entity methods on SaveChanges.

1 Answer 49 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Daniel
Top achievements
Rank 1
Daniel asked on 26 Sep 2014, 08:15 AM
Greetings,

Is there any workaround for simulating PostStore functionality? Calling method before the transaction is commited to the database.
Does InitializeTransients with InitOperation.Hollow is called after saving the object ?
Is it intended PreStore to be called only when the entity is dirty?
If so is there a way to call entity method every time SaveChanges is invoked in the context of one transaction?
What is the earliest point after transaction is started where I can intercept the saving process?
There is InstanceLifecycleListener interface, which seems can handle save process interception. Can I attach it somewhere and if yes where?

Regards,
Daniel Tsviatkov

1 Answer, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 30 Sep 2014, 02:21 PM
Hi Daniel,

yes, the IInstanceCallbacks interface is intended to be implemented by your persistent classes. See here in the older documentation : http://www.telerik.com/help/openaccess-classic/lifecycle-events.html . The methods are found and called by our runtime.

The more modern approach is to use the approach as outlined here:
http://docs.telerik.com/data-access/feature-reference/api/context-api/feature-ref-api-context-api-tracking-context-changes

If you need to ensure consistency in the context on a logical level, you should consider overriding SaveChanges() so that the consistency is made above the OpenAccess runtime. This way you control the order of execution more easily.

Regards,
Thomas
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Development (API, general questions)
Asked by
Daniel
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Share this question
or