I want to use autiting for my database.
My database can be changed by both a winform application and a webform application. The winform application is for common user purpose, and the webform application is for managers only. The two apps are using the same entities which are generated by LLBLGerPro.
I want to auditing for db changes which come from the webform application,and changes from winform will be ignored.
Since I refrenced the document,there are three options:
1.Setting the AuditorToUse property of an entity object manually. This is straight forward, but error prone: if you forget to set an auditor, auditing isn't performed. Also, entities fetched in bulk into a collection are created using the factories so you have to alter these as well. You could opt for overriding OnInitializing in an entity to add the creation of the Auditor class.
2.By overriding the Entity method CreateAuditor. This is a protected virtual (Protected Overridable) method which by default returns null / Nothing. You can override this method in a partial class or user code region of the Entity class to create the Auditor to use for the entity. The LLBLGen Pro runtime framework will take care of calling the method. One way to create an override for most entities is by using a template. Please see the LLBLGen Pro SDK documentation for details about how to write templates to generate additional code into entities and in separate files. Also please see Adding Adding your own code to the generated classes for details.
3.By using Dependency Injection. Using the Dependency Injection mechanism build into LLBLGen Pro, the defined Auditors are injected into the entity objects for you. This option is the least amount of work.
So I think the last two are not suit for me. But with the option 1,when I aduting single entity,it's no proplem. But how can I aduting correctly for follow scences:
1.Tens,hundreds even more entities be changed once.May be I need to loop all these entities?
2.UpdateEntitiesDirectly or DeleteEntitiesDirecly which I don't know how many entities will be changed for this time.
Regard for your reply,thanks.