zoukankan      html  css  js  c++  java
  • EF SQLite

    1.通过NuGet添加程序集的相关引用

      Install-Package System.Data.SQLite

    2.安装类似SQL的插件

      地址:http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

      注意:1.现在支持VS2013的名字:sqlite-netFx451-setup-bundle-x86-2013-1.0.101.0.exe ,需要下载bundle的文件,支持VS插件,2013代表支持VS2013,下载页会有相关的其他的下载链接以及支持的VS版本

    3.配置文件添加

      配置文件添加

      <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.57.0,         Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
          </DbProviderFactories>
       </system.data>

    4.完整的配置文件,仅参考

      

    <?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" /></startup>
    
    
      <connectionStrings>
        <add name="TestDataBase" providerName="System.Data.SQLite.EF6" connectionString="Data Source=c:mydb.db;Password=admin;" />
        <add name="test" providerName="System.Data.SQLite.EF6" connectionString="Data Source=F:CodeLibrary	est.db;Password=19890625;" />
      <add name="testEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=F:CodeLibrary	est.db;password=19890625&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
      
      <system.data>
        
        <DbProviderFactories>
          <remove invariant="System.Data.SQLite.EF6" />
          <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
          <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" />
        </DbProviderFactories>
        
      </system.data>
      
      <entityFramework>
        
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        
        <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" />
        </providers>
        
      </entityFramework>
      
    </configuration>

      

  • 相关阅读:
    shell脚本批量检查网站是否正常
    测试运维-linux中常用的操作命令以及工作思路
    软件自动化测试工程师面试题集锦(2)
    UI自动化测试常用操作函数(3)
    软件自动化测试工程师面试题集锦(1)
    UI自动化测试常用操作函数(2)
    UI自动化测试常用操作函数(1)
    滑屏找元素
    代码报错解析
    心情20.4.6
  • 原文地址:https://www.cnblogs.com/yanlovehan/p/5435234.html
Copyright © 2011-2022 走看看