ActiveRecordBase.FindAll(TargetType As System.Type,Orders() As NHibernate.Expression.Order,ParamArray criterias() As NHibernate.Expression.ICriteriion)
可以方便的使用NHibernate的条件查询,例如
Public Shared Function FindByModuleID(ByVal ModuleID As Integer) As Portal_HtmlText()
Return CType(ActiveRecordBase.FindAll(GetType(Portal_HtmlText), Expression.Eq("ModuleID", ModuleID)), Portal_HtmlText())
End Function
Return CType(ActiveRecordBase.FindAll(GetType(Portal_HtmlText), Expression.Eq("ModuleID", ModuleID)), Portal_HtmlText())
End Function
public static Blog[] FindByAuthor(String author)
{
return (Blog[]) FindAll(typeof(Blog), new Order[] { Order.Asc("Id") }, Expression.Eq("Author", author));
}
{
return (Blog[]) FindAll(typeof(Blog), new Order[] { Order.Asc("Id") }, Expression.Eq("Author", author));
}
当然别忘了添加对NHibernate程序集的引用。