public static void Main(string[] args) { IdentityModelEventSource.ShowPII = true; Log.Logger = new LoggerConfiguration() .Destructure.ByMaskingProperties(opts => { opts.PropertyNames.Add(nameof(CreateUserCommand.Password)); opts.PropertyNames.Add(nameof(ModificarPasswordCommand.PasswordActual)); opts.PropertyNames.Add(nameof(ModificarPasswordCommand.PasswordNuevo)); opts.PropertyNames.Add(nameof(RefreshCredentialsCommand.RefreshToken)); opts.PropertyNames.Add(nameof(RefreshCredentialsCommand.Token)); opts.Mask = "******"; }) .ReadFrom.Configuration(Configuration) .CreateLogger(); var host = CreateWebHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var breadingBreadContext = services.GetRequiredService <BreadingBreadDbContext>(); breadingBreadContext.Database.Migrate(); BreadingBreadDbInitializer.Initialize(breadingBreadContext); } catch (Exception ex) { var logger = scope.ServiceProvider.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred while migrating or initializing the database."); } } host.Run(); }
public static void InitializeDbForTests(BreadingBreadDbContext context) { BreadingBreadDbInitializer.Initialize(context); }