// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <SecurityContext>(options => options.UseSqlServer( Configuration["ConnectionStrings:SecurityContextConnection"])); services.AddMvc(options => { options.EnableEndpointRouting = false; options.Filters.Add <ValidationFilter>(); }) .SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0); // Helpers IdentityInstaller.ConfigureService(services); AuthenticationInstaller.ConfigureService(services, Configuration); SwaggerInstaller.ConfigureService(services); // Settings services.Configure <EmailSettings>(Configuration.GetSection("Email")); services.Configure <ClientAppSettings>(Configuration.GetSection("ClientApp")); services.Configure <JwtSecurityTokenSettings>(Configuration.GetSection("JwtSecurityToken")); services.Configure <QRCodeSettings>(Configuration.GetSection("QRCode")); // Services services.AddTransient <IEmailService, EmailService>(); services.AddTransient <IAuthService, AuthService>(); services.AddTransient <IUserService, UserService>(); // Data services.AddDbContextPool <DataContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:DataContextConnection"], x => x.UseNetTopologySuite())); services.AddHttpContextAccessor(); services.AddControllers(); }
public static ComponentInstallerBase GetInstaller(string installerType) { ComponentInstallerBase installer = null; switch (installerType) { case "File": installer = new FileInstaller(); break; case "Assembly": installer = new AssemblyInstaller(); break; case "ResourceFile": installer = new ResourceFileInstaller(); break; case "AuthenticationSystem": case "Auth_System": installer = new AuthenticationInstaller(); break; case "DashboardControl": installer = new DashboardInstaller(); break; case "Script": installer = new ScriptInstaller(); break; case "Config": installer = new ConfigInstaller(); break; case "Cleanup": installer = new CleanupInstaller(); break; case "Skin": installer = new SkinInstaller(); break; case "Container": installer = new ContainerInstaller(); break; case "Module": installer = new ModuleInstaller(); break; case "CoreLanguage": installer = new LanguageInstaller(LanguagePackType.Core); break; case "ExtensionLanguage": installer = new LanguageInstaller(LanguagePackType.Extension); break; case "Provider": installer = new ProviderInstaller(); break; case "SkinObject": installer = new SkinControlInstaller(); break; case "Widget": installer = new WidgetInstaller(); break; default: ListController listController = new ListController(); ListEntryInfo entry = listController.GetListEntryInfo("Installer", installerType); if (entry != null && !string.IsNullOrEmpty(entry.Text)) { installer = (ComponentInstallerBase)Reflection.CreateObject(entry.Text, "Installer_" + entry.Value); } break; } return installer; }