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
的表,它有许多列:
- 身份证
- 名字
- 价格
- 大小
- 颜色
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(“价格”);
}
}
如何从映射类中排除数据库列 你能添加你想要的输出吗?!只需从类中删除属性。