我實現一個自定義RoleProvider並想用Ninject與參數的構造函數的問題但是我面對。任何想法如何注入這?Ninject並提供模型參數的構造函數
public class EFRoleProvider:RoleProvider
{
private readonly IRepository _repository;
// I want to INJECT this GOO here!
public EFRoleProvider()
{
IContextFactory contextFactory = new DbContextFactory<myEntities>();
_repository = new RepositoryBase(contextFactory);
}
}
這篇文章可能會讓你感興趣:http://blog.ploeh.dk/2011/04/27/ProviderIsNotAPattern.aspx – Steven 2011-05-01 21:37:47
Great Post,所以基本上我應該推出自己的接口和實現,並從提供程序中清除提供程序XML web.config作爲提供者的東西很蹩腳。好的,回到製圖板LOL – CrazyCoderz 2011-05-02 13:51:23