Unity-container | Resolve with many parameters | "Has not Typeparameters"

12 Views Asked by At

I want to resolve a class via the interface. one of the new() has two parameters (class-object , class-object).

  Dim X = Kernel.UnityService.GetInstance.Container.Resolve(Of IOrdersEditorForm)(New ResolverOverride() {
                                                                                             New ParameterOverride("OrderM", OrderM),
                                                                                             New ParameterOverride("CadTooltip", Nothing)
                                                                                             }
                                                                                          )

same problem:

Dim X = Kernel.UnityService.GetInstanz.Container.Resolve(Of IOrdersEditorForm)

problem: The syntax check fails with the message "(of Interface)" = " has no type parameter and therefore cannot have any type arguments".

how do?

Public Class UnityService

   Private Sub New()
         _UnityContainer = New Unity.UnityContainer
     end sub

    Public Property Container As Unity.IUnityContainer
         Get
             Return _UnityContainer
         end get
         Set(value As Unity.IUnityContainer)
             _UnityContainer = value
         end set
     EndProperty
end class

class program
     Private Sub RegisterClasses()
        UnityService.GetInstance.RegisterType(GetType(IOrdersEditorForm), GetType(WinF.OrdersEditorForm))
     end sub
end class


Public Interface IOrdersEditorForm

    Sub ShowAsDialog()

    Function OrdersEditor() As IOrdersEditor

End Interface

I'm not sure if I have to register the parameters in advance somehow. so far I had a maximum of one parameter and it always worked.

0

There are 0 best solutions below