Wednesday, January 23, 2008 12:38 AM Sean Feldman

ORM Poll

Looking for some feedback from ASP.NET community - are you using ORM mapping tool and how disconnected your business logic from the persistence during initial development?

To give a hint, I was looking at NHibernate, Microsoft Entities Framework, and in-house grown entities framework based on DB schema-first as opposed to the pure ADO.NET direct access. Thanks.

Comments

# re: ORM Poll

Wednesday, January 23, 2008 7:22 AM by SoftMind

I would go for SubSonic.

Subsonic with version3.0 is getting ready for MVC and its the best thing happening for asp.net.

SubSonic is based on Active Record pattern, and Active Record is  one of the reason behind Ruby on Rails Success.

Thanks

# re: ORM Poll

Wednesday, January 23, 2008 10:02 AM by Vitaly

Better look on LINQ, much more interesting than NHibernate.

# re: ORM Poll

Wednesday, January 23, 2008 11:15 AM by Travis

Repository Pattern with NHibernate.

# re: ORM Poll

Wednesday, January 23, 2008 12:17 PM by Sean Feldman

@Travis,

could you expand a little?

# re: ORM Poll

Wednesday, January 23, 2008 12:20 PM by Sean Feldman

@Vitaly,

LINQ in my understanding, is just a syntax sugar to work again something (for example MS Entities Framework) and could be also applied on NHibernate (if it would support it) or any other mapping tool. I absolutely agree that LINQ itself is an interesting approach.

# re: ORM Poll

Wednesday, January 23, 2008 1:26 PM by AndrewSeven

Linq to Sql without using the Entities Framework :)

# re: ORM Poll

Wednesday, January 23, 2008 1:39 PM by Sean Feldman

@AndrewSeven,

how would you build the domain objects using Linq to Sql without having DB in place first?

# re: ORM Poll

Thursday, January 24, 2008 1:11 AM by Shawn

All those recommending linq to sql. Have you actually looked at or tried to use it in a multi-tiered (layered) app? It doesn't work well imho. You lose most of the change tracking etc. I wish it did...but it doesn't. I personally like LLBLGen. I have also used subsonic for small projects but I'm not a big fan of active record.

# re: ORM Poll

Thursday, January 24, 2008 2:25 AM by Sean Feldman

@Shawn,

I am getting the sense that lots of people would have active record pattern and work with the real DB, rather than working with an InMemory presentation of DB. I looked at SubSonic, nice, but it works against DB only. LLBLGen - have to look into that. So far seems like NHibernate is the only that allows to develop the domain objects first and later just map it to the real DB.

# re: ORM Poll

Thursday, January 24, 2008 2:48 AM by Tom Dean

I assume you're looking for a TDD-friendly tool?

I'm a huge fan of NHibernate for small-to-medium complexity db schemas. Couple that with Rhino.Commons Repository<T> style pattern and Ayende's NHibernate Query Generator. Gives you things like this:

public class User {}

public class UserRepository : Repository<User> {}

Then you can...

UserRepository rep = new UserRepository();

IList<User> users = rep.FindAll(Where.User.Age.Gt(42));

or

rep.FindAll((Where.User.Age.Gt(42) && Where.User.Age.Lt(50)) || Where.User.City.Like("Springfield"));

or

rep.FindAll(Where.User.City.Like("Springfield"), OrderBy.User.Username.Asc);

Grab it at:

rhino-tools.svn.sourceforge.net/.../trunk

# re: ORM Poll

Thursday, January 24, 2008 9:12 AM by Sean Feldman

@Tom,

thank you for the great info. I will definately  look into that as it looks very interesting. The only thing I don't like is to address DB fields by strings and not in some other way (constants, or auto-generated variables). Thank you for the info.

Edited:My bad, I should not answer at 7 in the morning :) This is actually looks awesome.

# re: ORM Poll

Thursday, February 14, 2008 7:20 PM by Miquel Fornas

In our small shop we use XPO from Devexpress. It comes with a class XPObject from where I inherit my class and then I can call the method Save to persist that info. the ORM can be mapped to 10+ database types and the performance is quite good. Can't complain