Where to I override CreateAuditor?

Posts   
 
    
ChrisCY
User
Posts: 22
Joined: 20-Jun-2007
# Posted on: 11-Nov-2008 10:52:40   

Hi all,

I am using LLBLGen 2.6 Final (October 6th,2008 ) to build an ASP.NET 2.0 website (.NET Framework 2.0 - C#) using the Adapter template over an Oracle 9i.

I am trying to setup Auditing but I haven't been able yet. First of all I tried to use Dependency Injection using the instructions of the documentation and the code of the sample application but I couldn't get it to work either automatically nor by explicitly defining filters in Web.config.

Next I thought it would be more practical (and less "magical") to override the "CreateAuditor" method mentioned in the documentation but I can't find it!!! flushed Does it exist in the Adapter template or do I have to override the AuditorToUse property instead? Please note that I use LLBLGenDataSource2 heavily thus I can't set that property manually in a lot if situations.

Is there any sample code using this method? I prefer to create a partial class file instead of messing with the generated code.

I would appreciate any directions. Thanking you in advance!

Chris

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 11-Nov-2008 11:22:27   

I wonder why DI didn't work.

Anyway CreateAuditor() is defined in the EntityBase2 class, and thus it is inherited by every entityClass, so you should override it in the entityClass code.

So for better and clean implementation use a "partial class" file of your entity to override this method.

ChrisCY
User
Posts: 22
Joined: 20-Jun-2007
# Posted on: 11-Nov-2008 15:48:20   

Well, wasn't that silly of me disappointed

The error was that I defined the wrong namespace in the partial class file confused I forgot the "EntityClasses" bit at the end!

I don't know why DI didn't work but I haven't actually spent too much time trying. Since I don't have that many Entities that I need to audit the override method is more explicit and "guaranteed to work" in production. Its a great feature though...

Thank you for your answer and time.

Chris