12

Closed

Power tools : Data annotations for reverse engineering instead of fluent

description

In many applications, having the classes generated use Data Annotations instead of the Fluent mapping is more desirable. There are blog posts on how to customize the tt files to do this for some things, but not all...For example, Key, Foreign Key, Required, MaxLength and relationships. Please make this an option.
Closed Feb 13 at 2:52 AM by jemartti
Fixed as part of OneEF.

comments

RoMiller wrote Sep 18, 2012 at 5:57 PM

Our plan is to provide code generation templates for Fluent API and Data Annotations and have a dropdown that allows you to pick which one you want.

RoMiller wrote Sep 25, 2012 at 6:56 PM

When we merge the Power Tools and EF Designer we should look at making Data Annotations the default.

Robar wrote Jul 10, 2013 at 11:32 AM

Are there any updates on this issue? I'm currently creating the data annotations on my own, but this is quite cumbersome if there are many tables with a bunch of relationships.

jmanning wrote Aug 27, 2013 at 9:01 PM

While the templates miss some cases currently, you can try some of the template sets in this repo: https://github.com/jamesmanning/EFReverseEngineerCodeFirstTemplates

Also, a promising project (also available as VS extension) in terms of replacing this (which, IMHO, might be nice for the EF team to help out with?) is the separate reverse engineer project @ https://efreversepoco.codeplex.com/

RoMiller wrote Dec 12, 2013 at 10:17 PM

We are doing this as part of the 'Tooling Consolidation' in 6.1

AndreZiegler wrote Dec 13, 2013 at 6:32 AM

Don't use annotations, Fluent API is much better :( :'(

paully21 wrote Dec 13, 2013 at 4:46 PM

Thanks Rowan!

BriceLambson wrote Dec 26, 2013 at 8:13 PM

Fixed in my private repo.