Added constraint for RegisterType
This commit is contained in:
parent
1d2fca6ddc
commit
d7e6dcc3b2
@ -27,7 +27,7 @@ namespace SmallInjectorDemo
|
||||
useful2.TestTheServices();
|
||||
Console.WriteLine();
|
||||
useful3.TestTheServices();
|
||||
Console.ReadLine();
|
||||
//Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace SmallInjectorDemo
|
||||
/// <typeparam name="TInterface">Type of the interface of the service.</typeparam>
|
||||
/// <param name="isSingleton">True if the service should be singleton. False otherwise.</param>
|
||||
/// <param name="instance">instance of the service</param>
|
||||
public void RegisterType<TService, TInterface>(bool isSingleton, TService instance = default(TService))
|
||||
public void RegisterType<TService, TInterface>(bool isSingleton, TService instance = default(TService)) where TService : TInterface
|
||||
{
|
||||
_container.Add(typeof(TInterface), new RegisteredType(typeof(TService), isSingleton, null));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user