Entity Framework: add property that don't map to database
Is it possible to add a property to an entity where the property is no开发者_运维知识库t supposed to map to the database?
You need to mark the property in the custom partial class to "[NotMapped]". Hope this helps.
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.
精彩评论