There are many ORM solutions out there, so in your experiences what seems to be the best choice?
NHibernate or Subsonic, Genome,DLinq, LLBLGen - there seems to be a plethora of options, so pros and cons please people.
There are many ORM solutions out there, so in your experiences what seems to be the best choice?
NHibernate or Subsonic, Genome,DLinq, LLBLGen - there seems to be a plethora of options, so pros and cons please people.
I had considered that but there appears to be some "LINQ is dead" stuff creeping through the dev community
I'd recomend NHibernate and anti-recomend Entity Framework.
Entity Framework is all driven by the combined edmx designer. Moving an Entity in the diagram causes the code behind to be regenerated, making it very hard to customize. If customisation is required, you have to manually split the files into 4.
Number of files needed to change an entity: NHibernate: 2 Entity Framework: 4
In NHibernate these are two different files per entity, in Entity Framework it’s the same 4 files per database which can get big and unweildly.
With NHibernate, an additional config file is needed, but this only needs to exist once. (Or once per database in a multidatabase environment.)
If you use tools such as CodeAnalysis or StyleCop, the auto generated files fail these and can't be fixed due to the regeneration issue mentioned above. The only ways to put a "generated code" attribute on them is either create a partial stub with the attribute on them or use something to inject it at build time. Niether of which is very nice.
Even with the GUI, do something like adding a new entity with a relationship to an existing one is fiddly, whereas in NHibernate its a small xml fragement.
NHibernate has the advantage of being extensible by things like Linq2Nhibernate, Castle Active Record (if working with the XML files doesn't appeal this sits on top and is done entirly by attributes.)
If you work in a non-exclusive checkout system, then the prospect of having to merge the EDMX, or its split versions is a nightmare, where as in NHibernate there is a file per class (or entity) making it a lot more managable.
LinqToEntities is missing Contains
support that Linq2Sql has which has caused me no end of headaches.
Just my opinion. Hope that helps.
If SQL Server is your database, then LINQ to SQL, if it's a different RDBMS (MySQL, PostgreSQL..) then SubSonic.
If you use one of the MySQL, PostgreSQL, Oracle or SQLite and care about commercial packages then dotConnect from Devart (formely CoreLabs) should be good. We missed LINQ to MySQL by a few months in my newest project, so we went for SubSonic, but if I was starting right now I would be looking at LINQ to MySQL definitely.
I don't recommend Subsonic, it's being pain in my arse in my first subsonic project, I hated it at the end. I spend large amount of time to fix Subsonic bugs instead of developing stuff (especially support for MSSQL 2000 was really weak). They actively keep fixing bugs and massively introducing new features. This is good and bad. But this is generally bad if you are going to use it in a big project.
I used Raptier, it's really simplistic and good although it's a dead project now, so not a good choice for a new project.
Largely depends on your requirements and nfrs like performance. Of course, you might want to evaluate all the already mentioned options like nHibernate, Subsonic, Entity Framework, LINQ to SQL etc
Also, remember that there are some other, not so popular ORMs or ORM like stuff out there as well. Here is a list I pulled together some time back. Do some POCs and performance testing and decide based on your requirements.
This list is not in any specific order.
Neo - Neo is a framework for .NET developers who want to write enterprise applications with an object-based domain model. It is well suited for domain-driven design and agile development. Pretty good for small apps See http://neo.codehaus.org/
nHibernate - NHibernate is a .NET based object persistence library for relational databases. It is a widely used OR persistant tool these days. It is inspired by Java hibernate. See http://wiki.nhibernate.org/display/NH/Home
MyGeneration DoodAds - DoodAds is an elegant .NET architecture available in C# and VB.NET and capable of supporting any .NET managed data provider. Currently dOOdads are available for Microsoft SQL, Oracle, Firebird, Access, PostgreSQL, VistaDB, SQLite, and MySQL . You can use MyGeneration Code Generator to generate DAL classes easily for DoodAds. See http://www.mygenerationsoftware.com/ . I used this some time back for some quick implementations.
EasyObjects.NET - EasyObjects.NET is an object relational mapper (ORM) architecture based on a combination of the popular MyGeneration dOOdads architecture and the Microsoft Enterprise Library. See http://easyobjects.tigris.org/
DataBlock - DataBlock is a Object Relational Mapping and persistence framework for .NET 2.0. - See http://www.voidsoft.ro/DataBlock/index.html
AdapDev.NET - Adapdev.NET is a robust enterprise framework that supplements the MS.NET framework. It's the foundation of Codus (OR Code generator) and Zanebug (A unit testing framework) providing the underlying code generation and unit testing engines. See http://www.adapdev.com/
Gentle.NET - Gentle.NET is an RDBMS independent object persistence framework. It features automatic SQL generation and object construction, an SQL factory for creating custom queries, DataView construction helpers, excellent performance and reasonably complete docs. See http://www.mertner.com/confluence/display/Gentle/Home
IBatis.NET - The iBATIS Data Mapper framework makes it easier to use a database with Java and .NET applications. iBATIS couples objects with stored procedures or SQL statements using a XML descriptor. Simple and elegant..See http://ibatis.apache.org/
in my opinion Linq to SQL is only useful for small projects, because there a some important features (for me) missing, like n:m support.
I really like LLBLGEN Pro. Top bit of kit. really nice piece of software
I've been writing my own for years (since my vb5 days). Usually design DB first then generate classes based on templates to use with a general-purpose DAL (the latest incarnation of which I took about half an hour to write. SQL Server only though I have to say..).
In a modern environment where there are so many products available maybe that it's probably not a supportable POV - advantages are that you can get exactly (and only) what you need, and you have control over bugfixes/new features.
If you do go down this road, I'd recommend quite a lot of thought into exactly how you split the responsibilites (smart object/dumb object, when you load linked/child objects etc.) and how you handle security/permissioning issues... I'd recommend having the db do as much of the heavy lifting as possible - keeps your code cleaner. I'd steer clear of MS's strongly-typed datasets (incomplete, lead to repetitive code compared to a good library for use with plain ones and throw exceptions if you try to access a field whose value is null!!!). I also use composition a lot, but that may just be my VB background. Or the fact that I am keen on unit testing...
IMHO, ORMs that only generate code for individual tables, or SELECT *, or even SelectByPrimaryKey, are of limited use and can lead people to produce ugly/inefficient code. You need to be able to back them with sophisticated (stored) procedures to allow full, performant, selection and correctly cascading/checked deletion. A selection criterion there for an ORM.
I use ORMs because they make clearer code and a better, more robust and adpaptable architechture. I sometimes feel that some developers use them cos they are scared of SQL. I've always rather enjoyed the database side of things, and have solid design and SQL/T-SQL skills (the PL-SQL is a little more rusty these days...).
You'll get a lot more out of whatever ORM you pick if you understand and use the power of your database engine.
but maybe I am just a dinosaur...
Here are two additional ORM products which you might consider when chosing a product for your solution:
(Description of the products taken from their websites).
Since I have not yet used these products for anything productive, I can not give any recommendation. For both products, there exists a free version that can be used to evaluate the product.
Hi,
I would also consider choosing an ORM on is support and muturity.
Linq2Sql,
Entity Framework,
Hibernate
Neo
AdapDev.NET
you may have notice I mentioned the level of inheritance. please look at Matin Folwer's EAA
HTH
Bones
EntitySpaces - http://www.entityspaces.net/Portal/Default.aspx
From Mobile Devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with Medium Trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.