是否可以将配置文件中的数据播种到 table 中,该 table 由于复数和单个拼写差异而更改

Is it possible to seed data from Configuration file, into a table that has been changed due to plural and single spelling difference

我目前正在从配置文件中设置播种数据,但遇到 table 的复数和单名称更改。 (Category/Categories).

种子方法适用于所有其他 tables 除了类别,我认为这与 属性 名称(类别)和实际 table 名称的区别有关它创建(类别)

数据库上下文:

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

        public ApplicationDbContext(): base("DefaultConnection", throwIfV1Schema: false)
        {
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //Database.SetInitializer<ApplicationDbContext>(null);
            base.OnModelCreating(modelBuilder);
        }

配置:

 var test = new Category { CategoryName = "test" }; --- This cant find CategoryName despite the property being in the model.

            context.Categories.Add(test);


            context.SaveChanges();

这似乎是模型和 table 之间的简单误解,但我不知道如何映射,这是否可以不更改 table 名称?

编辑: 这是类别模型:


namespace WebApplication1.Models
{
    public class Category
    {
        public int CategoryID { get; set; }
        public string CategoryName { get; set; }

        public virtual ICollection<Item> Items{ get; set; }

    }
}

格特·阿诺德回答。我试图获取的类别是一个不同的命名空间。