Simple example using System.Data.SQLite with Entity Framework 6

前端 未结 2 1970
走了就别回头了
走了就别回头了 2020-12-23 21:13

I am trying to get a simple code first example to work in a console app using SQLite and EF6, however I am running into multiple errors: I created a new console project in V

2条回答
  •  攒了一身酷
    2020-12-23 21:44

    You need to initialize your database with the tables for your models. Notice the error "SQL logic error or missing database no such table: People".

    That means you need to run SQL to create the corresponding tables in the database, thankfully, if using VS, under the context menu while in the model editor (*.edmx files), there is an option to have it auto-generate the SQL and execute it to create the table entries in the database for you based on the model. Note: sometimes the auto-generated for non MS-SQL can have issues that need to be manually fixed before it will compile/run.

提交回复
热议问题