c# - Autofac Resolve Open Generic Interface with Open Generic Class -
so have interface , class:
public interface imyinterface<t> t : isomeentity {} public class myclass<t> : imyinterface<t> t : isomeentity {}
i have class calls it:
public class someclass : isomeclass { public someclass (imyinterface<auditentity> myinterface) {} }
i've done sorts of things register open generic interface , class no luck.
i want like:
container.registertype(typeof(myclass<>)).as(typeof(imyinterface<>));
it annoying if have go through , explicitly like:
container.registertype<myclass<auditentity>>().as<imyinterface<auditentity>>();
shouldn't trivial?
you have use registergeneric
method see registration concepts - open generic components
something should works :
builder.registergeneric(typeof(myclass<>)).as(typeof(imyinterface<>));
Comments
Post a Comment