// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { StartUpFunction.Configure(app, env); }
public void ConfigureServices(IServiceCollection services) { services.AddSession(); services.AddHttpContextAccessor(); services.Configure <SystemConfig>(Configuration.GetSection("SystemConfig")); services.Configure <AdminAreaConfig>(Configuration.GetSection("AdminAreaConfig")); services.Configure <LanguageSetting>(Configuration.GetSection("LanguageSetting")); //services.Configure<IEnumerable<LanguageConfig>>(Configuration.GetSection("LanguageSetting:LanguageConfigs")); //var tokenConfig1 = Configuration.GetSection("LanguageSetting").Get<LanguageSetting>(); //var language = Configuration.GetSection("LanguageSetting").Get<LanguageSetting>(); //language.LanguageConfigs = Configuration.GetSection("LanguageSetting:LanguageConfigs").Get<IEnumerable<LanguageConfig>>(); services.AddScoped <ISessionService, SessionService>(); services.AddScoped <IAdminTempleteRoot, Common.AdminLTE.Program>(); services.AddScoped <IConfigService, ConfigService>(); services.AddScoped <ISDHCLanguageService, SDHCLanguageService>(); services.AddControllersWithViews(); services.AddRazorPages(); services.AddServerSideBlazor(); var builder = new DbContextOptionsBuilder <MyDBContext>(); Action <DbContextOptionsBuilder> dbAction = options => { options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection")); }; services.AddDbContext <MyDBContext>(dbAction); services.AddIdentity <SDHCUser, IdentityRole>( options => { options.SignIn.RequireConfirmedAccount = false; }) .AddEntityFrameworkStores <MyDBContext>() .AddDefaultTokenProviders(); services.AddScoped <RoleManager <IdentityRole> >(); services.AddScoped(typeof(ISDHCMemberService <SDHCUser, IdentityResult, Claim, ClaimsPrincipal, UserLoginInfo, IUserValidator <SDHCUser>, IUserTwoFactorTokenProvider <SDHCUser> >), typeof(SDHCMemberService <SDHCUser>)); services.AddScoped(typeof(ISDHCSignInService <SDHCUser, IdentityResult, Claim, SignInResult, ClaimsPrincipal, AuthenticationProperties, AuthenticationScheme, ExternalLoginInfo>), typeof(SDHCSignInService <SDHCUser>)); services.AddScoped <ISDHCUserManager <SDHCUser>, SDHCUserManager <SDHCUser> >(); services.AddScoped <ISDHCUserManager, SDHCUserManager <SDHCUser> >(); StartUpFunction.ConfigureServices <SDHCUserManager <SDHCUser> >(Configuration, services); services.AddScoped <AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider <SDHCUser> >(); services.AddScoped <IUserService, UserService>(); services.AddScoped <IUserServiceStateProvider, UserServiceAuthenticationStateProvider>(); dbAction(builder); Func <CrudInit <BaseContentModel> > getCrud = () => new CrudInit <BaseContentModel>(() => Activator.CreateInstance(typeof(MyDBContext), builder.Options) as ISave); services.AddScoped <ICrudInit, CrudInit <BaseContentModel> >( (s) => getCrud()); services.AddScoped <ICrud, BaseCruds>(); services.AddScoped <ICrudContent, CrudContent>(); services.AddScoped <ICrudModel, CrudModel>(); AbstractBaseContent.Init <BaseContentModel>(() => new CrudContent(getCrud())); services.AddScoped <IContentService, ContentService>(); services.AddScoped <IContentListService, ContentService>(); services.AddScoped <ILayoutService, LayoutService>(); }
public void ConfigureServices(IServiceCollection services) { StartUpFunction.ConfigureServices <TestUser, SDHCCContent.Models.ContentBaseModel, DropDownBaseModel>( services, Configuration, HostingEnvironment); }