sql - Can I set NHibernate's default "OrderBy" to be "CreatedDate" not "Id"? -
this oddball question figure.
can nhibernate ask sql sort data createddate default unless set orderby in hql or criteria? i'm interested in knowing whether sort can accomplished @ db level avoid bringing in linq.
the reason use guids ids , when this:
sheet sheet = sheetrepository.get(_someguid); ilist<sheetlineitems> lineitems = sheet.lineitems;
to fetch of lineitems, come in whatever arbitrary way sql sorts fetch, figure guid. @ point i'll add ordinals line items, now, want use createddate sort criteria. don't want forced do:
ilist<sheetlineitem> lineitems = sheetlineitemrepository.getall(_sheetguid);
and writing method sort createddate. figure if sorted on createddate default, fine, unless requested otherwise.
no, can't. best solution (as mention in comment) set order-by attribute in collection mapping. note value should set database column name, not property name.
Comments
Post a Comment