コード例 #1
0
        /// <summary>
        /// designed to be used with seed method
        /// </summary>
        /// <param name="roleManger"></param>
        /// <param name="userManager"></param>
        public ApplicationGroupManager(ApplicationRoleManager roleManger, ApplicationUserManager userManager)
        {
            _db = new ApplicationDbContext();

            _groupStore = new ApplicationGroupStore(_db);

            _userManager = userManager;
            _roleManager = roleManger;

        }
コード例 #2
0
        public ApplicationGroupManager()
        {
            var context = HttpContext.Current;

            if (context == null)
            {
                _db = new ApplicationDbContext();
                _userManager = new ApplicationUserManager(new ApplicationUserStore());
                _roleManager = new ApplicationRoleManager(new ApplicationRoleStore());
            }
            else
            {
                _db = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>();
                _userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
                _roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>();
                
            }
          
            _groupStore = new ApplicationGroupStore(_db);
        }