Tag: mapping

如何在每个层次结构(TPH)映射中共享公用列名称

我正在使用Entity Framework 4 CTP5代码第一种方法,我有一个每层次表(TPH)映射。 层次结构中的某些类具有共同的属性。 public class BaseType { public int Id { get; set; } } public class A : BaseType { public string Customer { get; set; } public string Order { get; set; } } public class B : BaseType { public string Customer { get; set; } public string Article { […]

没有声明外键的导航属性

我的所有模型都包含至少两个关联。 在ef4中对此进行建模时,我只能通过使用流畅的界面在没有第二个外键属性的情况下执行此操作。 ForeignKey似乎是正确使用的属性,除了它需要一个字符串参数。 所以我的问题是,你能拥有一个导航属性并使用属性声明它吗? public class User : IAuditable { // other code public virtual User Creator { get; set; } public virtual User Modifier { get; set; } }