如何告诉Entity Framework忽略复杂属性中的属性

时间:2016-10-07 14:06:37

标签: entity-framework ef-fluent-api

假设我有这三个类:

public class ClassA {
    public int ID { get; set; }
    public string Name { get; set; }
    public ClassC ClassC { get; set; }
}

public class ClassB {
    public int ID { get; set; }
    public string Name { get; set; }
    public ClassC ClassC { get; set; }
}

public class ClassC {
    public int Data1 { get; set; }
    public int Data2 { get; set; }
}

在我的数据库中,我有:

Table A
+------+--------+---------+
| A_ID | A_Name | A_Data1 |
+------+--------+---------+
|      |        |         |
+------+--------+---------+

Table B
+------+--------+---------+
| B_ID | B_Name | B_Data2 |
+------+--------+---------+
|      |        |         |
+------+--------+---------+

如何在映射ClassB时告诉Entity Framework(6.1.3)忽略Data1,在映射classA时忽略Data2?

0 个答案:

没有答案