Auditing SubTypes

Posts   
 
    
luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 31-Mar-2008 22:26:46   

llblgen 2.5 Final Feb 4th 2008 asp.net .net 2.5 c# SQL 2005

I have noticed that if I create a subType, use DI auditing of the superType, then instantiate the subType, an audit event is triggered (specifically FieldSet as the id field is "set")

Is this by design or am I not supposed to audit subTypes? I can understand how llblgen is setting the relationship b/w the types,and in doing so is setting the id field, but I would think that this should not be auditted.

If I could get some insight on best practices in such a situation. Thanks!

luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 31-Mar-2008 23:09:08   

Okay, so I went ahead and created an auditor using DI for the specific subType, and that prevented the unwanted fieldSet audit events. I guess the rule is if I want to audit subTypes, I can't get away with auditing the superTypes only?

Thanks,

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 01-Apr-2008 08:39:23   

That's because a subType is also of the Type of the SuperType (i.e. an Employee is also a Person) simple_smile

So if used DI to audit a superType, this also will be applicable to any subType that fall under the specified SuperType.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Apr-2008 10:27:07   

You can specify if you want the object to be injected in all types of a hierarchy (so type specified and all subtypes, this is the default) or just the type you specified. This is controlled by the TargetKind of the DependencyInjectionInfo attribute: by default it's Hierarchy, you should specify a targetkind of DependencyInjectionTargetKind.Absolute. Then only the type you specified gets the class injected.

Frans Bouma | Lead developer LLBLGen Pro
luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 01-Apr-2008 23:08:28   

Otis wrote:

You can specify if you want the object to be injected in all types of a hierarchy (so type specified and all subtypes, this is the default) or just the type you specified. This is controlled by the TargetKind of the DependencyInjectionInfo attribute: by default it's Hierarchy, you should specify a targetkind of DependencyInjectionTargetKind.Absolute. Then only the type you specified gets the class injected.

Thanks Frans, that is very helpful!

Just for my own curiosity, is LL supposed to trigger an audit fieldSet event when a subType is instantiated? I understand that subTypes are audited when auditing the superType, but I guess I don't understand the reasoning for triggering the fieldset event.

Anyways, I have a workaround, thanks again Frans.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Apr-2008 10:45:19   

If you are setting the PK in your instantiation, then it owuld be audited.