实体框架5复杂类型无法解析,因为类型是一个接口

时间:2012-12-07 20:37:56

标签: frameworks interface entity complextype

我有以下内容:

public interface IPerson
{
  string Name {get; set;}
   ... more attributes ...
  IAddress Address {get; set;}
}

public interface IAddress
{
  string Street {get; set;}
   ... more ...
}

public class Person: IPerson
{
  public string Name {get; set;}
   ... more attributes ...
  IAddress Address {get; set;}
}

public class Address: IAddress
{
  public string Street {get; set;}
   ... more ...
}

在我的上下文类中我定义了以下内容:

public DbSet<Property> Properties { get; set; }

在我所拥有的相同上下文文件的OnModelCreating

modelBuilder.Configurations.Add(new PropertyMap());
modelBuilder.ComplexType<Address>();

当我去数据库时,地址不属于Property。有人有什么想法吗?

0 个答案:

没有答案