あなたが利用することができます
Restrictions.Conjunction()
例として:
private IQueryOver<CustomerEntity> QueryForCustomer(int? companyCode, int[] zipCodes)
{
var customerRestritcions = Restrictions.Conjunction();
if (companyCode.HasValue)
{
customerRestritcions.Add(Restrictions.Eq(Projections.Property<CustomerEntity>(c => c.CompanyCodeId), companyCode));
}
if (zipCodes != null)
{
customerRestritcions.Add(Restrictions.In(Projections.Property<CustomerEntity>(c => c.ZipCode), zipCodes));
}
return Session.QueryOver<CustomerEntity>(() => customer)
.Where(customerRestriction)
}