Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updated to EF5 now NotMapped annotation doesn't work

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?

like image 371
starcorn Avatar asked Aug 30 '12 09:08

starcorn


2 Answers

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

like image 115
Ladislav Mrnka Avatar answered Nov 19 '22 05:11

Ladislav Mrnka


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

like image 3
Developer Marius Žilėnas Avatar answered Nov 19 '22 05:11

Developer Marius Žilėnas