如何在不同的控制器

时间:2016-08-18 02:31:26

标签: asp.net-core-mvc asp.net-identity-3

当使用mvc身份时,我有三个数据库,并且所有人都有用户表,在startup.cs中有一个默认的UserManager和SignInManager,如何在不同的控制器中添加另一个UserManager和SignInManager?(我的意思是我在项目中有不同的登录页面,比如accountAcontroller,accountBcontroller,这个控制器有不同的登录视图)

private readonly UserManager<ApplicationUser> _userManager;
        private readonly SignInManager<ApplicationUser> _signInManager;
        private readonly ApplicationDbContext _dbContent;
        private readonly IEmailSender _emailSender;
        private readonly ISmsSender _smsSender;
        private readonly ILogger _logger;

        public AccountController(
            UserManager<ApplicationUser> userManager,
            SignInManager<ApplicationUser> signInManager,
            IEmailSender emailSender,
            ISmsSender smsSender,
            ILoggerFactory loggerFactory,
            ApplicationDbContext Dbcontext
            )
        {
            _userManager = userManager;
            _signInManager = signInManager;
            _emailSender = emailSender;
            _smsSender = smsSender;
            _logger = loggerFactory.CreateLogger<AccountController>();
            _dbContent = Dbcontext;
        }

0 个答案:

没有答案