How to inject an auditing class to many entities

Posts   
 
    
oguzal
User
Posts: 1
Joined: 21-Feb-2012
# Posted on: 22-Feb-2012 00:43:43   

I want to audit all tables in a database I have used DI to audit all entities as below I want to exclude some of the entities to be audited and there are many tables in the database and I don't want to specify each entity one by one , so how can I exclude some of those entities from the audited list?

/// <summary>Example Auditor class which is usable on all entities in a project.</summary> [DependencyInjectionInfo(typeof(IEntity), "AuditorToUse")] [Serializable] public class GeneralAuditor : AuditorBase { ...

}

Is there an easy way using DI ? Can you add more samples for the other 2 methods (other than DI) Thank you

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 22-Feb-2012 11:26:49   

If you don't want to use an attribute for each entity, than the entities to consume the Auditor should have a common type. Please check this post: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=18284&StartAtMessage=0&#102405