3

I have a table in database named product and it has many columns:

  • Id
  • Name
  • Price
  • Size
  • Color
  • ....
  • ..

I want to create a class to represent this table only 3 columns. And I will map like this.

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");
    }
}

How can I exclude database columns from mapping class?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
barteloma
  • 6,403
  • 14
  • 79
  • 173

0 Answers0