views:

1605

answers:

4

i search a good tutorial to learn how to use entity framework in the right manner. in particular with asp.net mvc.

Thanks in advance.

A: 

There you go

In all seriousness though, look for Scott Guthrie's blog, he did a whole series on MVC for ASP, although some of the syntax has changed a bit now.

qui
doesn't really help with the Entity Framework side of the question tho...
DeletedAccount
+2  A: 

Hi there. I'd point you in the direction of this rather (1) lengthy article from the Entity Framework team.

They've done a pretty good job of explaining both the shortcomings of the initial version (v1.0) and also give plenty of ideas into what they are considering for the next version.

FWIW, I've done a tiny bit of ASP MVC and I'm not sure you're going to like mixing the two.

For the (v1.0) version of the Entity Framework you really need to either do one of two things - work with "disconnected" entity sets or retail the data context of an entity set. Either scenario has pitfalls as I'm sure you can appreciate. In short.. I don't think there is a "right manner" to pick up at this stage. At least not with ASP MVC.

To get started with the Entity Framework, your bet would be to take a look at the official ADO EF samples located (2) here. The easiest to pick up and start learning with, IMHO, are the WinForms based examples, but there are a few ASP.net examples which nmight be helpful.

(1) [http://blogs.msdn.com/efdesign/archive/2008/11/20/n-tier-improvements-for-entity-framework.aspx]
(2) [http://code.msdn.microsoft.com/adonetefx]

RobS
+2  A: 

This gives a reasonable example of how to use the EF with the MVC framework. I have looked at this recently too and I am coming to the same conclusions as Rob, it is more pain than it is worth! Especially when compared to using Linq2Sql. Not having the same context when loading the entities as when you save them (typically different actions), causes a lot of unnecessary code to be written.

Colin Desmond
A: 

We're currently working on an EF 4.0 Reference Implementation using ASP.NET MVC at the front end. Check it out here - We'd love to hear your feedback.

Andrew Peters