Re: Strange bug when querying a circular graph with several joins
"Will Shaver" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nhibernate.devel |
|---|---|
| Message-ID | <[email protected]> |
What version of c# and nh are you using?
Here's an extension method that I use for these type of of problems
public static ICriteria CriteriaByLongAlias(this ICriteria criteria,
stringfield)
{
ICriteria byAlias = criteria.GetCriteriaByAlias(criteria.Alias + "_" +
field);
if(byAlias == null)
byAlias = criteria.CreateCriteria(field, criteria.Alias + "_" + field);
return byAlias;
}
Use this as follows:
ICriteria criteria = NHsession.CreateCriteria(typeof(Role));
ICriteria primaryLocationCriteria = criteria.CriteriaByLongAlias(
"PrimaryLocation");
ICriteria addressCriteria = primaryLocationCriteria.CriteriaByLongAlias(
"Address");
addressCriteria.Add(Expression.Like("Postcode", "BS%"));
If you review CriteriaImpl.cs you will note that while CreateAlias returns
the original criteria, CreateCritieria returns the subcriteria. I've found
it best to ignore CreateAlias.
On Thu, Jul 3, 2008 at 7:03 AM, Fabio Maulo <[email protected]> wrote:
> Hi Chris,
> You can start from one of the users forums
> http://groups.google.com.ar/group/nhusers
>
> Our issue tracker is (only for bugs, improvement etc.) :
> http://jira.nhibernate.org/secure/Dashboard.jspa
>
> Thanks
> --
> Fabio Maulo
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Nhibernate-development mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nhibernate-development
>
>
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development