EF5: Where are my DataAnnotations?

EF 4.x:

EF 4.1+ has a DataAnnotations namespace for the new EF related annotations. Most of them are related to database schema.

image

EF 5

Not even a DataAnnotations namespace in here. That's because the annotations got incorporated into .NET 4.5.

image

 

.NET 4.5

A new namespace within System.ComponentModel.DataAnnotations: "Schema"

All of the EF schema annotations are in here now. MaxLength and MinLength are in the DataAnnotations namespace.

image

Added the following thanks to a suggestion from Cecil Phillip

If you are using EF5 with .NET 4, there is a special version of the Entity Framework assembly which actually has the version 4.4.*.

The EF related DataAnnotations *are* in this assembly but notice they've been organized into regular and schema as they are in  .NET 4.5.

image

 •  0 comments  •  flag
Share on Twitter
Published on April 03, 2012 06:29
No comments have been added yet.


Julia Lerman's Blog

Julia Lerman
Julia Lerman isn't a Goodreads Author (yet), but they do have a blog, so here are some recent posts imported from their feed.
Follow Julia Lerman's blog with rss.