C
Join ServerC#
help
✅ Build failed on `dotnet-ef database update`
Ddemndev2/20/2023


FFusedQyou2/20/2023
Did you build and try the command afterwards?
FFusedQyou2/20/2023
Can we see the code up to the point where you call
AddDbContext
?Ddemndev2/20/2023
yes:
public static IServiceCollection AddPersistence(this IServiceCollection services, IConfiguration configuration)
{
var connection = configuration.GetConnectionString("DefaultConnection")
?? throw new Exception("Unable to parse DbConnection configuration");
services.AddDbContext<IApplicationContext, ApplicationContext>(options => options.UseSqlite(connection));
return services;
}
FFusedQyou2/20/2023
And up to where you call
AddPersistence
?Ddemndev2/20/2023
var builder = WebApplication.CreateBuilder(args);
{
builder.Services
.AddApplication()
.AddPersistence(builder.Configuration)
.AddWeb(builder.Configuration);
}
FFusedQyou2/20/2023
Maybe try removing
{}
Ddemndev2/20/2023
no, but it builds when I call database update:
Build started...
FFusedQyou2/20/2023
I believe EF injects code up to
AddDbContext
and it might not be able to properly do thatDdemndev2/20/2023
all the same

Ddemndev2/20/2023
and again there's nothing helpful

Ddemndev2/20/2023
miraculously the problem solved itself