Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which ORM to use?

I'm developing an application which will have these classes:

class Shortcut
{
    public string Name { get; }
    public IList<Trigger> Triggers { get; }
    public IList<Action> Actions { get; }
}

class Trigger
{
    public string Name { get; }
}

class Action
{
    public string Name { get; }
}

And I will have 20+ more classes, which will derive from Trigger or Action, so in the end, I will have one Shortcut class, 15 Action-derived classes and 5 Trigger-derived classes.

My question is, which ORM will best suit this application? EF, NH, SubSonic, or maybe something else (Linq2SQL)?

I will be periodically releasing new application versions, adding more triggers and actions (or changing current triggers/actions), so I will have to update database schema as well. I don't know if EF or NH provides any good methods to easily update the schema. Or if they do, is there any tutorial how to do that?

I've already found this article about NH schema updating, quoting:

Fortunately NHibernate provides us the possibility to update an existing schema, that is NHibernate creates an update script which can the be applied to the database.

I've never found how to actually generate the update script, so I can't tell NH to update the schema. Maybe I've misread something, I just didn't found it.

Note: If you suggest EF, will be EF 1.0 suitable as well? I would rather use some older .NET than 4.0.
Note 2: The ORM framework should be free for commercial usage.
Note 3: I will also use code obfuscation, randomly renaming all symbols etc... so to ORM should support this.

like image 547
Paya Avatar asked Apr 25 '10 18:04

Paya


1 Answers

Before .NET 4, Entity Framework was just not mature enough for my tastes. Furthermore, it does not support POCOs.

With EF out, I would select NHibernate. To make configuration code-based and somewhat easier, I would also use Fluent NHibernate. NHibernate is very mature and has lots of community support. It has an excellent facility for updating the database schema from the latest code. Highly recommended.

I don't think any of the others are serious options. Entity Framework is going to gain mind share rapidly because it is built-in and seriously marketed by MS. NHibernate will remain a viable competitor because it has plenty of popularity and maturity. The rest will slowly fall by the wayside until they are only used by small numbers of ardent supporters.

like image 70
Tom Cabanski Avatar answered Sep 17 '22 21:09

Tom Cabanski