0

Using EF 5.0 (aka 4.3) I transformed one of my pocos (which I got from reverse engeniring my database), to be a partial class in order to extend it with a computed propertry wich is not relevant in my DB but is in my application.

Though, when I'm querying the poco via the DBContext,

var Categories = context.CATEGORY.ToList();

It throw an System.Data.SqlClient.SqlException saying : "Invalid column name 'Computed_property'.". Because of course 'Computed_property' doesn't exist in the db.

So I was wondering, is there a hint or an attribute that could be used on the property to avoid this problem ? Something like

[IgnorePropertyInDB]

Thx for your help.

Antoine Meltzheim
  • 9,579
  • 6
  • 35
  • 41

1 Answers1

1

Yes there is [NotMapped] attribute for this purpose.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670