开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜