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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -