Esempio n. 1
0
 public static SSKDbContext Create()
 {
     if (_dbContext == null)
     {
         _dbContext = new SSKDbContext();
     }
     return(_dbContext);
 }
Esempio n. 2
0
 public static RoleManager <IdentityRole> GetRoleManager()
 {
     if (_roleManager == null)
     {
         _roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(SSKDbContext.Create()));
     }
     return(_roleManager);
 }
Esempio n. 3
0
        public static UserManager <ApplicationUser> GetUserManager()
        {
            if (_userManager == null)
            {
                if (EnumAppConfig.IsLocal)
                {
                    _userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(SSKDbContext.Create()));
                }
                else
                {
                    _userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(CentralizedDBContext.Create()));
                }
                // Configure validation logic for usernames
                _userManager.UserValidator = new UserValidator <ApplicationUser>(_userManager)
                {
                    AllowOnlyAlphanumericUserNames = false,
                    RequireUniqueEmail             = false
                };

                // Configure validation logic for passwords
                _userManager.PasswordValidator = new PasswordValidator
                {
                    RequiredLength          = 0,
                    RequireNonLetterOrDigit = false,
                    RequireDigit            = false,
                    RequireLowercase        = false,
                    RequireUppercase        = false,
                };
            }
            return(_userManager);
        }