asp.net mvc - code first migration produces empty up down methods when add new model to existing database -


i created models , performed code first migration resulted in prepopulated down methods. @ later stage added new models application. new models added cart, orderdetails , order. typed add-migration each of these models result produced empty down methods.

i ask why these down methods empty when added new model. referenced these models in dbcontext, same dbcontext referenced created models.

these new model classes added:

public class orderdetail {     public int orderdetailid { get; set; }     public int orderid { get; set; }     public int bookid { get; set; }      public int quantity { get; set; }      public decimal unitprice { get; set; }      public virtual book books { get; set; }     public virtual order order { get; set; }  }   public class cart {         [key]         public int recordid { get; set; }         public string cartid { get; set; }         public int bookid{ get; set; }         public int count { get; set; }         public virtual book book { get; set; } }  class order {     public int orderid { get; set; }      public string username { get; set; }      public string firstname { get; set; } } 

here dbcontext

public bookstoreonlinedb() : base("name=bookstoreonlinedb")     {     }      public system.data.entity.dbset<bookstoreonline.models.book> books { get; set; }      public system.data.entity.dbset<bookstoreonline.models.author> authors { get; set; }      public system.data.entity.dbset<bookstoreonline.models.bookstatus> bookstatus { get; set; }      public system.data.entity.dbset<bookstoreonline.models.genre> genres { get; set; }      public system.data.entity.dbset<bookstoreonline.models.order> orders { get; set; }      public system.data.entity.dbset<bookstoreonline.models.orderdetail> orderdetails { get; set; }           public system.data.entity.dbset<bookstoreonline.models.cart>carts {  get; set; } } 

in summary, how populate new down methods regards newly added cart, orderdetail , detail models.

n.b. orderdetails model , cart model reference book model(book model contains had data migration performed on @ earlier stage , contains populated down methods).

new , appreciate help. thanks

answer: in pm console: add-migration initialcreate //this included newly added models e.g ids,(cart,orderdetails, order models) down methods


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -