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
  • 704,970
  • 168
  • 1,303
  • 1,425
barteloma
  • 5,868
  • 11
  • 65
  • 150

0 Answers0