.NET 的非常轻量级的数据库操作助手类:EasyDb.NET

jopen 10年前

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.open-open.com/lib/view/home/1408699721897