criteriaCount.CreateAlias(AdvertisementsProperties.City.ToString(), "city")
.CreateAlias(AdvertisementsProperties.Area.ToString(), "area")
.Add(Restrictions.Disjunction()
.Add(Expression.Like("Advertisement." + AdvertisementsProperties.Name.ToString(), text, MatchMode.Anywhere))
.Add(Expression.Like("Advertisement." + AdvertisementsProperties.Description.ToString(), text, MatchMode.Anywhere)))
/*.Add(Expression.Like("city." + CitiesProperties.Name, text, MatchMode.Anywhere))
.Add(Expression.Like("city." + CitiesProperties.SlovenianName, text, MatchMode.Anywhere))
.Add(Expression.Like("area." + AreasProperties.Name, text, MatchMode.Anywhere))
.Add(Expression.Like("area." + AreasProperties.SlovenianName, text, MatchMode.Anywhere))
.Add(Expression.Like("country." + CountriesProperties.Name, text, MatchMode.Anywhere))
.Add(Expression.Like("country." + CountriesProperties.SlovenianName, text, MatchMode.Anywhere)))*/
.List<Advertisements>();
CreateAlias или CreateCriteria создают INNER JOIN в SQL.Можно ли создать OUTER JOIN, потому что в моем примере некоторые отношения могут быть нулевыми, и мне не нужно все время внутреннее соединение.