Sqlite EF6注册

在EF6使用Sqlite的时候。Sqlite需要安装sqlite-netFx40-setup-bundle-x64-2010-1.0.97.0.exe。我不想在项目发布的时候,安装的时候执行该程序,于是看到了打包过程中,Sqlite安装程序实际是执行的注册,于是分析了执行的命令提示界面。发现只对三个dll使用C:\Windows\Microsoft.NET\Framework\v4.0.30319\Ngen.exe 执行注册。

于是使用C#程序执行注册即可。

            Console.WriteLine("正在添加注册表项...");            RegistryKey key = Registry.LocalMachine;            RegistryKey software = key.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx");                   //注册EF
            string executeFile = @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Ngen.exe";
            string[] dllNames = new string[]{
                @"System.Data.SQLite.Linq.dll" ,//1
                @"System.Data.SQLite.EF6.dll",//2
                @"System.Data.SQLite.dll"
            };
            //执行注册
            for (int i = 0; i < dllNames.Length; i++)
            {
                //构建注册语句
                string installCommand = string.Format("{0} {1}{2}{3}", "install", (char)34, dllNames[i],(char)34);
                Process installProcess = Process.Start(executeFile, installCommand);

                Console.WriteLine("正在注册{0},请等待...", dllNames[i]);
                installProcess.WaitForExit();
            }

下载地址

时间: 2024-08-17 03:28:47

Sqlite EF6注册的相关文章

sqlite ef6

参考文章: http://www.cnblogs.com/adswads/p/3808549.html 用NUGET 引用 System.Data.SQLite.EF6  app.config 会有默认配置   其中有部分不对.不知道为什么 错误的Config 绿色不需要的虽然本身就是错的. invariantName是SQLite type后面用了SqlProviderServices 正确的应该是SQLiteProviderServices <providers> <!--<p

sqlite ef6 踩坑

调试的时候配置写如下,这样写是没有问题的但是在实际环境中有问题,因为EF路径找不到.会提示错误:The underlying provider failed on open <connectionStrings> <add name="SqlliteEF6" connectionString="data source=rtx.db" providerName="System.Data.SQLite" /> </con

EF6 Code First 完美支持Sqlite

要想EF6 Code First 模式支持Sqlite 得有一下几步: 一.需要安装 sqlite-netFx451-setup-bundle-x86-2013-1.0.92.0.exe 来让VS添加Ado.net 时有sqlite可选 1) 自己去 http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki 下载对应.net 版本的安装文件(*注意下载文件名带bundle,这个才会对vs进行插件支持) 2)安装 要

net 4.0+EF6+Sqlite 使用,安装,打包

开发 1.因为EF不支持Codefirst,开始可以使用SQL来进行开发. 部署安装 2.然后可以找到SQL转Sqlite工具(http://www.cnblogs.com/walkingp/archive/2010/04/08/1707834.html) 3.到这里(http://www.cnblogs.com/Gyoung/p/4023275.html)下载一个事例程序.按照事例重新构建自己的程序. 4.到sqlite官网下载安装程序,我下载的是 "sqlite-netFx40-setup-

EF6不支持sqlite Code First解决方案

最近需要项目中需要用到sqlite,项目中其他的功能都是EF+sqlserver实现的数据访问.于是,想用EF来访问sqlite,两个比较麻烦的地方. 第一:EF连接sqlite配置文件需要手动改一下 <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <

Visual Studio 2015使用EF6的CodeFirstFromDB模式操作Sqlite数据库时Provider问题

什么是CodeFristFromDB 问题:查询数据是遇到 “/”应用程序中的服务器错误. No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SQLite'. Make sure the provider is registered in the 'entityFramework' section of the application config file.

EF6 在 SQLite中使用备忘

== 菜鸟级选手试验在EF6中使用Sqlite,零EF基础,少量Sqlite基础.经过断断续续的很长时间 - _ -! >>连接 1. 安装 使用目前最新版本EF6.1,Sqlite1.0.93.0.直接NuGet安装: 2. 配置 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 <?xml version="1.0" encoding=&qu

让EF飞一会儿:如何用Entity Framework 6 连接Sqlite数据库

小分享:我有几张阿里云优惠券,用券购买或者升级阿里云相应产品最多可以优惠五折!领券地址:https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=ohmepe03 获取Sqlite 1.可以用NuGet程序包来获取,它也会自动下载EF6 2.在Sqlite官网上下载对应的版本:http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.

未找到具有固定名称&ldquo;System.Data.SQLite&rdquo;的 ADO.NET 提供程序的实体框架提供程序

用户代码未处理 System.InvalidOperationException   HResult=-2146233079   Message=未找到具有固定名称"System.Data.SQLite"的 ADO.NET 提供程序的实体框架提供程序.请确保在应用程序配置文件的"entityFramework"节中注册了该提供程序.有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260882.   Source=E