当我运行实体框架分析器时,我会丢失列类型不匹配错误,这显然会影响性能 http://hibernatingrhinos.com/products/EFProf/learn/alert/ColumnTypeMismatch
所以我尝试使用属性将我的实体与数据库匹配,但我仍然收到警告。
[Key, Required, Column(TypeName = "nvarchar"), StringLength(25)]
public virtual string UserLoginName { get; set; }
[Column(TypeName = "nvarchar"), StringLength(50)]
public virtual string FirstName { get; set; }
[Column(TypeName = "nvarchar"), StringLength(50)]
public virtual string LastName { get; set; }
[Column("UserType", TypeName = "int")]
public virtual CompanyType? CompanyType { get; set; } // this is a ENUM nut maps to a int is this correct to map to int?
public virtual ICollection<Permits> Permits { get; set; } // navigation property so no attributes?
[Column(TypeName = "DateTime2")]
public virtual DateTime? DOB{ get; set; } // is it correct to map datetime to Datetime2?
[Column(TypeName = "nvarchar(MAX)")]
public virtual string Notes { get; set; }