using simple injector with aspnet.identity

狂风中的少年 提交于 2019-12-11 15:39:12

问题


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

Branch with simple injection / Emails Not Reaching Correct Method

来源:https://stackoverflow.com/questions/51641953/using-simple-injector-with-aspnet-identity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!