asp.net - Cant register vNext DI services using generics -
before moved aspnet5/vnext used simpleinjector. use simpleinjector register generic validators, using following:
services.addscoped(typeof(ivalidator<>), new list<assembly> { assembly.load("my.other.assembly") });
my classes defined in other assembly
public interface imyinterface : ivalidator<myobject> {} public class myvalidator : imyinterface { // methods here }
is possible using standard vnext di system?
yes, possible. take here: http://dotnetliberty.com/index.php/2016/01/11/dependency-scanning-in-asp-net-5/
Comments
Post a Comment