NHibernate &の代わりに、SubSonicをご覧ください。これはActiveRecordも使用しますが、NHibernateよりもスイスアーミーナイフです。
EDIT:
Simple Select with string columns
int records = new Select("productID").
From("Products").GetRecordCount();
Assert.IsTrue(records == 77);
Simple Select with typed columns
int records = new Select(Product.ProductIDColumn, Product.ProductNameColumn).
From<Product>().GetRecordCount();
Assert.IsTrue(records == 77);
そして、いくつかの更なるexamples:
Standard Deviation
const double expected = 42.7698669325723;
// overload #1
double result = new
Select(Aggregate.StandardDeviation("UnitPrice"))
.From(Product.Schema)
.ExecuteScalar<double>();
Assert.AreEqual(expected, result);
// overload #2
result = new
Select(Aggregate.StandardDeviation(Product.UnitPriceColumn))
.From(Product.Schema)
.ExecuteScalar<double>();
Assert.AreEqual(expected, result);
// overload #3
result = new
Select(Aggregate.StandardDeviation("UnitPrice", "CheapestProduct"))
.From(Product.Schema)
.ExecuteScalar<double>();
Assert.AreEqual(expected, result);
// overload #4
result = new
Select(Aggregate.StandardDeviation(Product.UnitPriceColumn, "CheapestProduct"))
.From(Product.Schema)
.ExecuteScalar<double>();
Assert.AreEqual(expected, result);
そして、いくつかのWildcard methods:
[Test]
public void Select_Using_StartsWith_C_ShouldReturn_9_Records() {
int records = new Select().From<Product>()
.Where(Northwind.Product.ProductNameColumn).StartsWith("c")
.GetRecordCount();
Assert.AreEqual(9, records);
}
ここ
は亜音速のドキュメントからsampleです