Nhibernate NH休眠外部联接 criteriaCount.CreateAlias(AdvertisementsProperties.City.ToString(),“City”) .CreateAlias(AdvertisementsProperties.Area.ToString(),“Area”) .Add(限制.析取() .Add(Expression.Like(“advision.+advisementsproperties.Name.ToString(),text,MatchMode.Anywhere)) .Add(Expression.Like(“advision.”+advisementsproperties.Description.ToString(),text,MatchMode.Anywhere))) /*.Add(Expression.Like(“city.+citiesproperty.Name、text、MatchMode.Anywhere)) .Add(Expression.Like(“city.+CitiesProperties.slovenianame、text、MatchMode.Anywhere)) .Add(Expression.Like(“area.”+areasprroperties.Name、text、MatchMode.Anywhere)) .Add(Expression.Like(“area.”+areasprroperties.slovenianame、text、MatchMode.Anywhere)) .Add(Expression.Like(“country.+countriesprroperties.Name、text、MatchMode.Anywhere)) .Add(Expression.Like(“country.+countriesprroperties.slovenianame、text、MatchMode.Anywhere)))*/ .List();
CreateAlias或CreateCriteria在SQL中创建内部联接。是否可以创建外部联接,因为在我的示例中,某些关系可以为null,并且我不需要始终使用内部联接。查看Nhibernate NH休眠外部联接 criteriaCount.CreateAlias(AdvertisementsProperties.City.ToString(),“City”) .CreateAlias(AdvertisementsProperties.Area.ToString(),“Area”) .Add(限制.析取() .Add(Expression.Like(“advision.+advisementsproperties.Name.ToString(),text,MatchMode.Anywhere)) .Add(Expression.Like(“advision.”+advisementsproperties.Description.ToString(),text,MatchMode.Anywhere))) /*.Add(Expression.Like(“city.+citiesproperty.Name、text、MatchMode.Anywhere)) .Add(Expression.Like(“city.+CitiesProperties.slovenianame、text、MatchMode.Anywhere)) .Add(Expression.Like(“area.”+areasprroperties.Name、text、MatchMode.Anywhere)) .Add(Expression.Like(“area.”+areasprroperties.slovenianame、text、MatchMode.Anywhere)) .Add(Expression.Like(“country.+countriesprroperties.Name、text、MatchMode.Anywhere)) .Add(Expression.Like(“country.+countriesprroperties.slovenianame、text、MatchMode.Anywhere)))*/ .List();,nhibernate,join,Nhibernate,Join,CreateAlias或CreateCriteria在SQL中创建内部联接。是否可以创建外部联接,因为在我的示例中,某些关系可以为null,并且我不需要始终使用内部联接。查看CreateCriteria方法和NHibernate.SqlCommand.JoinType.LeftOuterJoin参数 您的映射也可以确定此行为,请检查:查看CreateCriteria方法和NHibernate.SqlCommand.JoinType.LeftOuterJoin参数 您的映射也可以确定此行为,请检查
CreateCriteria
方法和NHibernate.SqlCommand.JoinType.LeftOuterJoin
参数
您的映射也可以确定此行为,请检查:查看
CreateCriteria
方法和NHibernate.SqlCommand.JoinType.LeftOuterJoin
参数
您的映射也可以确定此行为,请检查:我将CreateAlias与JoinType一起使用。Thx以获取帮助。我将CreateAlias与JoinType一起使用。谢谢你的帮助。
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>();