views:

564

answers:

6

I have recently found myself becoming more negative about EF and cannot help wondering if the real problem is my own knowledge on the subject. I have seen many simple/artificial examples of using EF, especially in conjunction with MVC, but I have not yet found any real-life examples of using EF and taking advantage of all the functionality. In addition, every attempt that I have made so far to use EF seems to have been scuppered either by deficits in the VS2008 designer (such as support for server generated fields/columns) or by the need to provide reams of additional code to support updating the data back to the source (where I expected this to be supported by EF).

In order for me to really look into this and make a more educated decision, can anybody point me to some examples of using EF, with ASP.NET for instance, in a real-life situation - such as retrieving some related data from the underlying source, updating that data and then persisting those changes to the source. In any example you can provide, I would like to be able to see only the changes made by the user being sent back to the source rather than simply overwriting the current version.

I would also like to see some examples of being able to use EF in a web service/WCF situation where again an entity is retrieved with related objects and any changes made are persisted back to the data store.

I would prefer as many examples as possible to be using EF 1.0 (3.5) as this is the version that is currently available for production use, but I would also be interested to any EF 4.0 examples that prove things are going to get better.

I want to believe that EF is the way forward. I particularly like the idea of treating a database as if it were simply a bunch of related objects (and have frequently rolled my own versions of this in the past) but it seems that EF only goes so far. I have a couple of new projects on the horizon involving fairly large databases and cannot currently justify the use of EF even though I would really like to.

+1  A: 

I think it will be awhile before EF catches up to Hibernate.

Spencer Ruport
I realise that Hibernate is more established, though recent exposure to it has pointed out that it too has it quirks!I am particularly interested in investigating EF in more detail at the moment as I feel sure that it must be more capable than I am!
Martin Robins
I've found most of it's more serious quirks can be overcome with the clever use of views. I'm sorry I'm unable to help you with your specific question however. :(
Spencer Ruport
Thanks anyway Spencer. As I have noted below, some of my colleagues are struggling with NHibernate already so I will tell them to google using it with views.
Martin Robins
A: 

I've asked a similar question here which is specific to ASP.NET MVC. I have basically the same question you do in that I have not seen many "real-life" examples of how EF works with a .NET web scenario.

YeahStu
Yes I have seen the question and it seems that you did not get many answers either, though the EF4 reference project mentioned by Andrew Peters (below) looks like it may be a long term reference (still nothing for EF1 though).
Martin Robins
+1  A: 

Can't provide you code, but can tell you my experience. Recently tried linq to sql in a real project. It wasn't bad, but it didn't fit with domain driven design (or i just was too dumb to make it look as i would like).

Tried linq to entities. In short - wasted ~2 days. I gave up my hope after first few times i went through editing mappings.

Sticked with NHibernate (cause it does not generate anything). But they all are dissapointing at sproc support.

Maybe next release will be better. At the moment it seems clumsy for me.

Arnis L.
Some colleagues of mine took over a project involving NHibernate and all I ever hear from them is crying! In fact, it seems to have gotten so bad for them that when asked to add a new subsystem to the project they opted to implement this in EF1!Now all I hear is crying and wailing!I think my own personal beef with NHibernate is the lack of designer support and the subsequent need to hand generate all of the objects along with the mapping XML. I am also told (by my colleagues above) that the delete support is very poor.
Martin Robins
I prefer hand writing all of the objects cause of Domain Driven Design (apparently there aren't any code generator which could successfully generate whole business logic), so - that's a more like a feature for NHibernate that it does not generate anything. Mapping is done through Fluent NHibernate (it's intuitive, strongly typed). Designer mode of anything is a bad idea in general. Haven't got into troubles with deleting yet (but maybe that's likely to happen - hard to say that).
Arnis L.
+3  A: 

See http://dataguidance.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28998 for the official EF v4 Reference Implementation (features ASP.NET MVC front end).

Andrew Peters
Thanks for the link. I see that this is EF4 so it should be able to show me how things will work; now all I need is some examples of EF1 working...
Martin Robins
A: 

Good news (at least for EF4). Carl Perry has today released a series of articles on the ADO.NET team blog detailing some of the changes that are going to make life considerably easier. http://blogs.msdn.com/adonet/archive/2009/06/22/announcing-entity-framework-feature-ctp-1.aspx

Martin Robins
A: 

I'm looking for information on EF myself, and when directed to here I found most of the answers here dated after the release of the EF4 CTP4.

It might be the case that someone reading my answer will say that features in the CTP4 are dated as well, so I'd suggest to anyone looking at implementing entity framework for real should take a look at the ADO.net Team Blog and check the latest news

Padu Merloti