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, i've got some long-running processes. the initial state is represented by ClassA and the CreatedBy comes from the WCF Thread.Principal. At some point later in the business process (in a windows service) I use the instance of ClassA to construct a ClassB. Because the change happens in a background service the AuditInfo strategy there serves up a name like "MyWindowsService" - this works really well for updates, deletes, etc. But - I want to transfer the EntityA.CreatedBy value to my new EntityB. Is this possible? What if the IEntityFactory had an override of CreateInstance allowing the AuditInfo name to be passed in? Or even easier, if I just make CreatedBy a standard property and not-loadonly, is there a point at which the value has been written by LS and I can overwrite it if necessary before the Save occurs? When does LS write the new value? thanks
|
|
|
LightSpeed writes the new value during the SaveChanges call so no, it is not possible to overwrite it. But depending on your use case you could set the audit info for the Windows service to None, in which case LightSpeed wouldn't do anything with the CreatedBy field, so you could write it yourself. However in this case you would need to do so for all entities in the Windows service. If each SaveChanges in the Windows service handles only the consequences of a single EntityA, then you can hack around this with a custom audit info strategy along the lines of: * Service defines a thread-static variable called e.g. _triggeringEntity. |
|