1:数据库的配置和连接 Web.config
<connectionStrings> <add name="SQLConnectionString" connectionString="server=18.8.8.8;database=Test;uid=sa;pwd=2018;MultipleActiveResultSets=true" providerName="System.Data.SqlClient" /> </connectionStrings>
2:EF框架下的方式 DefaultDbContext
public class DefaultDbContext : DbContext { public DefaultDbContext():base("SQLConnectionString") { } /// <summary> /// 交易订单信息 /// </summary> public DbSet<TRA_BargainOrder_Test> TRA_BargainOrders { get; set; } } 3:model 下的代码 public class TRA_BargainOrder_Test { public int ischeck { get; set; } public long TRA_BargainOrder_TestID { get; set; } /// <summary> /// 订单编号 /// </summary> public string BargainOrderCode { get; set; } /// <summary> /// 城市代号 /// </summary> public string CityCode { get; set; } public string ParkUserId { get; set; } public int FlowStatus { get; set; } public DateTime UpdateTime { get; set; } public int OrderStatus { get; set; } public int PayStatus { get; set; } public DateTime CreateTime { get; set; } public string ExpressCode { get; set; } } 4: EnumHelper.cs public class EnumHelper { public enum OrderStatus : int { UnSend = 0, Sended =1,//已发货 Cancel=2, Over = 3 } public enum PayStatus : int { UnPaid=0, Paid =1//已支付完成 } public enum FlowStatus : int { Cancel = 0, //已取消 Over = 1,//完成 } }