/// <summary> /// ctor /// </summary> public UnitOfWork(IBreezeValidator breezevalidator) { _contextProvider = new EFContextProvider <EnergyNetworkDbContext>(); _contextProvider.BeforeSaveEntitiesDelegate = breezevalidator.BeforeSaveEntities; _contextProvider.BeforeSaveEntityDelegate = breezevalidator.BeforeSaveEntity; _audit = _contextProvider.Context.BeginAudit(AuditLoggerConfig.GetConfiguredAuditLogger()); NetworkRepository = new Repository <Network>(_contextProvider.Context); CompanyRepository = new Repository <Company>(_contextProvider.Context); NetworkCompanyRepository = new Repository <NetworkCompany>(_contextProvider.Context); MeasureRepository = new Repository <Measure>(_contextProvider.Context); InvitationRepository = new Repository <Invitation>(_contextProvider.Context); MeasureStateRepository = new Repository <MeasureState>(_contextProvider.Context); EnergySourceRepository = new Repository <EnergySource>(_contextProvider.Context); OutputUnitRepository = new Repository <OutputUnit>(_contextProvider.Context); EnergySavingRepository = new Repository <EnergySaving>(_contextProvider.Context); SurveyRepository = new Repository <Survey>(_contextProvider.Context); UserProfileRepository = new Repository <UserProfile>(_contextProvider.Context); DocumentContentRepository = new Repository <DocumentContent>(_contextProvider.Context); DocumentRepository = new Repository <Document>(_contextProvider.Context); InvestmentPlanRepository = new Repository <InvestmentPlan>(_contextProvider.Context); ComparisonRepository = new Repository <Comparison>(_contextProvider.Context); AreaRepository = new Repository <Area>(_contextProvider.Context); ProductRepository = new Repository <Product>(_contextProvider.Context); ProductionTimeRepository = new Repository <ProductionTime>(_contextProvider.Context); ReadingRepository = new Repository <Reading>(_contextProvider.Context); ImportantTopicRepository = new Repository <ImportantTopic>(_contextProvider.Context); ChangeSetRepository = new Repository <ChangeSet>(_contextProvider.Context); ChangeRepository = new Repository <Change>(_contextProvider.Context); CompanySizeRepository = new Repository <CompanySize>(_contextProvider.Context); FiscalYearRepository = new Repository <FiscalYear>(_contextProvider.Context); OperationTimeRepository = new Repository <OperationTime>(_contextProvider.Context); }
public static ApplicationUserManager Create(IdentityFactoryOptions <ApplicationUserManager> options, IOwinContext context) { var dbContext = context.Get <EnergyNetworkDbContext>(); _audit = dbContext.BeginAudit(AuditLoggerConfig.GetConfiguredAuditLogger()); var manager = new ApplicationUserManager(new UserStore <UserProfile>(dbContext)); // Configure validation logic for usernames manager.UserValidator = new UserValidator <UserProfile>(manager) { AllowOnlyAlphanumericUserNames = true, RequireUniqueEmail = true }; // Configure validation logic for passwords manager.PasswordValidator = new PasswordValidator { RequiredLength = 6, RequireNonLetterOrDigit = false, RequireDigit = false, RequireLowercase = false, RequireUppercase = false }; manager.UserLockoutEnabledByDefault = true; manager.EmailService = new EmailService(); var dataProtectionProvider = options.DataProtectionProvider; if (dataProtectionProvider != null) { manager.UserTokenProvider = new DataProtectorTokenProvider <UserProfile>(dataProtectionProvider.Create("ASP.NET Identity")); } return(manager); }
public static ApplicationRoleManager Create(IdentityFactoryOptions <ApplicationRoleManager> options, IOwinContext context) { var dbContext = context.Get <EnergyNetworkDbContext>(); _audit = dbContext.BeginAudit(AuditLoggerConfig.GetConfiguredAuditLogger()); return(new ApplicationRoleManager(new RoleStore <IdentityRole>(context.Get <EnergyNetworkDbContext>()))); }