asp.net mvc - How to add a tag class to database using Migrations -
i want create these classes , use migration update database . question :
how make posttagmap class ? , here photo of classes relation ..
public class post { public virtual int id { get; set; } public virtual string title { get; set; } public virtual string shortdescription { get; set; } public virtual string description { get; set; } public virtual string meta { get; set; } public virtual string urlslug { get; set; } public virtual bool published { get; set; } public virtual datetime postedon { get; set; } public virtual datetime? modified { get; set; } public virtual category category { get; set; } public virtual ilist<tag> tags { get; set; } }
and here tag class :
public class tag { public virtual int id { get; set; } public virtual string name { get; set; } public virtual string urlslug { get; set; } public virtual string description { get; set; } public virtual ilist<post> posts { get; set; } }
you don't need create posttagmap class, many many relationship handled navigation properties in case public virtual ilist<tag> tags { get; set; }
post class , public virtual ilist<post> posts { get; set; }
tag class. handled once run update-database
Comments
Post a Comment