我正在關注MVC5-Dapper-Identity回購以自定義實現身份與短纖維。我的問題是當我註冊依賴到iOC容器這個例子使用Ninject,但我使用簡單的注射器。這個例子註冊了自己的dependacies爲below使用簡單注射器的身份自定義實施
kernel.Bind<IConnectionFactory>().To<SqlConnectionFactory>()
.WithConstructorArgument("connectionString",
ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
kernel.Bind<IUserRepository>().To<UserRepository>();
kernel.Bind<IUserStore<User>>().To<UserRepository>();
kernel.Bind<IUserLoginStore<User>>().To<UserRepository>();
kernel.Bind<IUserPasswordStore<User>>().To<UserRepository>();
kernel.Bind<IUserSecurityStampStore<User>>().To<UserRepository>();
kernel.Bind(typeof(UserManager<>)).ToSelf();
我試圖用簡單的噴油器,其用於生成異常我
container.Register<IUserRepository, UserRepository>();
container.Register<IUserStore<User>, UserRepository>();
container.Register<IUserLoginStore<User>, UserRepository>();
container.Register<IUserPasswordStore<User>, UserRepository>();
container.Register<IUserSecurityStampStore<User>, UserRepository>();
container.Register(typeof(UserManager<User>));
如何做簡單的注射器上述實施
更新
@Ric .Net感謝您的答案,但您的實施屬TE此異常
您是否閱讀過異常中提供的文檔鏈接? – Steven
ohh我的不好感謝信息 – Gayan