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 = ,
Sended =,//已发货
Cancel=,
Over =
}
public enum PayStatus : int
{
UnPaid=,
Paid =//已支付完成 }
public enum FlowStatus : int
{
Cancel = , //已取消
Over = ,//完成
}
}