Entity annotation attributes do not work
c#, ef-code-first, entity-framework, storing-data
Solution
`Name` property of `ColumnAttribute` has only getter defined. Pass column name in constructor instead:
[Table("PdfMeta")]
public class Meta
{
[Key]
public int Id { get; set; }
[Column("TotalPages")]
public int TotalPages { get; set; }
[Column("PdfPath")]
public string PdfUri { get; set; }
[Column("ImagePath")]
public string ImageUri { get; set; }
[Column("SplittedPdfPath")]
public string SplittedFolderUri { get; set; }
}
BTW `ColumnAttribute` defined in EntityFramework.dll. Looks like you have referenced `ColumnAttribute` from System.Data.Linq.dll
Problem
Here is my entity: ``` [Table( Name = "PdfMeta" )] public class Meta { [Key()] public int Id { get; set; } [Column(Name = "TotalPages")] public int TotalPages { get; set; } [Column(Name = "PdfPath")] public string PdfUri { get; set; } [Column(Name = "ImagePath")] public string ImageUri { get; set; } [Column(Name = "SplittedPdfPath")] public string SplittedFolderUri { get; set; } } ``` Here is code from context: ``` public DbSet<Meta> PdfMeta { get; set; } ``` Why new table (Metas) has created with ImageUri, PdfUri ... columns? I know that this was done by convention but I have explisitly specifyed table and columns.