Structuremap Generics with two type parameters
I know I can, in Structuremap, do thi开发者_开发技巧s:
var container = new Container(cfg =>
{
cfg.For(typeof (IDomainDataRepository<>)).Use(typeof (DomainDataRepository<>));
});
but what if my Interface has 2 type parameters:
IDomainDataRepository<T,TKey> instead ofIDomainDataRepository<T>
How to tell Structuremap to instantiate this type of classes?
Ok, I figured it out.
var container = new Container(cfg =>
{
cfg.For(typeof(IDomainDataRepository<,>)).Use(typeof(DomainDataRepository<,>));
});
精彩评论