darkwater23 — 2011-08-29T17:19:32-04:00 — #1
I'm kind of confused by something and I thought someone here could explain it. I've been researching this for a while now and I can find the answer.
I have a SomeDatabase.edmx file in my MVC3 project where I connected to a database and imported all the entities. Later, I created a stored procedure and mapped that function. The only way to access the database class was to do "Add an existing item" on the Models folder and point to that edmx file. It looks weird to me, though, because I can see the file in my project twice now. Once in the root and once under models. If I make a change (like when I added the sproc), rebuilding the project didn't expose the method. I had to remove and re-add the edmx file to models. That doesn't sound right, so I think I did something wrong.
What is the proper procedure for using EF and MVC3? Thanks!
darkwater23 — 2011-08-30T09:43:09-04:00 — #2
Ok, I think I found it!
Create an Entity Framework Model and Use it in Multiple Projects
I created a class library and then created the model in that new project. Then, I referenced that project in my MVC project. I'm going to proceed from here and see how it goes.
Wish me luck!
darkwater23 — 2011-08-30T10:21:06-04:00 — #3
Found one gotcha! Since I had mucked up the project pretty good, I burned it down and started over. There's an issue with adding MVC to an existing solution, though.
Problem adding new project to MVC solution : The Official Microsoft ASP.NET Forums
One suggestion was to add two projects so that you can view the solution tree in VS2010 and then add an MVC project to it.