I am working on database table which has a column name with a space in it, for example \"Level Description\".
I cannot change the column name. Now I have an Entity F
You don't have to have your model property names exactly matching your table column names; there is a [Column]
attribute you can apply to map a property to the column:
[Table("StudyLevel")]
public class StudyLevelModel
{
[Key]
public byte StudyLevelID { get; set; }
[Column("Level Description")]
public string LevelDescription { get; set; }
public string SLevelType { get; set; }
public Nullable<bool> IsActive { get; set; }
public string ESID { get; set; }
public string RID { get; set; }
public byte LevelSearchGroup { get; set; }
}
Use the ColumnAttribute to set the name:
[Column(Name="Level Description")]
public string LevelDescription { get; set; }