- add service-provider validation

This commit is contained in:
meysamhadeli 2022-12-20 00:16:10 +03:30
parent 1c4f20ddbc
commit 13f5a8265d
5 changed files with 33 additions and 0 deletions

View File

@ -10,6 +10,8 @@ var env = builder.Environment;
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
builder.AddCustomSerilog(env);
builder.Services.AddJwt();
builder.Services.AddControllers();

View File

@ -3,6 +3,14 @@ using BuildingBlocks.Web;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseDefaultServiceProvider((context, options) =>
{
// Service provider validation
// ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/
options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests");
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddInfrastructure();

View File

@ -3,6 +3,14 @@ using Flight.Extensions.Infrastructure;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseDefaultServiceProvider((context, options) =>
{
// Service provider validation
// ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/
options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests");
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddInfrastructure();

View File

@ -3,6 +3,14 @@ using Identity.Extensions.Infrastructure;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseDefaultServiceProvider((context, options) =>
{
// Service provider validation
// ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/
options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests");
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddInfrastructure();

View File

@ -3,6 +3,13 @@ using Passenger.Extensions.Infrastructure;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseDefaultServiceProvider((context, options) =>
{
// Service provider validation
// ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/
options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests");
options.ValidateOnBuild = true;
});
builder.AddMinimalEndpoints();
builder.AddInfrastructure();