Entity framework 实体框架只插入一些列

Entity framework 实体框架只插入一些列,entity-framework,poco,Entity Framework,Poco,我有一节POCO课 public class Main { public int ExstraColumn{ get; set; } } public class User : Main { [Key] public int Id { get; set; } public int? Age { get; set; } } public class News : Main { [Key] public int Id { get; set; }

我有一节POCO课

public class Main
{
    public int ExstraColumn{ get; set; }
}
public class User : Main
{
    [Key]
    public int Id { get; set; }

    public int? Age { get; set; }


}

public class News : Main
{
    [Key]
    public int Id { get; set; }

    public int? ReadCount { get; set; }
}
现在我希望实体框架只在用户中插入年龄列。但它给出的列名ExstraColumn无效


如何告诉实体框架ExstraColumn字段只是特殊用途?

您可以在System.ComponentModel.DataAnnotations命名空间中使用
[NotMapped]
属性

表示应从数据库中排除属性或类 映射

定义特殊用法。。