Josh Kodroff
Josh Kodroff

Reputation: 28121

How do I generate Entity Framework 4.0 classes from the command line that have different names than my schema objects?

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.

Upvotes: 1

Views: 548

Answers (1)

Craig Stuntz
Craig Stuntz

Reputation: 126547

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.

Upvotes: 2

Related Questions