Updated to EF5 now NotMapped annotation doesn't work

给你一囗甜甜゛ 提交于 2019-12-12 09:30:01

问题


I just updated the entityframework to the latest 5.0.0 version. And the NotMapped annotation doesn't work now. I tried to google for an answer to fix it but couldn't find. Anyone had the same problem when you updated the entityframework and know a solution to fix this problem?


回答1:


Annotation attributes in EF 5.0 with .NET 4.5 were moved to System.ComponentModel.DataAnnotations assembly and System.ComponentModel.DataAnnotations.Schema namespace.




回答2:


[NotMapped] is in System.ComponentModel.DataAnnotations.Schema. Make sure to add using System.ComponentModel.DataAnnotations.Schema; to your code.



来源:https://stackoverflow.com/questions/12194267/updated-to-ef5-now-notmapped-annotation-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!