【发布时间】:2013-03-15 16:27:48
【问题描述】:
这是我的实体:
[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; }
}
这是来自上下文的代码:
public DbSet<Meta> PdfMeta { get; set; }
为什么用 ImageUri、PdfUri ... 列创建了新表 (Metas)?我知道这是按惯例完成的,但我已经明确指定了表和列。
【问题讨论】:
-
你可能使用另外的流利配置?
-
是的,我使用带有 IDbContext 的通用存储库,...
-
有两个
ColumnAttribute确保你使用的是正确的:System.ComponentModel.DataAnnotations.Schema.ColumnAttribute
标签: c# entity-framework ef-code-first storing-data