I have upgraded from EF 4.3.1 to 6.1.1 and now it seems like the annotation [NotMapped] is useless. Yes, i have change to correct assembly and everything looks fine on compilation.
Everywhere where [NotMapped] is present the property is handled as a domain property and i get an error that EF can't find the matching column in database.
Example:
private bool _authenticated = true;
[NotMapped]
public bool Authenticated
{
get { return _authenticated; }
set { _authenticated = value; }
}
Yes, it seems like i can work around this by adding...
modelBuilder.Entity<User>().Ignore(x => x.Authenticated);
...but then, whats the use of [NotMapped] in EF6?
(Worked perfect before upgrade)
Solved by first uninstall and then reinstalling EF on all projects in the solution.
I think it was some mismatch in .NET versions for some projects when i upgraded to EF6 the first time which made the system take the [NotMapped] annotaition from the wrong assembly (.NET instead of EF).
This led me to it: http://social.msdn.microsoft.com/Forums/en-US/2d682be0-daca-45c4-ad76-5885acc6004f/possible-bug-with-inheritance-and-notmapped?forum=adodotnetentityframework
...and most the line: "If you use the new annotations from the System.ComponentModel.DataAnnotations.dll assembly in .NET 4.5 they will not be processed by Code First."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With