使用新的System.Data.SQLite获取实体框架模型 [英] Get Entity Framework Model with new System.Data.SQLite

查看:74
本文介绍了使用新的System.Data.SQLite获取实体框架模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用最新的System.Data.SQLite构建从SQLite数据库生成实体框架模型吗?

使用旧版本进行此操作很容易,因为它们会自动与Visual Studio集成,但是它们的EF支持对我来说还是有点过时.这就是为什么我不使用他们的EF组件的原因.但是,我目前在Win Forms应用程序中只能使用SQLite数据库,而且数据结构非常复杂,以至于我要自己花时间编写所有读取/写入结构.

<添加:2012年5月21日 st >
我在带有VS 2010 Pro的Win XP SP3虚拟机上进行了其他实验,发现了以下内容.运行新的System.Data.SQLite安装程序后,我为放置在bin目录中的设计时组件运行了安装程序.

*第一次运行它时,出现一个弹出窗口,提示确认"选项未启用,因此失败.

*然后从命令行以如下方式运行它:Installer -Confirm True

**这一次它没有对失败进行任何说明,但是我确实在命令行中查找到最后,它表示未进行任何更改,因为启用了如果"选项.

*这次我运行:安装程序-确认True -WhatIf False

**在创建新的数据库连接时,这添加了System.Data.SQLite数据库文件作为我的DataSources的选项.但是,当我选择一个数据库或创建一个新数据库以输入数据库路径时,用于插入数据库连接的所有弹出窗口都会关闭.

**我尝试在创建新连接时手动插入路径来创建SQLite数据库,而在测试连接时VS冻结.

这就是我现在所处的位置.

Does anyone know how to get generate an entity framework model from a SQLite database using the latest System.Data.SQLite builds?

Doing this with the old builds is easy because they automatically integrate with Visual Studio, but their EF support was still a bit too buggy for me. That''s why I don''t use their EF components. Yet, I''m currently stuck using a SQLite database in a Win Forms application, and the data structure is complex enough to take forever for me to code up all reading/writing structures myself.

<Addition: May 21st, 2012>
I''ve done some additional experimentation on an Win XP SP3 virtual machine with VS 2010 Pro and found the following. After running the new System.Data.SQLite installer, I ran the installer for the design-time components that was placed in the bin directory.

* The first time I ran it, I got a pop-up telling that the Confirm option wasn''t enable so it failed.

* Then I ran it from the command line as: Installer -Confirm True

** This time it didn''t say anything about failing, but I did go over the command line to find that towards the end it said that no changes were made because the What If option enabled.

* This time I ran: Installer -Confirm True -WhatIf False

** This added System.Data.SQLite Database File as an option for my DataSources when creating a new database connection. Yet, when I select a database or created a new one to enter the Database Path, all pop-ups used for inserting the database connection close.

** I tried inserting the path do a SQLite database manually when creating a new connection, and VS froze when I tested connection.

That''s pretty much where I''m at with this right now.

推荐答案

只需安装X86捆绑软件.然后使用以下命令将安装程序标记为32位:

corflags/32BIT +/Force Installer.exe
(使用vs命令提示符)

之后,使用以下命令:
安装程序-confirm true -whatif false -install tr​​ue
Just install the X86 bundle. Then mark the installer as 32 bit with this command:

corflags /32BIT+ /Force Installer.exe
(use vs command prompt)

After that use this command:
installer -confirm true -whatif false -install true


SQLite提供程序应在VS(Visual Studio)中可用.您可以从SQLite.NET菜单(在Windows开始"菜单中)运行设计时配置"工具,以在VS中注册提供程序.

请注意,如果您使用的是Express版本的VS,则不能添加第三方ADO.NET提供程序.可以在将SQLite嵌入式数据库与Entity Framework和Linq-一起使用中获得Nice CodeProject文章.到SQL [ ^ ]
SQLite provider should be available in VS(Visual Studio). you can run the "Design-Time Configuration" tool from the SQLite.NET menu (in Windows Start menu) to register the provider with VS.

Note that if you''re using an Express version of VS, you can''t add third-party ADO.NET providers. Nice CodeProject article is available at Using SQLite Embedded Database with Entity Framework and Linq-to-SQL[^]


这篇关于使用新的System.Data.SQLite获取实体框架模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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