public WebSecurity( IContextProvider contextService , IApplicationConfiguration configurationRepository , ApplicationUserManager userManager , ApplicationSignInManager signInManager ) { _configurationRepository = configurationRepository; _userManager = userManager; _signInManager = signInManager; try { var dbContextAsync = DataContextFactory.GetDataContextAsync(); dbContextAsync.GetDatabase().Initialize(true); if (_loggingService == null) { _loggingService = Log4NetLoggingFactory.GetLogger(); } _unitOfWorkAsync = new UnitOfWork(dbContextAsync, new RowAuthPoliciesContainer(_cachedUserAuthorizationGrantsProvider)); // UserManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(_dbContextAsync as DbContext)); } catch (Exception ex) { FetchLoggerAndLog(ex); } }
public static void StoreLogger(ILog4NetLoggingService loggingService) { if (loggingService == null) { throw new ArgumentException("LoggingService"); } LoggingStorageFactory <ILog4NetLoggingService> .CreateStorageContainer().Store(loggingService); }
private void FetchLoggerAndLog(Exception ex) { if (_loggingService != null) { return; } _loggingService = Log4NetLoggingFactory.GetLogger(); _loggingService.LogWarning(this, "IDisposable problem disposing", ex); }
[DefaultConstructor] // This is the attribute you need to add on the constructor public UserGrantService( ILog4NetLoggingService loggingService , IMapper mapper , ApplicationSignInManager signInManager , ApplicationUserManager userManager , ApplicationRoleManager roleManager ) { _loggingService = loggingService; _mapper = mapper; _signInManager = signInManager; _userManager = userManager; _roleManager = roleManager; }
[DefaultConstructor] // This is the attribute you need to add on the constructor public ApplicationRoleService( IUnitOfWorkAsync unitOfWorkAsync , ILog4NetLoggingService loggingService , IMapper mapper , IRepositoryAsync <ApplicationRole> repository , ApplicationSignInManager signInManager , ApplicationUserManager userManager , ApplicationRoleManager roleManager ) : base(repository) { _unitOfWorkAsync = unitOfWorkAsync; _loggingService = loggingService; _mapper = mapper; _signInManager = signInManager; _userManager = userManager; _roleManager = roleManager; }
public WebSecurity( IUnitOfWorkAsync unitOfWorkAsync , ILog4NetLoggingService loggingService , IMapper mapper , ApplicationSignInManager signInManager , ApplicationUserManager userManager , ICachedUserAuthorizationGrantsProvider cachedUserAuthorizationGrantsProvider ) { _userManager = userManager; _cachedUserAuthorizationGrantsProvider = cachedUserAuthorizationGrantsProvider; _signInManager = signInManager; _loggingService = loggingService ?? throw new ArgumentNullException(nameof(loggingService)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _unitOfWorkAsync = unitOfWorkAsync ?? throw new ArgumentNullException(nameof(unitOfWorkAsync)); // _userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>(); }