I have a project that I am experimenting with DI in.I am using Unity and things seem to work well for normal assemblies and the injections.
Say I have this class public class MyObject : IObject { public MyObject(IObject2 object2) { } } which I resolve like:
How can I inject (attach) event handlers to .net events of instances created by the Unity IoC container?
This is what my service contructor looks like: public Service(string path) and I\'m configuring unity like this:
I\'m using C# with Microsoft\'s Unity framework. I\'m not quite sure how to solve this problem. It probably has something to do with my lack of开发者_运维百科 understanding DI with Unity.
I am trying out the code from this post on Event Driven Architecture (very interesting by the way). His IOC container is Unity though and I would like to do this using Structure map.
I want to use Unity resolve IService to two different 开发者_开发知识库implementations, to make use of a wrapper class, the equivalent of:
In a C# solution, I have multiple class libraries for the domain model, services, and repositories. I configured Unity in web.config of the main website project so that it knows what concrete objects
I have a class with two ctors. One parameterless and one with parameters. Unity will by default take the gready approach and go for the last ctor.
I am trying to get Unity to manage the creation of my objects and I want to have some initialization parameters that are not known until run-time: