Ask Your Question
0

Why is the Add-Migration command not creating the SQL Server database in ASP.NET Core 6.0 despite using Entity Framework version 6?

asked 2023-07-04 14:15:01 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-04 14:23:02 +0000

huitzilopochtli gravatar image

The Add-Migration command in Entity Framework is used to generate a code file that represents changes to the database schema. It does not create the SQL Server database itself. To create the database, you should use the Database.EnsureCreated() or Database.Migrate() methods in your application code.

However, it is also worth noting that Entity Framework version 6 is not officially supported in ASP.NET Core 6.0. ASP.NET Core 6.0 uses .NET 6, which is a completely separate runtime from .NET Framework, which is required for Entity Framework 6.0. Therefore, using Entity Framework 6.0 in ASP.NET Core 6.0 may lead to unexpected behavior and is not recommended. Instead, consider using Entity Framework Core or upgrading to a newer version of Entity Framework.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-04 14:15:01 +0000

Seen: 10 times

Last updated: Jul 04 '23