如何使用GraphDiff更新具有抽象类型集合的实体?

时间:2014-11-28 05:46:38

标签: c# entity-framework ef-code-first graphdiff

我有一些模特:

public class RootEntity
{
    public int Id {get; set;}

    public virtual ICollection<AbstractEntity> CollectionA {get; set;}
}

public abstract class AbstractEntity
{
    public int Id {get; set;}
}

public class DerivedEntityA : AbstractEntity
{
    public virtual ICollection<AnotherType> CollectionB {get; set;} 
}

public class DerivedEntityB : AbstractEntity
{
    public string Name {get; set;}
}

上述模型的关系如下:

 RootEntity ---> ICollection<AbstractEntity>
                                 ┗━━ DerivedEntityA ---> ICollection<AnotherType>
                                 ┗━━ DerivedEntityB
 --->    has a
┗━━  derived from

现在,我想使用GraphDiff更新名为RootEntity的{​​{1}}实体:

rootEntity

那我怎样才能正确更新呢?

0 个答案:

没有答案