मैं अपने आईओसी के रूप में Ninject उपयोग कर रहा हूँ और इस प्रकार मैं एक भूमिका प्रदाता ने लिखा है:सदस्यताप्रदाता के साथ निदान | 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 */
}
मैंने पढ़ा है कि Provider
कक्षाओं से पहले Ninject उदाहरण सुई हो जाता है instantiated मिलता है। मैं इसके आसपास कैसे जाऊं? मेरे पास वर्तमान में यह निंजा कोड है:
Bind<RoleProvider>().To<BasicRoleProvider>().InRequestScope();
इस उत्तर से here।
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.
मुझे यह समझ में नहीं आता।
संभावित डुप्लिकेट [निनजेक्ट के साथ कस्टम सदस्यता प्रदाता को इंजेक्ट रिपोजिटरी] (http://stackoverflow.com/questions/5596441/inject-repository-to-custom-membership-provider-with-ninject) –