Hello everyone Please help me, I have added a new field in our model, Now I want to run our API project so it updates automatic fields in our database. But in my case no updated fields in our database. This is my code
public static class MigrationsConfiguration
{
public static IApplicationBuilder DbMigrations(this IApplicationBuilder app)
{
using var scope = app.ApplicationServices.CreateScope();
var logger = scope.ServiceProvider.GetRequiredService
var db = scope.ServiceProvider.GetRequiredService
logger.LogInformation("Starting migrations");
db.Database.Migrate();
logger.LogInformation("Db migrations completed");
return app;
}
}
Jignesh KumarPosted Jun 19, 2024, 2:43 AM
Hello Sunny,
Please try to add try catch to check any exception in your method,
One more this to check your Configure method is calling this method.
Sourabh DhimanPosted Jun 18, 2024, 12:33 PM
Amit Mohanty I have checked my program.cs file
Amit MohantyPosted Jun 18, 2024, 12:17 PM
Ensure that DbMigrations() is called in the startup process of your application.