a newbie question here...
I've created an entity data model (.edmx) file in one project and now it's sitting there looking beautiful with complex types defined and diagrams all spaced properly..
Then I started a new project and try to reuse the same file by adding it to the project... I get a bunch of errors sayings it's not pointing to the right pro开发者_开发技巧ject...
I tried to just copy the entire model into a new model and get a bunch of reference errors.
How do I do this? surely it can't be this hard...
I can of course import from the database but I don't get the complex types etc and remapping them is PIA.
You shouldn't have to import the model if you love what you just did... if you create a New Solution, you can "Add Existing Project" and it will transfer properly.
- Create a new solution
- Add Existing Project (Then select the project with the pretty .edmx)
- Add new Project to solution (the new project you want to do... MVC, Forms, ASP, UnitTest etc.)
- Reference the first project with the .edmx into the newly created project
Just make sure your connection strings are set correctly when you do this
This will keep the EF logic separate from the new project... Plus that project becomes reusable in other projects if that's what you want...
This will also keep you on the Onion Architechture path...
精彩评论