Ejemplo n.º 1
0
 protected void ConfigureServices(IServiceCollection services)
 {
     // Context Config
     ConfigureDbContext(services);
     // Dependencies Config
     NativeInjectorBootStrapper.AddApiConfiguration(services);
     // AutoMapper
     services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
 }
Ejemplo n.º 2
0
 public static IServiceCollection AddApiConfiguration(this IServiceCollection services)
 {
     // Dependencies Config
     NativeInjectorBootStrapper.AddApiConfiguration(services);
     // Controllers
     services
     .AddControllers()
     .AddJsonOptions(opts => opts.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)));
     // Cors
     services.AddCors(options =>
     {
         options.AddPolicy("Total",
                           builder =>
                           builder
                           .AllowAnyOrigin()
                           .AllowAnyMethod()
                           .AllowAnyHeader());
     });
     // AutoMapper
     services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
     return(services);
 }