Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I am having Entity Framework 6 with code first approach. I would like to have designer.cs class in code first approach can it be possible or not i am just asking you..... If it is possible then how to get or create the class file. This class can be found when we create edmx file right likewise i required.

What I have tried:

I doesn't try anything because i don't know how to create it or if it is already created then where it is located. So, please can anyone help me regarding this.
Posted
Updated 20-Oct-17 6:03am
Comments
johannesnestler 19-Oct-17 7:54am    
I have no clue what you want - can you try to explain a little better? If you use Code-First what would you do witn an edmx-file? (this would be model-first or generated from database-first). From my experience I can tell you: let the edmx-file go - EF-Team will deprecate it with EF7 and on EF-Core it's gone already... If you have to control the mapping for special cases, better use fluent-api.
What you mean with designer.cs file is beyond my imagination...
Member 8583441 20-Oct-17 2:37am    
I will explain you clearly about this issue.
I am having MVC Project which has been done previously using ef4.1 Entity Data Model having Object Context and now I am using the same project with different EF 6.1.3 version with Code First approach.

If we create an Entity Data Model then it automatically creates an .edmx file having .tt class and .designer class.

But when we use Code First approach it will create only the data model without .tt class and .designer class. Now my question is can it be created .designer class from code first approach.

I have tried creating a class named "Entitydatamodel.Designer.cs". It automatically creates for me the .designer class but I am getting an error saying "Ambiguity issues:"

Here i haven't created any .tt class but these classes I initialized in data model itself.

1 solution

There are several suggestions in this StackOverflow thread:
How do you create a visual model of EntityFramework code first[^]

If you're using Visual Studio 2015 or 2017, you'll want the EF Power Tools community edition, rather than the beta version linked from the accepted answer:
Entity Framework 6 Power Tools Community Edition - Visual Studio Marketplace[^]
 
Share this answer
 
Comments
Member 8583441 21-Oct-17 0:21am    
I already installed Entity Framework 6 Power Tools. I haven't used it and also I created code first data model without this power tool. Can it be changed back without deleting the data model.
Richard Deeming 24-Oct-17 7:29am    
The power tools will let you view the diagram for the existing data model. They don't replace it with an old EDMX model.

There's an overview of the tools on YouTube: https://www.youtube.com/watch?v=dWMKT9xYXUM[^]
Member 8583441 24-Oct-17 8:08am    
Okay Let me check and get back to you Richard Deeming sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900