Hey Ben, how's Dapper working out for you? I started a thread on SO about evaluating ORMs: http://stackoverflow.com/questions/7574863/what-criteria-should-i-use-to-evaluate-an-orm. We're considering implementing an ORM at Ecos (well we have Linq-to-Sql) and EF came up but was not my favorite. So Dapper is very interesting to me; if it's good enough for SO it's good enough for me.
Tech: http://compositecode.com
I’ve used the Entity Framework for a few projects. I agree that there are better ORM’s out there unless you have a compelling reason to use it. I happened to be using it for Silverlight and RIA which I think was a compelling reason.
Aside from the performance issues, I often ran in to problems such as updatable views not being supported (without hacking up the auto-generated files and making views look like tables). When I first started using it my include (joins) caused the generated SQL to be absolutely horrendous. I didn’t know this until I noticed it with SQL Profiler. I wish I saved the auto-generated SQL. I’m certain it would make Adron’s eyes bleed. Take-away from this was that learning EF enough for production-level work is a bit of a learning curve. Keeping everything in sync was also fairly time consuming although EF continues to improve in this area.
-Tom
That said, I'm fairly certain that I want to avoid using SQL databases
for end user products ever again. They are a nightmare. Adron said it
perfectly "Nothing beats removing the whole ORM + SQL + RDBMS overhead
for getting things done. ".
Generally speaking, avoid layers of abstraction... Really.
Especially ones that hide bad technology. Remove the bad technology.
Thanks,
Troy
I think I started on 3.5 but upgraded to 4.
IMO SQL (the intermediary DSL for data access) itself is a pointless
layer of abstraction. If you are using SQL, then stored procedures
should be used *very* sparingly and only in specific circumstances.
Especially not for basics like CRUD operations.
The real issue is that SQL itself creates too great an impedance
mismatch between modern programming techniques and the data model. You
want to reduce code? Reduce the impedance mismatch between your
programming language and your data store. Simplify the chain of
operations and remove layers of abstraction.
That's how you achieve real flexibility and the ability to say "yes"
to any user request. We tend to say "no" when something is "too much
trouble to change", and usually the list of reasons relates directly
to the arduous task of manipulating all those layers of abstraction to
have a new structure or behaviour.
WRT to debugging and code complexity, burying things in libraries
doesn't really improve matters much. Just because you didn't type the
lines of code doesn't mean they aren't there...
For performance critical applications, consider using structs,
protobuf, and a document database, or a simple B+Tree that indexes a
blob store. If you start with that as a basis of your architecture,
you'll find that you can adapt your programming techniques to make
that "just work" with far less code, and far less to debug.
Obviously that's a lot of engineering overhead for a web app, which is
why there is a very similar chain available in systems like MongoDB.
Doing the typical stack of:
Domain Object
Third Party ORM
DTO (untyped array)
SQL
Database (often very quirky)
... is the most layers of abstraction with the least benefits.
With MongoDB:
Domain Object
DTO (BSON)
Database
You can decorate your class to automate serialization, and then you're
literally just passing your domain object to the mongodb client and
getting them back from it (it will perform the
seralization/deserialization to/form BSON for you). It's dead simple,
and extremely flexible, and you end up with exactly the same
experience from the application code as the ORM/SQL stack, with WAY
less complexity overhead and maintenance to deal with.
-T