122 lines
4 KiB
C#
122 lines
4 KiB
C#
|
|
using Microsoft.AspNetCore.Builder;
|
|||
|
|
using Microsoft.AspNetCore.Hosting;
|
|||
|
|
using Microsoft.EntityFrameworkCore;
|
|||
|
|
using Microsoft.Extensions.Configuration;
|
|||
|
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
|
using Microsoft.Extensions.Hosting;
|
|||
|
|
using Microsoft.OpenApi.Models;
|
|||
|
|
using REC_HUMA.CORE.Interfaces;
|
|||
|
|
using REC_HUMA.INFRASTRUCTURE;
|
|||
|
|
using REC_HUMA.INFRASTRUCTURE.Repositories;
|
|||
|
|
using System;
|
|||
|
|
|
|||
|
|
namespace REC_HUMA.API
|
|||
|
|
{
|
|||
|
|
public class Startup
|
|||
|
|
{
|
|||
|
|
public Startup(IConfiguration configuration)
|
|||
|
|
{
|
|||
|
|
Configuration = configuration;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public IConfiguration Configuration { get; }
|
|||
|
|
|
|||
|
|
public void ConfigureServices(IServiceCollection services)
|
|||
|
|
{
|
|||
|
|
services.AddCors();
|
|||
|
|
services.AddControllersWithViews();
|
|||
|
|
services.AddControllers();
|
|||
|
|
services.AddSwaggerGen(c =>
|
|||
|
|
{
|
|||
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "REC_HUMA.API", Version = "v1" });
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
services.AddDbContext<RECHUMAContext>(options =>
|
|||
|
|
options.UseSqlServer(Configuration.GetConnectionString("RECHUMA"))
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
|||
|
|
|
|||
|
|
services.AddControllersWithViews()
|
|||
|
|
.AddNewtonsoftJson(options =>
|
|||
|
|
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
//Inyecci<63>n de dependencia de los metodos de acceso a BD
|
|||
|
|
services.AddTransient<IBancoRepo, BancoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IBeneficioRepo, BeneficioRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<ICantonRepo, CantonRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IDeduccionRepo, DeduccionRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IDistritoRepo, DistritoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<ITipoTelefonoRepo, TipoTelefonoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<ITelefonoRepo, TelefonoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IEmpresaRepo, EmpresaRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IEstadoCivilRepo, EstadoCivilRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IHabilitadoRepo, HabilitadoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IPersonaRepo, PersonaRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<ITipoIdentificacionRepo, TipoIdentificacionRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IPaisRepo, PaisRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IProvinciaRepo, ProvinciaRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IUniversidadRepo, UniversidadRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IGradoAcademicoRepo, GradoAcademicoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IPuestoRepo, PuestoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<ITipoNombramientoRepo, TipoNombramientoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IDiasFeriadosRepo, DiasFeriadosRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<ISolicitudVacacionesRepo, SolicitudVacacionesRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IDiasAcreditadosPeriodoRepo, DiasAcreditadosPeriodoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<IDiasAcreditadosPeriodoHistoricoRepo, DiasAcreditadosPeriodoHistoricoRepo>();
|
|||
|
|
|
|||
|
|
services.AddTransient<INotificacionesRepo, NotificacionesRepo>();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|||
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|||
|
|
{
|
|||
|
|
app.UseCors(options =>
|
|||
|
|
{
|
|||
|
|
options.WithOrigins("*");
|
|||
|
|
options.AllowAnyMethod();
|
|||
|
|
options.AllowAnyHeader();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
if (env.IsDevelopment())
|
|||
|
|
{
|
|||
|
|
app.UseDeveloperExceptionPage();
|
|||
|
|
app.UseSwagger();
|
|||
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "REC_HUMA.API v1"));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
app.UseRouting();
|
|||
|
|
|
|||
|
|
app.UseAuthentication();
|
|||
|
|
app.UseAuthorization();
|
|||
|
|
|
|||
|
|
app.UseEndpoints(endpoints =>
|
|||
|
|
{
|
|||
|
|
endpoints.MapControllers();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|