I need to have my .edmx file in my Data project and its generated models in my Data.Model project.
Is it possible? And if so, how?
I need to have my .edmx file in my Data project and its generated
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you using the EF DbContext Generator to generate code-first models? If so, you can build your
.edmxfile the same way you always do. Once it is created and the models are generated, move the MyContext.tt template into your Data.Models project (Leave yourMyContext.Context.ttfile in the project with your.edmx).After that, open up the
Context.ttand near the top change the inputFile to the relative path of your Data.Model project. It will end up something like:Go back to your
MyContext.Context.ttin your .Data project and change the CustomToolNamespace property to Data.ModelFrom then on, when you make changes to your
.edmxfile, you will have to also go into your Data.Model project and save theMyContext.ttagain to regenerate the models.