How to set the ContextType property in the DependencyInjectionInfo attribute?

Posts   
 
    
Max avatar
Max
User
Posts: 221
Joined: 14-Jul-2006
# Posted on: 16-Apr-2009 17:15:24   

I'm trying to define a DependencyInjectionInfo on an EntityValidator, but there is something I'm missing...

This one compile

<DependencyInjectionInfo(GetType(IndirizzoEntity), "Validator")> _
Public Class IndirizzoValidator
    Inherits ValidatorBase

End Class

but this one doesn't

<DependencyInjectionInfo(GetType(IndirizzoEntity), "Validator", ContextType = DependencyInjectionContextType.NewInstancePerTarget)> _
Public Class IndirizzoValidator
    Inherits ValidatorBase

End Class

VS2008 doesn't get the third parameter "ContextType = DependencyInjectionContextType.NewInstancePerTarget"

I've copy-pasted this syntax from LLBLGen Manual (Generated code - Setting up and using Dependency Injection) but I've never seen this kind of syntax. How it's supposed to work?

Why does VS 2008 show in the intellisense that the DependencyInjectionInfo's constructor have 4 parameters... when in the object browser/.Net Reflector I can only find 2 parameters?

See attached VS 2008 screenshot for better understanding.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 16-Apr-2009 20:40:17   

You are missing a ":" Try the following

<DependencyInjectionInfo(GetType(IndirizzoEntity), "Validator", ContextType := DependencyInjectionContextType.NewInstancePerTarget)> _
Public Class IndirizzoValidator
    Inherits ValidatorBase

End Class

Matt

Max avatar
Max
User
Posts: 221
Joined: 14-Jul-2006
# Posted on: 17-Apr-2009 09:21:44   

MTrinder wrote:

You are missing a ":" Try the following

<DependencyInjectionInfo(GetType(IndirizzoEntity), "Validator", ContextType := DependencyInjectionContextType.NewInstancePerTarget)> _
Public Class IndirizzoValidator
    Inherits ValidatorBase

End Class

Matt

Thanks, now it works sunglasses