Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 实体框架映射排除数据库表列_C#_Sql Server_Entity Framework_Entity Framework 4 - Fatal编程技术网

C# 实体框架映射排除数据库表列

C# 实体框架映射排除数据库表列,c#,sql-server,entity-framework,entity-framework-4,C#,Sql Server,Entity Framework,Entity Framework 4,我在数据库中有一个名为product的表,它有许多列: 身份证 名字 价格 大小 颜色 我想创建一个类,只表示这个表的3列。我会像这样绘制地图 public class ProductConfiguration : EntityTypeConfiguration<Product> { public ProductConfiguration() { ToTable("product"); Property(p => p.P

我在数据库中有一个名为
product
的表,它有许多列:

  • 身份证
  • 名字
  • 价格
  • 大小
  • 颜色
我想创建一个类,只表示这个表的3列。我会像这样绘制地图

public class ProductConfiguration : EntityTypeConfiguration<Product>
{
    public ProductConfiguration()
    {
        ToTable("product");

        Property(p => p.ProductId).HasColumnName("id");
        Property(p => p.Name).HasColumnName("name");
        Property(p => p.Price).HasColumnName("price");
    }
}
公共类ProductConfiguration:EntityTypeConfiguration
{
公共产品配置()
{
ToTable(“产品”);
属性(p=>p.ProductId);
属性(p=>p.Name);
房地产(p=>p.Price).HasColumnName(“价格”);
}
}

如何从映射类中排除数据库列

你能添加你想要的输出吗?!只需从类中删除属性。