Entity Framework Migrations NOT writing to Database

Keshav Mooruth 1 Reputation point
2022-11-09T08:40:26.983+00:00

I am working on a E-Commerce application in C#.
I am following this tutorial on Youtube: https://www.youtube.com/watch?v=R25Edio81AU.

When I do Migrations for each of the Tables in the ApplicationDBContext, the Migrations are empty. When I attempt to Update-Database, the Tables are not added to the Database.

How can I succesfully create and add these Migrations to the Database?

ApplicationDBContext
https://i.stack.imgur.com/1V2sE.png

Product.cs Class
https://i.stack.imgur.com/vgIqf.png

AddproductModel Migration
https://i.stack.imgur.com/m5LTN.png

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,521 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,281 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,051 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,467 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Laxmikant 216 Reputation points
    2022-11-11T13:15:23.38+00:00

    what ef command you are using? you need to use Add-Migration

    Add-Migration InitialCreate -OutputDir Migrations\initial  
    

    For more step by step details visit - https://geeksarray.com/blog/entity-framework-core-code-first-migration-using-separate-assembly

    1 person found this answer helpful.
    0 comments No comments