public ApplicationPermissionManager(ApplicationDbContext context)
 {
     _db = context;
     _userManager = new ApplicationUserManager(_db);
     _roleManager = new ApplicationRoleManager(_db);
     _permissionStore = new ApplicationPermissionStore(_db);
 }
 public ApplicationPermissionManager()
 {
     _db = HttpContext.Current
         .GetOwinContext().Get<ApplicationDbContext>();
     _userManager = HttpContext.Current
        .GetOwinContext().GetUserManager<ApplicationUserManager>();
     _roleManager = HttpContext.Current
         .GetOwinContext().Get<ApplicationRoleManager>();
     _permissionStore = new ApplicationPermissionStore(_db);
 }
 protected virtual void Dispose(bool disposing)
 {
     if (this.DisposeContext && disposing && this._db != null)
     {
         this._db.Dispose();
         this._userManager.Dispose();
         this._roleManager.Dispose();
     }
     this._disposed = true;
     this._db = null;
     this._userManager = null;
     this._roleManager = null;
     this._permissionStore = null;
 }