Unable to create an object of type 'MyContext'. For the different patterns supported at design time

前端 未结 9 2933
逝去的感伤
逝去的感伤 2021-02-19 16:42

I have ConsoleApplication on .NET Core and also i added my DbContext to dependencies, but howewer i have an error:

Unable to create an object of type \'My

9条回答
  •  野性不改
    2021-02-19 16:58

    Hade the same problem with NET Core 3.1.

    Needed to add one more constructor too solev this. Why I do not know.

    Never hade to do it in the past.

    public DataContext()
    {            
    }
    
    public DataContext(DbContextOptions options)
        : base(options)
    { }
    

提交回复
热议问题