Entity Framework 7 Database First configuration (MVC 6)

前端 未结 2 1017
情话喂你
情话喂你 2020-12-11 09:28

After a long constant struggle, finally figured out how to use EF7 Database first approach using MVC 6. This is how it goes:

App.Impl -> project.json:



        
2条回答
  •  -上瘾入骨i
    2020-12-11 09:51

    I also wanted to specify a handful of tables. I followed Oleg's explanation for showing how to import multiple tables in one command. But .Net Core 3.1, in the Visual Studio Package Manager Console, that way gives the error - Cannot bind parameter because parameter 'Tables' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".

    So Oleg's syntax would have to be changed to - t dbo.Users,dbo.Products,dbo.Orders

    My full command was from the Package Manager Console is -

    Scaffold-DbContext "Data Source=servername;Initial Catalog=dbname;User ID=usn;PWD=mypw;Connect Timeout=100" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -f -t dbo.Users,dbo.Products,dbo.Orders

提交回复
热议问题