Basic Auditor Questions

Posts   
 
    
rszymanski
User
Posts: 8
Joined: 29-Dec-2008
# Posted on: 23-Jul-2009 21:13:37   

Hey Folks,

I have an auditing requirement (journaling) for a web project. To address this, I went ahead and implemented auditing in my project using DI similar to the Auditing Example - Adapter Sample but instead of auditing the CustomerEntity (via the DatabaseAuditor class) I set it up to Audit all the Entities. I did this by setting the DependencyInjectionInfo attribute to audit all entities in the project and uncommenting the code in AuditLoadOfEntity() and AuditEntityFieldGet(). Doing this yields a ridiculous amount of rows in the AuditInfo table. Holy Cow!!! I'm thinking this is because it's auditing all the dependent entities as well.

I'm not interested in auditing the loading of existing dependent entites so I'm wondering if instead I should audit only on specific entities. If I were to take this approach would I need to implement a specific auditing class for each audit entity? In other words would I need to add the DI class attribute code to each of the entities I wish to audit or is it possible to specify which classes I wish to audit w/in the config file or maybe some other way?

I was wondering if any of you folks had a suggestion, perhaps there is a better way to handle this.

Thanks for your help. Btw, I really like the LLBLGen product. Great job! Bob

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 24-Jul-2009 09:26:09   

I'm not interested in auditing the loading of existing dependent entites so I'm wondering if instead I should audit only on specific entities. If I were to take this approach would I need to implement a specific auditing class for each audit entity?

yes you'll have to add the attribute for each entity you wish to audit.

rszymanski
User
Posts: 8
Joined: 29-Dec-2008
# Posted on: 24-Jul-2009 17:25:21   

Thanks for your response. I really appreciate it.

For the heck of it I went ahead and tried to specify only certain entity classes to audit i.e. not the entire project using the technique suggest by Otis. See code snipped below from his post at http://tinyurl.com/mmswtw

[DependencyInjectionInfo(typeof(LocationEntity), "AuthorizerToUse")]
[DependencyInjectionInfo(typeof(ProductVendorEntity), "AuthorizerToUse")]
[DependencyInjectionInfo(typeof(CustomerEntity), "AuthorizerToUse")]
public class GeneralAdventureWorksAuthorizer : AdventureWorksAuthorizerBase
{
    public override bool CanGetFieldValue(IEntityCore entity, int fieldIndex)
    {
        return base.CanGetFieldValue(entity, fieldIndex);
    }
}

This works exactly like I would have hoped it would.
Thanks!