我刚开始创建EntityTypeConfiguration类并执行了以下操作
public class Xyz
{
public int PlaceId { get; set; }
public string Name { get; set; }
public DbGeography Location { get; set; }
public int HumanTypeId { get; set; }
public int AddressId { get; set; }
}
并且在EntityTypeConfiguration类中
public sealed class XyzConfiguration:EntityTypeConfiguration<Xyz>
{
public XyzConfiguration()
{
ToTable("Place", "dbo");
HasKey(p => p.PlaceId);
Property(p => p.PlaceId)
.HasColumnName("PlaceId")
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
Property(p => p.Name);
Property(p => p.Location). ;
Property(p => p.HumanTypeId);
Property(p => p.AddressId);
}
}
现在如何设置 DbGeography
和外键列 HumanTypeId、AddressId
?
提前致谢。
DbContext
配置实体和使用EntityTypeConfiguration
的区别? - Don Cheadle