Frameworks 实体框架5复杂类型未解析,因为类型是接口

Frameworks 实体框架5复杂类型未解析,因为类型是接口,frameworks,interface,entity,complextype,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 {

我有以下资料:

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; }
在我的上下文类中,我定义了以下内容:

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; }

当我转到数据库时,地址不是属性的一部分。有人有什么想法吗?

我将属性地址更改为一种类型,它可以工作。我非常希望每种类型都从接口派生。我同意。你读到的每一篇关于软件开发的有价值的文献都会谈到接口如何减少耦合和提高凝聚力,然后你会遇到实体框架。开发EF的人对实体有正确的想法。然而,2013年实体现在是使用接口定义的。