using simple injector with aspnet.identity

2019-08-27 18:38发布

I'm trying to use simple injector with my mvc project, and I'm unclear how to complete all registrations for framework code. In particular, with this aspnet.identity code.In general, since this isn't my code and the call stack is through .net library .dlls, is there a way to get simpleinjector to work with this aspnet.identity code.

Examples:

In case below, I can see from subsequent code the the generic class that is instantiated from the generic interface, however I don't know how to register a generic interface that maps to a generic class, and whether or not if I completed this registration, if it would break code. But I cannot compile, if i'm using simpleinjector.

public ApplicationUserManager(IUserStore<ApplicationUser> store)
        : base(store)
    {

    }

` In the code below, I can see at runtime that authenticationManager is instantiated into Microsoft.Owin.Security.AuthenticationManager, but I can't even test if allowing simpleinjector to map the interface to that concrete type would break the code, since I can't compile this code, if i'm using simpleinjector.

public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
        : base(userManager, authenticationManager)
    {
    }

thanks

Update Hi, after things nicely compiled with the changes recommended I"m find that my emails from my account controller for registration and lost passwords are not going out. When I debug I find a different call stack for my branch containing simpleinjector. In this branch, the code in IdentityConfig.cs is not executed.

Branch without simple injection / Email Reaching Correct Method in IdentityConfig.cs

enter image description here

Branch with simple injection / Emails Not Reaching Correct Method enter image description here

0条回答
登录 后发表回答