Hi all,
I have something like this when try to register all type without specify each class (using AllClasses, WithMappings from Unity.RegistrationByConvention ):
Dim injections As IEnumerable(Of InjectionMember) = New List(Of InjectionMember) From {
New Interceptor(Of InterfaceInterceptor),
New InterceptionBehavior(Of PolicyInjectionBehavior)
}
Dim allTypes = AllClasses.FromAssemblies(GetType(MyBaseService).Assembly)
unity.RegisterTypes(allTypes, AddressOf WithMappings.FromMatchingInterface, getInjectionMembers:=Function(t) injections)
It works so far. But when I try the same thing to register with all Form:
Dim allForm = AllClasses.FromAssemblies(GetType(Form).Assembly)
unity.RegisterTypes(allForm, AddressOf WithMappings.None, getInjectionMembers:=Function(t) injections)
There is an Exception:
ArgumentException: Type passed must be an interface.
Currently, I have to register for each Form like this:
unity.RegisterType(Of MyFormA)
unity.RegisterType(Of MyFormB)
Is there anyway I could register all form without specify each of them ?