次のように私のIoCと私はロールプロバイダを書いたように、私はninject使用しています:Ninject with MembershipProvider | RoleProvider
public class BasicRoleProvider : RoleProvider
{
private IAuthenticationService authenticationService;
public BasicRoleProvider(IAuthenticationService authenticationService)
{
if (authenticationService == null) throw new ArgumentNullException("authenticationService");
this.authenticationService = authenticationService;
}
/* Other methods here */
}
私はninjectのインスタンスを注入するために取得する前にProvider
クラスはインスタンス化を受けることをお読みください。これをどうやって回りますか?この回答hereから
Bind<RoleProvider>().To<BasicRoleProvider>().InRequestScope();
:私は現在、このninjectコードを持っています。
If you mark your dependencies with [Inject] for your properties in your provider class, you can call kernel.Inject(MemberShip.Provider) - this will assign all dependencies to your properties.
私はこれを理解していません。
[Ninjectを使用してカスタムメンバーシップメントプロバイダにリポジトリを挿入する](http://stackoverflow.com/questions/5596441/inject-repository-to-custom-membership-provider-with-ninject) –