views:

23

answers:

1

Is it possible to set the default order-by column to use in the NHibernate mapping file? Unless explicitly defined I want to order all specific entities by the Name column automatically.

I've seen that it can be done on collections but thats not what I'm after in this case.

+1  A: 

No, that wouldn't make sense in the NHibernate mapping context because the order always depends on how you are doing the query; defining a "default order" would be pointless.

Instead, do that in a DAO/Repository base class.

Diego Mijelshon