相关疑难解决方法(0)

System.Data.SQLite 1.0.91.0和EF6.0.2

有没有人在Visual Studio 201#中使用新的System.Data.SQLite 1.0.91.0与Entity Framework 6一起工作?如果你有,你是怎么做到的?

更新 - 2014年3月20日:System.Data.SQLite 1.0.92.0已经发布但我没有在VS2013中创建EDMX的运气:(我最终使用包管理器(因为EF6.#.#是新SQLite中的依赖项) NuGet包):

uninstall-package entityframework -force
Run Code Online (Sandbox Code Playgroud)

重新启动VS2013并打开旧版EF5以获取VS2013以从现有数据库生成EDMX:

install-package entityframework -version 5.0.0
Run Code Online (Sandbox Code Playgroud)

注意:这不是一个复杂的多表SQLite关系数据库测试,所以如果我使用多个导航(FK)关系的任何东西,我不确定会出现什么其他问题:/

回答EDMX /模型的答案:(更新 - 2014年3月2日)我找到了解决办法,但它不够一致,需要太多步骤才能将其视为有效的解决方案.基本上:

  • 你制作所有的Class(es)文件,

  • 使用表建立与现有SQLite数据库的连接,

  • 修改web/app.config,如仍然出色的SQLite故障单(http://system.data.sqlite.org/index.html/tktview?name=7b8fd3ef77)中的mistachkin所述,包括伪造cdsl/.ssdl /.msl件,和

  • 然后在重建项目之前在Empty EDMX中手动创建Designer中的所有实体模型,然后......

  • 右键单击实体并选择"从数据库更新"...

有时EF/VS2013会添加.tt/DbContesxt,有时则不会.方式也'命中或错过':(

有和没有现有SQLite数据库的"Code First"的答案(基于PMCB,Drexter和Jimi的建议).但请注意,您无法在Visual Studio 2013中自动生成任何EF模型或EDMX文件[原文如此 - 概念架构定义语言(.CSDL),存储架构定义语言(.SSDL)和映射规范语言(.MSL)].我做了不要尝试手动创建EDMX文件以查看它们是否适合EF,即使我这样做,在我看来,做所有手动创建/映射/更改/ XML编辑都会破坏基于实体的框架的整个目的/概念...

<connectionStrings>
    <add name="DogsContext" connectionString="Data Source=|DataDirectory|\dogs.s3db;" providerName="System.Data.SQLite" />
</connectionStrings>
<entityFramework>
    <providers>
       <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.91.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
</entityFramework>
<system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.91.0, …
Run Code Online (Sandbox Code Playgroud)

c# sqlite entity-framework

42
推荐指数
4
解决办法
4万
查看次数

对于EF 6和SQLite 1.0.96.0,"找不到实体框架提供程序"

我知道在这个主题上已经有几个类似的问题了,但是其中很多都来自SQLite的旧版本,据我所知,它并没有完全支持EF 6.我已经尝试过这些线程的无数建议,要么是做错了,要么是必须改变的.

我正在使用VS 2013,面向.NET 4.5.1,并已从system.data.sqlite.org下载页面安装了sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe软件包,以及来自NuGet Manager的System.Data.SQLite EF6包(安装EF6).

下面是我当前的App.config文件(除了我尝试将Version,Culture和Public键变量添加到类型中之外,它几乎没有变化):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework …
Run Code Online (Sandbox Code Playgroud)

c# sqlite entity-framework entity-framework-6

41
推荐指数
3
解决办法
3万
查看次数

实体框架6不在SQLite数据库中创建表

我正在尝试让System.Data.SQLite与Entity Framework 6一起使用,使用我的C#.NET(4.5.2)WPF项目中的Code First方法.

我已经查看并尝试按照以下地方(以及其他地方)中的说明进行操作,但它们似乎已过时,对于不同的dbms,不是Code First,或上述的某些组合.

https://msdn.microsoft.com/en-us/data/jj592674

https://msdn.microsoft.com/en-us/data/jj592674.aspx

http://nullskull.com/a/10476742/sqlite-in-wpf-with-entity-framework-6.aspx

实体框架6 + SQLite

我想我终于正确设置了我的App.config文件,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <entityFramework>
    <!-- from: https://stackoverflow.com/questions/14510096/entity-framework-6-sqlite -->
    <providers>
        <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> 
        <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
     </defaultConnectionFactory>
  </entityFramework>
  <connectionStrings>
    <add name="MyDatabase" …
Run Code Online (Sandbox Code Playgroud)

c# sqlite wpf ef-code-first entity-framework-6

7
推荐指数
1
解决办法
5944
查看次数