下面是一些简单例程代码:
订单销售金额统计基础视图对象
/// <summary
/// 建立一个简单的订单销售金额统计类
/// </summary
[TableMap("", TableType.View)]
public class OrderStat:HFSoft.Data.ITableView
{
#region ITableView 成员
public virtual Table GetTable()
{
// TODO: 添加OrderV.GetTable 实现
return DBMapping.Orders.INNER(DBMapping.Employees, DBMapping.Employees.EmployeeID)& DBMapping.Orders.INNER(DBMapping.OrderDetails, DBMapping.Orders.OrderID)& DBMapping.OrderDetails.INNER(DBMapping.Products, DBMapping.Products.ProductID);
}
private Double mTotalize;
[StatColumn("Quantity*[Order Details].UnitPrice*(1-Discount)", StatType.Sum)]
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/sqlserver/)public Double Totalize
{
get
{
return mTotalize;
}
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/sqlserver/)set
{
mTotalize = value;
}
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/sqlserver/)}
#endregion
}
按雇员分组统计情况继承实现
/// <summary
/// 按雇员进行分组统计
/// </summary
[TableMap("", TableType.View)]
public class EmployeeTotal:OrderStat
{
private int mEmployeeID;
[ViewColumn("Employees.EmployeeID")]
public int EmployeeID
{
get
{
return mEmployeeID;
}
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/sqlserver/)set
{
mEmployeeID = value;
}
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/sqlserver/)}
private str