1、sqlserver中nvarchar(50),对应EF中:
[MaxLength(50, ErrorMessage = "最大长度为{1}")]
public string Name { get; set; }
2、sqlserver中char(10),对应EF中:
[MaxLength(10)]
[Column(TypeName = "CHAR")]
public string Name { get; set; }
3、sqlserver中smallint,对应EF中:
public short ID { set; get; }
4、sqlserver中tinyint,对应EF中:
public byte IsDelete { get; set; }
5、sqlserver中text,对应EF中:
[Column(TypeName = "text")]
public string Content { set; get; }
6、sqlserver中Date(sqlserver2008版本以上才有),对应EF中:7.
[Column(TypeName = "Date")]
public DateTime Birthday{ get; set; }
7 组合主键
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//视图指定map
modelBuilder.Configurations.Add(new Models.MYMapping.VInvoiceMap());
//组合主键
modelBuilder.Entity<Models.MY.CurrArg>().HasKey(c => new { c.UserGUID, c.ObjType });
}