Seed method not called, Entity Framework 6

前端 未结 7 797
我在风中等你
我在风中等你 2020-12-28 18:29

I have a DatabaseInitializer class

public class DatabaseInitializer : CreateDatabaseIfNotExists
{
    protected override          


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 18:47

    My seed was not being executed either. However, it was because I added a column to a model that I had no intention of using in my actual database and forgot to use the [NotMapped] annotation.

        [NotMapped]
        public string Pair { get; set; }
    

    There was no error message relating to this being the cause at all. Just a null reference to my repository obj when I tried to query data that should have been there.

提交回复
热议问题