unity2.0

NServiceBus with Unity 2.0?

强颜欢笑 提交于 2019-12-21 03:33:34
问题 Anyone using NServiceBus 2.0 successfully with Unity 2.0? I've tried to compile sources of NServiceBus.ObjectBuilder.Unity.dll against Unity 2.0 assemblies but got several compile-time errors because of changed/deleted signatures of many object methods in new Unity. In the documentation Udi Dahan says that attaching any container is as easy as implementing 5 methods of IContainer . But when i look into NServiceBus.ObjectBuilder.Unity implementation i see that there is a LOT more work to be

NServiceBus with Unity 2.0?

帅比萌擦擦* 提交于 2019-12-21 03:33:00
问题 Anyone using NServiceBus 2.0 successfully with Unity 2.0? I've tried to compile sources of NServiceBus.ObjectBuilder.Unity.dll against Unity 2.0 assemblies but got several compile-time errors because of changed/deleted signatures of many object methods in new Unity. In the documentation Udi Dahan says that attaching any container is as easy as implementing 5 methods of IContainer . But when i look into NServiceBus.ObjectBuilder.Unity implementation i see that there is a LOT more work to be

Using Unity in WPF

半世苍凉 提交于 2019-12-06 06:37:56
问题 I have Unity 2.0 working well within the App.xaml.cs to register and resolve within that class. The question I have is regarding a best practice. I have a number of User Controls and other classes that also need to resolve some of the same and new Interface <-> implementations. The problem is theres no way to access the Unity container I created in the App.xaml.cs. I cannot use constructor or property injection to pass on the container reference. Just too many (its a large project) The user

Unity - how to use multiple mappings for the same type and inject into an object

不羁的心 提交于 2019-12-05 00:51:36
问题 I'm using Unity 2.0 and in the following code I'm trying to inject a specific tool in the Worker object. I would like to use the following code. But ofcourse there is an error "Resolution of the dependency failed". I believe I should be able to do something like this, but I'm having a difficult time figuring it out. IUnityContainer container = new UnityContainer(); container.RegisterType<IWorker, Worker>("Worker") .RegisterType<ITool, ToolA>("ToolA") .RegisterType<ITool, ToolB>("ToolB")

Using Unity in WPF

北城以北 提交于 2019-12-04 16:12:53
I have Unity 2.0 working well within the App.xaml.cs to register and resolve within that class. The question I have is regarding a best practice. I have a number of User Controls and other classes that also need to resolve some of the same and new Interface <-> implementations. The problem is theres no way to access the Unity container I created in the App.xaml.cs. I cannot use constructor or property injection to pass on the container reference. Just too many (its a large project) The user controls are added via xaml There are several very loosely related "modules" in the project that can

Unity - how to use multiple mappings for the same type and inject into an object

♀尐吖头ヾ 提交于 2019-12-03 16:39:11
I'm using Unity 2.0 and in the following code I'm trying to inject a specific tool in the Worker object. I would like to use the following code. But ofcourse there is an error "Resolution of the dependency failed". I believe I should be able to do something like this, but I'm having a difficult time figuring it out. IUnityContainer container = new UnityContainer(); container.RegisterType<IWorker, Worker>("Worker") .RegisterType<ITool, ToolA>("ToolA") .RegisterType<ITool, ToolB>("ToolB") .RegisterType<ITool, ToolC>("ToolC"); IWorker worker = container.Resolve<Worker>("ToolA"); I know this doesn

NServiceBus with Unity 2.0?

隐身守侯 提交于 2019-12-03 10:35:58
Anyone using NServiceBus 2.0 successfully with Unity 2.0? I've tried to compile sources of NServiceBus.ObjectBuilder.Unity.dll against Unity 2.0 assemblies but got several compile-time errors because of changed/deleted signatures of many object methods in new Unity. In the documentation Udi Dahan says that attaching any container is as easy as implementing 5 methods of IContainer . But when i look into NServiceBus.ObjectBuilder.Unity implementation i see that there is a LOT more work to be done. Why it is so? Unity, by default, behaves different from what NSB expects. That's why there is a

Unity Application Block, How pass a parameter to Injection Factory?

你说的曾经没有我的故事 提交于 2019-11-30 07:18:15
Here what I have now Container.RegisterType<IUserManager, UserManagerMock>(); Container.RegisterType<IUser, UserMock>( new InjectionFactory( (c) => c.Resolve<IUserManager>().GetUser("John"))); and get it Container.Resolve<IProfile>(); I want to pass a name as parameter to Factory so that I will be able to resolve user object with name; Something like this: Container.Resolve<IProfile>("Jonh"); How can I change the type registration for this case? While most DI frameworks have advanced features to do these types of registrations, I personally rather change the design of my application to solve

Custom object factory extension for Unity

允我心安 提交于 2019-11-29 18:22:52
问题 I am using the Unity IoC container, and I need to intercept any calls to Resolve for a certain base interface, and run my own custom code to construct those types. In other words, in the sample code below, when I call container.Resolve<IFooN>() , if it hasn't got an instance of the concrete implementing type, it calls MyFactoryFunction to construct one, otherwise I want it to return the cached copy. The standard Unity container is not able to construct these objects ( update: because they are

Unity Application Block, How pass a parameter to Injection Factory?

人走茶凉 提交于 2019-11-29 09:27:51
问题 Here what I have now Container.RegisterType<IUserManager, UserManagerMock>(); Container.RegisterType<IUser, UserMock>( new InjectionFactory( (c) => c.Resolve<IUserManager>().GetUser("John"))); and get it Container.Resolve<IProfile>(); I want to pass a name as parameter to Factory so that I will be able to resolve user object with name; Something like this: Container.Resolve<IProfile>("Jonh"); How can I change the type registration for this case? 回答1: While most DI frameworks have advanced