This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi,
Is there a way to catch/hook into the Create/Update triggers in .net code? I ask this because...I need to run a .net method which sets information on each child, on create/update, of the parent entity. How would I go about it?
Track Update Time and Track Create Time are both True. if that helps! Hope i'm not being too abstract.
|
|
|
You can subscribe to the Saving event, or override OnSaving. This will get you notified just before the entity is about to be saved. Note of course that this could be a delete rather than an insert or update -- you can determine what the operation is by checking EntityState. However, be warned that if you modify other entities during save, then those changes may not be picked up in this save, because those other entities may already have been processed. Another approach is to override SaveChanges in your strong-typed unit of work class. This can then iterate the entities in the unit of work, perform any required changes, and then call the base SaveChanges to persist all the changes. |
|