You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.7 KiB
52 lines
1.7 KiB
2 years ago
|
using Easy.AuthorityManagement.Clean.Contracts;
|
||
|
using Easy.AuthorityManagement.Clean.Domain.Repositories;
|
||
|
using Easy.AuthorityManagement.Infrastructure;
|
||
|
using Easy.Extensions;
|
||
|
|
||
|
namespace Easy.AuthorityManagement;
|
||
|
public static class ProgramExtension
|
||
|
{
|
||
|
public static WebApplication ConfigureServices(this WebApplicationBuilder builder)
|
||
|
{
|
||
|
builder.AddCustomDbContext();
|
||
|
builder.AddCustomSwagger();
|
||
|
//Easy.Extensions
|
||
|
builder.Services.AddDependency();
|
||
|
builder.Services.AddDynamicWebApi();
|
||
|
builder.Services.AddDomainServices();
|
||
|
builder.Services.AddApiResultProxy(new ApiResultOptions()
|
||
|
{
|
||
|
ApiResultRroxy = true,
|
||
|
ParameterVerification = true
|
||
|
});
|
||
|
builder.Services.AddTransient(typeof(IRepository<>), typeof(RepositoryBase<>));
|
||
|
//builder.Services.AddUnitOfWork<IUnitOfWork, UnitOfWorkBase>();
|
||
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
||
|
builder.Services.AddHttpContextAccessor();
|
||
|
//work Id
|
||
|
builder.Services.AddDriftingSnowflakes(1);
|
||
|
|
||
|
return builder.Build();
|
||
|
}
|
||
|
public static WebApplication ConfigurePipeline(this WebApplication app)
|
||
|
{
|
||
|
app.LocalEnv();
|
||
|
|
||
|
app.UseHttpsRedirection();
|
||
|
|
||
|
app.MapControllers();
|
||
|
return app;
|
||
|
}
|
||
|
private static void LocalEnv(this WebApplication app)
|
||
|
{
|
||
|
if (app.Environment.IsDevelopment())
|
||
|
{
|
||
|
app.UseSwagger().UseSwaggerUI(c =>
|
||
|
{
|
||
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Easy.AuthorityManagement.Api v1");
|
||
|
c.DisplayOperationId();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|