© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
37 replies
Temptica

❔ EF Core not create model on start-up

So I have an ASP.NET Web API running on docker which works. So does the SQL DB . The API can connect to the database. I can open the database with SSMS. But it only contains the default system databases.

I have a working DBContext but somehow when in the docker container after performing docker-compose up, the Model has not been created. I added following line in the Program.cs
builder.Services.AddDbContext<UserContext>(option => option.UseSqlServer(builder.Configuration.GetConnectionString("ConnectionString")
builder.Services.AddDbContext<UserContext>(option => option.UseSqlServer(builder.Configuration.GetConnectionString("ConnectionString")


It works without docker
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

EF Core Model not-required property
C#CC# / help
4y ago
✅ Update or create portfolio EF CORE
C#CC# / help
2y ago
EF Core
C#CC# / help
2y ago
EF-Core unable to create migration
C#CC# / help
2y ago