0

Is there a way to change the pattern that EF uses to generate the Entity name when generating the EDM model from an existing database?

Example:

I have a table: table_name and I want my entity to be named TableName without me having to change it manually.

EDIT: I know I can change the POCO generation template, but how about the EDM generation? Is this done with a template as well? If so, where is this template located?

1 Answer 1

1

I'm affraid it is not possible - at least not without investigating possibilities of EF Designer extensibility or investigating EdmGen internals. The point of Entity designer is to allow you easily map / change those names.

Interestingly it is possible if you start with model (EF designer) and want to generate database from the model - in such case the process is controlled by workflow and T4 templates and you can change it but in case of generating model from database the process is most probably hardcoded inside Edmgen tool - you can check if this tool has any API which would allow you changing the behavior.

Anyway EDMX is just XML so if you have exact pattern you need to replace you can create very simple tool, transformation or script which will modify your EDMX file after generation from the database.

You cannot change the POCO T4 template. The template must produce classes with exactly same names as you have for entities in your model. Otherwise the POCO magic will not work.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the POCO T4 template clarification... I had already decided to leave my EDM as is and just changing the template. But now that you mention it, it make sense why that wouldn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.