Example of how to use a SQL Server database with EF Core #834
Replies: 2 comments 1 reply
-
Thank you for bringing this to our attention. You are correct, that particular example is no longer accurate. I will rewrite it within the next few days. In the meantime, you can refer to the complete example here, which already uses version 3.0.0. Alternatively, you can look into this guide, which is based on Microsoft's article titled Integration tests in ASP.NET Core. We will soon publish this as a dedicated guide. |
Beta Was this translation helpful? Give feedback.
-
I am also facing issue with MsSqlBuilder, I have set it up as shown here private readonly MsSqlContainer dbContainer = new MsSqlBuilder()
.WithImage("mcr.microsoft.com/mssql/server:2022-latest")
.WithCleanUp(true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(1433))
.Build(); and then in await dbContext.Database.MigrateAsync(); I can see table Not sure if it's me or if others have also seen this issue, need some help here. |
Beta Was this translation helpful? Give feedback.
-
I have an API REST .NET 7 and I want to build integrations tests using a sql server container database. I've tried to follow the example in the documentation (https://dotnet.testcontainers.org/examples/aspnet/), but it seems to be outdated for version 3.0.0, some classes are missing or obsolete.
What I want is to load the sql server, create a database and then be able to work with the Entity Framework Core DbSets.
Is there an example for the new version?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions