Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            SetupSwagger(services);

            services.AddSingleton <IObjectMapperConfiguration, ObjectMapperConfiguration>();
            CommonConfiguration.ConfigureDependency(services, Configuration);

            services.AddScoped <IProjectProvider, ProjectProvider>();
            services.AddScoped <IModuleProvider, ModuleProvider>();

            // Add framework services.
            services.AddMvc();

            string connectionString = Configuration[ConnectionStringName] ?? Configuration.GetConnectionString(ConnectionStringName);

            services.AddDbContext <CigarettoDataContext>(options => options.UseSqlServer(connectionString, a => a.MigrationsAssembly("SimCorp.Cloud.KPI.API.PostData")));
        }