There is an if as well, but I left out for brevity.

            if (!String.IsNullOrEmpty(criteria.Search))
            {
                query.Add(Expression.Or(
                    Expression.Like("Name", criteria.Search, MatchMode.Start),
                    Expression.Like("a.Address", criteria.Search,
MatchMode.Start)));
            }

On Wed, Jun 24, 2009 at 1:15 PM, Fabio Maulo<[email protected]> wrote:
>
>
> 2009/6/23 Craig van Nieuwkerk <[email protected]>
>>
>> And I am trying to query it using the Criteria API like this.
>>
>> ICriteria query = m_CustomerRepository.Query()
>>    .CreateAlias("Address", "a",
>> NHibernate.SqlCommand.JoinType.LeftOuterJoin);
>> var result = query
>>  .SetProjection(Projections.Distinct(
>>    Projections.ProjectionList()
>>      .Add(Projections.Alias(Projections.Property("CustomerId"),
>> "CustomerId"))
>>      .Add(Projections.Alias(Projections.Property("Name"), "Name"))
>>      .Add(Projections.Alias(Projections.Property("Addresses"),
>> "Addresses"))
>>    ))
>>  .SetResultTransformer(new AliasToBeanResultTransformer(typeof(Customer)))
>>  .List<Customer>() as List<Customer>;
>
> Only a curiosity.
> This is the whole query ?
> No "if" ? nothing to change between a call and other ?
> --
> Fabio Maulo
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to