Entity Framework - is it going to work?
I played with object spaces way back when and thought it was a great idea. Then it died. I started playing with Linq to SQL, and although it did not die it so missed the mark I think it will die. I started playing with entity framework (EF) in beta 2 and now in beta 3. So, is it going to work? not how it sits now.
Microsoft does not seem to get what we are looking for. They keep trying and then they expand the scope of the project and miss it. What we want is an ORM solution that is seamless to use and fast. Look at Hibernate or its .Net partner NHibernate. That’s really what we are looking for. I want to take my domain objects, create some mappings and not have to worry about writing SQL.
Hibernate is a pretty mature open source project that accomplishes these goals. It’s been around for a long time, it works and has many production products that use it. NHibernate is newer, it’s only a little behind Hibernate but the pesky rumor that it’s dead or dying just won’t go away.
So, what is Microsoft doing wrong? To use EF, you must inherit from their base class or use interfaces. This is bad, I must now change my object model to use their base class or the interfaces (which is onerous at best). The end user designer is so broken that for all but the simplest projects you must start by learning how to create the mapping files by hand. Inheritance seems severely limited in the mapping files and execution is very slow.
What’s really concerning to me is the low number of posts in the Microsoft forum. The low volume for a product that’s supposed to have this much hype worries me and should worry Microsoft. This product could die very easily.
According to Shawn Wildermuth, I am not supposed to compare EF to other ORM solutions.
When Microsoft announced they were going to release a new technology called “The Entity Framework”, it was met with interested skepticism by most of the development community. Immediately there were comparisons to popular object-relational tools (NHibernate, LLBLGen Pro, et al). What got lost in the haze of comparisons was that the Entity Framework was a completely different animal. The most important piece of information in this article is that the Entity Framework is not meant to solve the same problem that these other tools are trying to meet.
Shawn Wildermuth then goes on to say:
The Entity Framework is not a persistence engine…
The Entity Framework is not an Object-Relational mapping tool…
The Entity Framework is not a code generator…
The entity framework according to Shawn Wildermuth is about Data Services, including persistence, object services, view services and query services.
Erm… okay. Lets walk real quick through entity framework and how you do something with it.
The first thing I have to do is create an ssdl mapping file to describe my relational data store. Then I create a csdl mapping file to describe my conceptual model. The last file is the msl file which tells the framework how to map from the ssdl to the csdl. After that I kick off edmgen to code-gen my partial class files. After all this I can write linq queries to hit my objects, modify them and save them to the data store.
So lets summarize real quick.
I create mapping files to map my relational store to my conceptual model
I use edmgen to code generate my base objects
I then use the context object to query, load and save my objects
Which part of this is not an ORM??? So maybe I left off "object services" and "view services" whatever the heck they are supposed to be. But I sill have persistence, query and mapping. That is an ORM.
Regardless of how many people say its not fair to compare entity framework to other ORM solutions, that’s how most of us are going to use it. You want to put an object broker on it or some kind of fancy design tool, that’s all great but if it cannot do the basic functions of an ORM then it’s not going to get used. Quit trying for some pie-in-the-sky project that’s been missed for 5+ years and fricking deliver us an ORM already. Read your own damn forum, a basic ORM is what we are looking for.
So, now I am stuck. I am starting a new project with a 12-18 month development timeframe and I really want to use entity framework. It’s from MS so there should be a lot of compiler and development UI integration. I should be able to hire brand x developers and they can understand it or learn it pretty quickly. However, if they miss the mark badly enough again (ala object spaces) it’s going to die the same death.
I could use NHibernate, at least if it dies, it’s open source and I have the source code. Heck we could even pitch in to help keep it alive. But what a pain (sorry open source fans). If I wanted to do that I could just roll my own; but that’s not really an option.