I'm attempted to convert the WPF Starter Kit from C# to VB.net and I'm doing really well, except for one area... Dependency Injection using the Unity Application Block.
I have the following C# code block:
Type viewModelType = viewModelAssembly.GetType(action.ViewModelTypeName);
var notificationPolicy = unity.AddNewExtension<Interception>()
.RegisterType(typeof(BaseViewModel), viewModelType, action.Name)
.Configure<Interception>()
.SetDefaultInterceptorFor(viewModelType, new VirtualMethodInterceptor())
.AddPolicy("NotificationPolicy");
notificationPolicy.AddMatchingRule(new PropertyMatchingRule("*", PropertyMatchingOption.Set));
notificationPolicy.AddCallHandler<NotifyPropertyChangedCallHandler>();
That I auto-convert to vb.net:
Dim viewModelType As Type = viewModelAssembly.[GetType](action.ViewModelTypeName)
Dim notificationPolicy = unity.AddNewExtension(Of Interception()).RegisterType(GetType(BaseViewModel), viewModelType, action.Name).Configure(Of Interception)().SetDefaultInterceptorFor(viewModelType, New VirtualMethodInterceptor()).AddPolicy("NotificationPolicy")
notificationPolicy.AddMatchingRule(New PropertyMatchingRule("*", PropertyMatchingOption.[Set]))
notificationPolicy.AddCallHandler(Of NotifyPropertyChangedCallHandler)()
The vb.net code generates the error "Latebound overload resolution cannot be applied to 'RegisterType' because the accessing instance is an interface type" and I have no idea how I can fix this. I'm totally new to this Unity stuff, and I'm unable to find vb examples - aside from the fragments MS offers. Any help would be greatly appreciated.
Thanks all,
Ryan
EDIT: Per Blam, I added the extra bracket, but I still get the same error.