views:

434

answers:

7

I am new to both MVC as well as Entity Framework, but I want to do my next project using those technologies. I went through the NerdDinner tutorial at http://nerddinnerbook.s3.amazonaws.com/Part1.htm. NerdDinner uses Linq to Sql and uses the Repository pattern to manage data access. NerdDinner is written so well that I wanted to use it as my guide when working on my new project. Unfortunately, since it's using Linq to Sql, and the recommendation now is to use Entity Framework 4, I got thrown off a little. Since I am also new to MVC, I sort of need a good example like NerdDinner to start off with, and I'm unable to find something similar except that uses the EntityFramework 4.0.

If I start off using Linq to Sql with the repository pattern like NerDinner does, it should be pretty easy to switch to EntityFramework later right?

Are there any good tutorials using MVC 2 and EF 4?

+1  A: 

I like this tutorial for EF4 with the repository pattern: Testable Code

Tim Hoolihan
+1  A: 

Yes, switching from Linq-To-SQL to Entity-Framework is mostly painless. I have built two very successfull web applications of sufficently higher complexity than NerdDinner using the NerdDinner tutorial as a guideline and have not found any issues with the design.

Nate Bross
+1  A: 

As you are new to MVC and EF then I'd suggest a tiered approach. Start with MVC and follow the NerdDinner example (although it's not a true repository or wasn't last time I looked), once you are comfortable with the MVC paradigm you should find it easy to move from Linq to SQL to EF.

Lazarus
+2  A: 

Scott wrote a little bit on nerd dinner and the Entity Framework that may get you going.

There is also the mvc music store sample.

klabranche
The music store is good, but unfortunately it doesn't use the repository pattern
Prabhu
+1  A: 

Is nerd dinner really written well? Some people don't think so.

To answer the question -- you you've got a solid repository model, then upgrading from Linq2Sql to the current version of the entity framework is relatively painless. But I wouldn't want to try it without a solid test suite.

Wyatt Barnett
Thanks for that link. While I see the shortcomings of the nerdinner codebase, I think the article itself is very well written--it was the one that got me excited about MVC.
Prabhu
Btw, if nerdinner is not written so well, is there any other example that you could point me to that uses EF4 and Repository Pattern? Thanks
Prabhu
+1  A: 

EF is not necessarily better than Linq to SQL, as you can see here. It depends on what you're trying to achieve.
But if you still prefer EF and don't find a good tutorial, I think learning it separately isn't such a bad option.

Oren A
+2  A: 

There is an Entity Framework Nerddinner.com sample:

http://nerddinner.codeplex.com/releases/view/45621

jfar
Thanks, this is great...
Prabhu
I thought one existed but didn't find it.... :-)
klabranche