日期:2014-05-17 浏览次数:20793 次
public class tblProduct
{
public int ProductID { get; set; }
public static string ProductID
{
get { return "tblProduct.ProductID"; }
}
public string ProductName { get; set; }
public static string ProductName
{
get { return "tblProduct.ProductName"; }
}
}
tblProduct p = GetAProduct() ?? new tblProduct() { ProductID = "tblProduct.ProductID", ProductName = "tblProduct.ProductName" };相当于
if (p == null)
{
p = new tblProduct();
p.ProductID = "tblProduct.ProductID";
p.ProductName = "tblProduct.ProductName";
}
tblProduct t1 = new tblProduct(){ProductName = "t1"};
tblProduct t2 = new tblProduct(){ProductName = "t2"};
string name = tblProduct.ProductName; // t1 or t2 ?
class daoContext<T>
{
public static T getModel(T pototype)
{
PopulateDBTo(prototype);
return prototype;
}
}
tblUser user = daoContext.getModel(new tblUser(){UserID = 100} );