Luke Smith
Luke Smith

Reputation: 24254

Setting the default orderby for an entity in the mapping file?

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.

Upvotes: 0

Views: 672

Answers (1)

Diego Mijelshon
Diego Mijelshon

Reputation: 52735

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.

Upvotes: 1

Related Questions