Calling entity methods on SaveChanges.

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    1 posts
    Member since:
    Aug 2013

    Posted 26 Sep 2014 Link to this post

    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
  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 30 Sep 2014 Link to this post

    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.
     
  3. DevCraft banner
Back to Top