Reputation: 97
Is it possible to add a property to an entity where the property is not supposed to map to the database?
Upvotes: 5
Views: 7824
Reputation: 701
You need to mark the property in the custom partial class to "[NotMapped]". Hope this helps.
Upvotes: 15
Reputation: 126547
Possible? Sure; add it to a custom partial class matching your entity type. Useful? Less so; you (mostly) can't use them in LINQ to Entities queries, and you shouldn't re-purpose your entities as view models.
Upvotes: -2