正常编写实体类
/// <summary> /// 产品信息 /// </summary> public class HTE_ProductsSOD:EntityBase { public HTE_ProductsSOD() { TableName = "HTE_Products"; //Schema = ""; EntityMap = EntityMapType.Table; PrimaryKeys.Add("id"); } protected override void SetFieldNames() { PropertyNames = new string[] { "spec", "weight", "product_id","width","real_price","brand_name", "id","productSn","amount","enName","height","cnName","productcategory_name","longth", "sale_price","currency","price_time","num"}; } /// <summary> /// 规格-- /// </summary> public string spec { get { return getProperty<System.String>("spec"); } set { setProperty("spec", value); } } /// <summary> /// 重量 /// </summary> public decimal weight { get { return getProperty<System.Decimal>("weight"); } set { setProperty("weight", value); } } /// <summary> /// 产品id /// </summary> public string product_id { get { return getProperty<System.String>("product_id"); } set { setProperty("product_id", value); } } public decimal width { get { return getProperty<System.Decimal>("width"); } set { setProperty("width", value); } } public decimal real_price { get { return getProperty<System.Decimal>("real_price"); } set { setProperty("CategoryId", value); } } /// <summary> /// 品牌名称 /// </summary> public string brand_name { get { return getProperty<System.String>("brand_name"); } set { setProperty("brand_name", value); } } /// <summary> /// 对方的唯一标示 /// </summary> public string id { get { return getProperty<System.String>("id"); } set { setProperty("id", value); } } /// <summary> /// 规格--下单的sku /// </summary> public string productSn { get { return getProperty<System.String>("productSn"); } set { setProperty("productSn", value); } } /// <summary> /// 库存数量 /// </summary> public int amount { get { return getProperty<System.Int32>("amount"); } set { setProperty("amount", value); } } /// <summary> /// 英文名称 /// </summary> public string enName { get { return getProperty<System.String>("enName"); } set { setProperty("enName", value); }} public decimal height { get { return getProperty<System.Decimal>("height"); } set { setProperty("height", value); }} /// <summary> /// 中文名称 /// </summary> public string cnName { get { return getProperty<System.String>("cnName"); } set { setProperty("cnName", value); }} /// <summary> /// 分类名称 /// </summary> public string productcategory_name { get { return getProperty<System.String>("productcategory_name"); } set { setProperty("productcategory_name", value); }} /// <summary> /// 长度 /// </summary> public decimal longth { get { return getProperty<System.Decimal>("longth"); } set { setProperty("longth", value); } } /// <summary> /// 销售价 /// </summary> public decimal sale_price { get { return getProperty<System.Decimal>("sale_price"); } set { setProperty("sale_price", value); } } /// <summary> /// 货币 /// </summary> public string currency { get { return getProperty<System.String>("currency"); } set { setProperty("currency", value); } } /// <summary> /// 价格时间 /// </summary> public string price_time { get { return getProperty<System.String>("price_time"); } set { setProperty("price_time", value); } } /// <summary> /// 存在几个sku /// </summary> public int num { get { return getProperty<System.Int32>("num"); } set { setProperty("num", value); } } }
dbcontext
public class MydbContext:DbContext { public MydbContext() : base("SqlServer") { // } protected override bool CheckAllTableExists() { CheckTableExists<HTE_ProductsSOD>(); return true; } }
然后利用DbContext 进行创建表 提示值为空 原因是没有下载源码。
解决方案
40
本人是来要分的,oldman就是本人,本人就是好男人