.NET 的非常輕量級的數據庫操作助手類:EasyDb.NET

jopen 10年前發布 | 21K 次閱讀 持久層框架 EasyDb.NET

EasyDb.NET 是一個 .NET 的非常輕量級的數據庫操作助手類。特性:

  • Easy. IDbConnection is extended by a new interface IConnection with enhanced query methods. Similar code, different experience. Helper methods may still be used to get rid of the repeating trivia such as opening and closing connections and make coding clean and simple.
  • Cross-database. EasyDb.NET works across all .NET ADO providers. Most times you don't need to concern details of DB specific differences since there is the hibernate-like dialecting.
  • Typed query. Query results can be mapped into strongly typed or dynamic objects. ORMs can also be customized with help of Mapping attributes.
  • Support OO-style Criterion query.
  • Other features from Dapper. EasyDb.NET is internally driven by Dapper, an amazing project by Sam Saffron.
  • Support .NET 2.0, 3.0, 3.5, 4.0.

用法:

IConnectionFactory factory;

// build factory with given DbProviderFactory and Dialect.
factory = ConnectionFactoryBuilder.NewBuilder(
  System.Data.SQLite.SQLiteFactory.Instance,
  "Data Source=test.db;Pooling=true;FailIfMissing=false",
  "SQLiteFactory",
  new SQLiteDialect()
).Build();

// or build from strings
factory = ConnectionFactoryBuilder.NewBuilder(
  "mysql.data",
  "Server=127.0.0.1;Uid=root;Pwd=asdf;Database=sample;",
  "MySQLFactory",
  "LX.EasyDb.Dialects.MySQLDialect"
).Build()

項目主頁:http://www.baiduhome.net/lib/view/home/1408699721897

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!