Пример #1
0
        public static void Map(IServiceCollection services)
        {
            // SERVICES
            AutoMapperConfigBuilder.RegisterAutoMapper(services, new MappingProfile());

            // Test services
            services.AddTransient <TestService>();
            services.AddTransient <InlineService>();

            var configuration = ConfigHelper.GetIConfigurationRoot(Directory.GetCurrentDirectory());

            services.AddSingleton <IConfiguration>(configuration);
            services.AddTransient <DivisionService>();
            services.AddTransient <AddressService>();
            services.AddTransient <DaDataService>();

            // CONTROLLERS
            services.AddTransient <DivisionsController>();

            // OTHERS

            services.AddDbContext <OdContext>(options =>
                                              options.UseSqlite(SqliteConfigBuilder.GetConnection()),
                                              ServiceLifetime.Transient);
        }
Пример #2
0
        public static void Map(IServiceCollection services)
        {
            // SERVICES
            AutoMapperConfigBuilder.RegisterAutoMapper(services, new MappingProfile());
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "OD_Stat Api", Version = "v1"
                });
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
                c.DescribeAllParametersInCamelCase();
            });

            // BUSINESS SERVICES
            services.AddTransient <DivisionService>();
            services.AddTransient <DaDataService>();
            services.AddTransient <AddressService>();

            // CONTROLLERS
            services.AddTransient <DivisionsController>();

            // OTHERS
            services.AddDbContext <OdContext>(opt =>
                                              opt.UseSqlite(SqliteConfigBuilder.GetConnection()),
                                              ServiceLifetime.Transient);
        }