Simple.Data 使用中的问题

1、未能正确加载程序集 System.Data.SQLite.Core.1.0.91.0。

使用nuget安装Simple.Data ,默认是安装的System.Data.SQLite.Core.1.0.99.0版本,版本不一样,手动使用

PM> Update-Package System.Data.SQLite.Core -Version 1.0.91.0

强制改为91版本。

下载sqlite-netFx40-setup-bundle-x86-2010-1.0.91.0然后出现目录下有个test.exe工具,还是比较好用的。

 

使用ildasm查看Simple.Data.Sqlite.dll,显示其加载的是System.Data.SQLite.Core.1.0.91.0版本

 ----

貌似版本问题还是没解决

最后,我去下载了Simple.Data.Sqlite.0.18.3.1.nupkg 包,然后在本地进行安装,就ok了

 大致步骤:下载nupkg包,vs上添加本地源,打开“管理解决方案的nuget包”,选择本地源 安装。

 

2、SQLite数据库连接字符串Data Source=test.db;Pooling=true;FailIfMissing=false

<add name="Simple.Data.Properties.Settings.DefaultConnectionString"
connectionString="Data Source=|DataDirectory|\2016.db;Pooling=true;FailIfMissing=false" providerName="System.Data.SQLite" />

3、批量插入数据慢(sqllite数据库)

使用事务

using (var transaction = db.BeginTransaction())
{
   transaction.Users.Insert(Name: "张三", Age: 20);
   transaction.Commit();
}

参见:http://www.cnblogs.com/hj4444/p/3978384.html 

批量插入:可以用这种:

先查询出question数据,再直接: transaction.Question.Insert(questions);

 

使用simple.data连接oracle数据库的过程和遇到的问题

http://www.aichengxu.com/other/4357027.htm

 

4、使用simple.data连接mysql数据库,首次很慢

现象:首次建立连接大概要3、4秒钟

原因:数据库连接字符串设置错误,修改成如下参数:

PublicClass.G_conn = "Server=localhost;Database=aFriendDb; User=root;Password=;Use Procedure Bodies=false;Charset=utf8;Allow Zero Datetime=True; ";

删除了Pooling:    是否使用线程池,默认 true,采用默认值

参考:http://blog.csdn.net/config_man/article/details/8254986

 

posted @ 2016-01-26 09:17  扬中源  阅读(497)  评论(0编辑  收藏  举报