Updated to EF5 now NotMapped annotation doesn'

2019-04-18 10:23发布

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?

2条回答
Rolldiameter
2楼-- · 2019-04-18 11:04

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

查看更多
唯我独甜
3楼-- · 2019-04-18 11:16

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

查看更多
登录 后发表回答