views:

21

answers:

1

I want to generate Entity Framework 4.0 classes from a (legacy) database from a command line, but I have 2 transformations I want:

  1. Tables/columns are lowerCamelCase and I want my classes/members to be UpperCamelCase.
  2. I want to suffix my classes with "Dto".

Any idea how this might be accomplished? I'm a total newbie to EF, but I have a decent understanding of Linq to Sql and was able to accomplish the same task by doing: sqlmetal -> dbml -> xml mapping file and .cs file.

A: 

The EDMX is also XML. If you're comfortable with XML transformations, just change the CSDL section of the file per your renaming rules. Then do a full build on your app and the code should be regenerated. To do this from the command line, use EdmGen, which comes with the framework. The free EdmGen2 utility is worth a look; it may already do some of what you need.

Craig Stuntz