wpf 在 VS 2015 和 EF7 中从模型生成 SQLite 数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30330352/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 13:08:51  来源:igfitidea点击:

Generating SQLite Database from Model at VS 2015 & EF7

c#wpfentity-frameworksqlitevisual-studio-2015

提问by Andrzej

I'm trying to make Windows Presentation Foundation application, utilizing Entity Framework 7 & SQLite Database File. I've made *.edmx model, but when trying to generate model i can't make SQLite Connection. Tried everything from https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wikibut nothing helped, still no option for creating proper connection.

我正在尝试使用实体框架 7 和 SQLite 数据库文件制作 Windows Presentation Foundation 应用程序。我已经制作了 *.edmx 模型,但是在尝试生成模型时,我无法进行 SQLite 连接。尝试了https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki 中的所有内容,但没有任何帮助,仍然没有创建正确连接的选项。

Generation chooses

一代选择

There was already similar question - VS 2015 SQLite data provider- but it was few months ago. Have anything changed? Is there any way to connect EF7 on VS2015 to SQLite?

已经有类似的问题 - VS 2015 SQLite 数据提供程序- 但这是几个月前的事情。有什么改变吗?有什么办法可以将 VS2015 上的 EF7 连接到 SQLite?

回答by A.J.Bauer

You need to download a setup package from the SQLite.org. The only one I got it working with was sqlite-netFx46-setup-bundle-x86-2015-1.0.98.0.exe(The 64x version didn't do it).

您需要从 SQLite.org 下载安装包。我唯一使用它的是sqlite-netFx46-setup-bundle-x86-2015-1.0.98.0.exe(64x 版本没有这样做)。

Change data source

You might also want to get the "SQL Server Compact/SQLite Toolbox" extension for Visual Studio (Tools/Extensions and Updates..). With it you can export tables from MS Sql (beta) among other things. It does work for most tables, had difficulties for tables with multiple primary keys in them (composite keys) though.

更改数据源

您可能还想获得 Visual Studio 的“SQL Server Compact/SQLite Toolbox”扩展(工具/扩展和更新..)。有了它,您可以从 MS Sql(测试版)中导出表等。它确实适用于大多数表,但对于其中包含多个主键(复合键)的表有困难。

enter image description hereenter image description here

在此处输入图片说明在此处输入图片说明