惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LangChain Blog
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
Microsoft Azure Blog
Microsoft Azure Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
Y
Y Combinator Blog
D
DataBreaches.Net
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements

博客园 - Cavingdeep

用metaclass实现AOP风格的Profiler Singleton implementation using metaclass 初试IronPython与.NET的集成 Refactoring as a way to improve the existing design 用metaclass来实现AOP 不该用Generics实现Abstract Factory的理由 新兴XML处理方法VTD-XML介绍 Performance Tips I DCG 2.0.72 (Beta1) 发布了 NUnit发布2.2.3兼容.NET 2.0 RTM 如果你想拥有一个可嵌入式模板引擎…… 改进ASP语法打造更高效的模板语言II 改进ASP语法打造更高效的模板语言 XML的特征以及一些用途 深入XML系列技术 DbHelper at Tigris SQLite系列 集合的初始容量与性能 DbHelper basic usage
Release of DbHelper 1.2.1
Cavingdeep · 2005-11-03 · via 博客园 - Cavingdeep

DbHelper增加了两个Build方法分别构建IDbCommand与IDataParameter,同时增加了接受IDbCommand的接 口,这样做是为了在需要重复执行某个Command时不需要每次都重新构建Command浪费效率,现在可以用Build方法先构建出Command对 象,然后在循环中执行这个command,如下示例。

 1IDbHelper helper = new SqliteHelper(this.connection);
 2
 3IDbCommand insertCommand = helper.BuildCommand(
 4   "INSERT INTO Test VALUES(NULL, @num, @r_date, @data)",
 5   1, DateTime.Now, new byte[0]);
 6
 7SQLiteConnection con = new SQLiteConnection();
 8con.ConnectionString = this.connection.ConnectionString;
 9
10con.Open();
11
12IDbTransaction transaction = con.BeginTransaction(
13   IsolationLevel.ReadUncommitted);
14insertCommand.Transaction = transaction;
15
16try {
17   for (int i = 0; i < 100; i++{
18      helper.ExecuteCommand(insertCommand, i + 1, DateTime.Now, null);
19   }

20   transaction.Commit();
21}
 catch {
22   transaction.Rollback();
23}
 finally {
24   con.Close();
25}

26

关于DbHelper,请参看:

http://cavingdeep.cnblogs.com/category/37490.html

下载及Announcements

http://dbhelper.tigris.org