locked
create modal class Category but db table changes to products RRS feed

  • Question

  • User-1738998028 posted

    Hi,

    I crated class for Category as below

      public class Category
        {
            [ScaffoldColumn(false)]
            public int CategoryId { get; set; }

            [Required, StringLength(50), Display(Name = "Name")]
            public string CategoryName { get; set; }

            [Required, StringLength(400), Display(Description = "Description")]
            public string CategoryDescription { get; set; }

            public  Nullable<DateTime> CreatedDate { get; set; }

            public Nullable<DateTime> ModifiedDate { get; set; }

            public Nullable<int> CreatedBy { get; set; }

            public Nullable<int> ModifiedBy { get; set; }

            public string DeleteStatus { get; set; }

            public string CategoryThumb { get; set; }

            public string CategoryImage { get; set; }

            //public virtual ICollection<Category> Categories { get; set; }

        }

    public class ProductContext : DbContext
        {
            public ProductContext()
                : base("OnlineEcommence")
            {
            }

            public DbSet<Category> Categories { get; set; }
            public DbSet<SubCategory> SubCategories { get; set; }
        }

    In the DB table - i have Category table

    After I run the application, System auto created Categories in the db

    how i can fix not creating Categories in db?

    please advice

    Saturday, September 5, 2015 9:05 AM

Answers