Hi,
Do you have an idea how to write the following code nicer/shorter :)
I need to check if the field form form is not empty and then add
criterion to the query,
thanks :)
AbstractCriterion restrictions = null;
....
if (model.DataWplyOd != null)
AddRestriction(ref restrictions,
Restrictions.Ge(Projections.Property<PrzesylkaWplywajaca>(x =>
x.DataWply), model.DataWplyOd));
if (model.DataWplyDo != null)
AddRestriction(ref restrictions,
Restrictions.Le(Projections.Property<PrzesylkaWplywajaca>(x =>
x.DataWply), model.DataWplyDo));
if (!string.IsNullOrEmpty(model.DekKoor))
AddRestriction(ref restrictions,
Restrictions.Eq(Projections.Property<PrzesylkaWplywajaca>(x =>
x.DekKoor), model.DekKoor));
.... // many more conditions :)
return
m_session.QueryOver<PrzesylkaWplywajaca>().Where(restrictions).List();
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.