0

I have one table that has many fields like ID,Username,Password,Lang,Date,.. When I create Entity Data modeling so all the table field is generated. I want to generate only specific column like username and password only.

Kim Ramin
  • 23
  • 1
  • 7
  • You can use either `[NotMapped]` attribute or Fluent API see this question https://stackoverflow.com/questions/45898113/how-to-mark-class-properties-data-annotation-not-to-get-error-if-there-is-not – Salah Akbari Dec 08 '17 at 08:44
  • This is duplicate of https://stackoverflow.com/questions/737520/entity-framework-ignore-columns. – Nitesh Kumar Dec 08 '17 at 09:53

1 Answers1

1

When you generate from database it will generate model for all the columns initially, but you have the freedom to delete the columns that you don't want manually from the generated database EDMX diagram.

Just select the field you don't want and hit 'DEL' key.

Make sure that the fields you delete are nullable ones and also not primary key for that table.

Sunil
  • 3,404
  • 10
  • 23
  • 31