如何使用EF在SQLite中启用迁移 [英] How to enable migration in SQLite using EF

查看:273
本文介绍了如何使用EF在SQLite中启用迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我陷入了问题。我正在为Windows桌面应用程序编写代码,并且必须使用sqlite作为数据库。我已经从nuget包中成功安装了 system.data.sqlite 和实体框架。我还创建了DbContext类。现在的问题是,一旦我尝试运行代码,就会出现异常,其内部消息是

I have stuck in problem. I am writing a code for windows desktop application and I have to use sqlite as a database. I have successfully installed system.data.sqlite and entity framework from nuget package. I have also created my DbContext class. Now problem is that as soon as I tried to run my code an exception comes whose inner message is


{ SQLite错误1:'否这样的表:TimeSheet'}。

{"SQLite Error 1: 'no such table: TimeSheet'"}.

这意味着您的表TimeSheet在数据库中不存在。请告诉我如何使用实体框架在sqlite中创建表或如何启用迁移。

This means your table TimeSheet does not exist in database. Plz tell me how to create table in sqlite using entity framework or how to enable migrations.

推荐答案

SQLite。

https://github.com/bubibubi/db2ef6migrations 基于新的EF6迁移接口,但有一些限制。
您可以从Nuget下载它,搜索System.Data.SQLite.EF6.Migrations

https://github.com/bubibubi/db2ef6migrations is based on the new EF6 migration interface but it has some restrictions. You can download it from Nuget searching for System.Data.SQLite.EF6.Migrations

这篇关于如何使用EF在SQLite中启用迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆