Hi guys I have a dependency that I need to inject into one of my classes. This dependency will be lifestyle of Transient. It inturn has a dependency of type Type. This type should be the type of the original class. I was just wondering if anyone has any idea how I might go about conducting this registration.
See example:
public interface ICustomer
{
.....
}
public class Customer : ICustomer
{
public Customer(IRegister register)
{ .... }
}
public interface IRegister
{
.....
}
public class Register
{
public Register(Type partentType)
{ .... }
}
public class TestExample
{
public static void TestMe()
{
//If i was creating all this manually it would look
// something like this
IRegister myRegister = new Register(typeof(Customer));
ICustomer myCustomer = new Customer(myRegister);
}
}
Now i know i could call Container.Resolve when ever I want a Customer and then inject Register manually. But I need to inject Register into most of my classes so this isn't really that feasible. Hence I need a way of doing it via the config or via container.Register.
Cheers Anthony