示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddADSConfiguration();
            services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(dispose: true));
            services.AddADSLogger();

            services.AddSwaggerGen(swagger =>
            {
                var contact = new Contact()
                {
                    Name  = Configuration.GetSection("Swagger:ContactName").Value,
                    Url   = Configuration.GetSection("Swagger:ContactUrl").Value,
                    Email = Configuration.GetSection("Swagger:ContactEmail").Value
                };

                swagger.SwaggerDoc(Configuration.GetSection("Swagger:DocNameV1").Value,
                                   new Info
                {
                    Title       = Configuration.GetSection("Swagger:DocInfoTitle").Value,
                    Version     = Configuration.GetSection("Swagger:DocInfoVersion").Value,
                    Description = Configuration.GetSection("Swagger:DocInfoDescription").Value,
                    Contact     = contact
                });

                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                swagger.IncludeXmlComments(xmlPath);
            });

            services.AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
示例#2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader()
                                  .AllowCredentials());
            });



            services.AddADSConfiguration(options =>
            {
                options.Configure(new ConfigurationParamModel
                {
                    Service
                        = Configuration.GetSection("Service").Value,
                    ServiceId
                        = Configuration.GetSection("ServiceId").Value,
                    ServiceConfiguration
                        = Configuration.GetSection("Global:Services:Configuration:Service").Value,
                    ServiceVersion
                        = Configuration.GetSection("ServiceVersion").Value,
                    ServiceEnvironment
                        = Configuration.GetSection("ServiceEnvironment").Value
                });
            });

            services.AddTransient <ILogRepository, LogRepository>();
            services.AddSingleton <LogContext>();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
示例#3
0
        private void StartConfiguracion(IServiceCollection services)
        {
            services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(dispose: true));
            services.AddADSConfiguration();
            //services.AddADSLogger();

            services.AddSingleton <IConsultaPlaService, ConsultaPlaService>();
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <RegistroCivilContexto>(options =>
            {
                var connection = Configuration.GetSection("Global:Services:Siaerp:ConnectionString").Value;
                options.UseOracle(connection);
            });

            services.AddDbContext <OdsContexto>(options =>
            {
                var connection = Configuration.GetSection("registrocivil:ConnectionStrings:OdsConnection").Value;
                options.UseOracle(connection);
            }
                                                );

            services.AddScoped <IRegistroCivilServicio, RegistroCivilServicio>();
            services.AddScoped <IConsultaLogRepositorio, ConsultaLogRepositorio>();
            services.AddScoped <IDatosPersonaRcRepositorio, DatosPersonaRcRepositorio>();
            services.AddADSConfiguration();
            services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(dispose: true));
            services.AddADSLogger();
            services.AddSwaggerGen(swagger =>
            {
                var contact = new Contact()
                {
                    Name = SwaggerConfiguration.ContactName, Url = SwaggerConfiguration.ContactUrl
                };
                swagger.SwaggerDoc(SwaggerConfiguration.DocNameV1,
                                   new Info
                {
                    Title       = SwaggerConfiguration.DocInfoTitle,
                    Version     = SwaggerConfiguration.DocInfoVersion,
                    Description = SwaggerConfiguration.DocInfoDescription,
                    Contact     = contact
                }
                                   );
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                swagger.IncludeXmlComments(xmlPath);
            });
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }