When creating a criteria in NHibernate I can use
Restriction.In() or
Restriction.InG()
What is the difference between them?
When creating a criteria in NHibernate I can use
Restriction.In() or
Restriction.InG()
What is the difference between them?
Restriction.In definately creates a subquery with whatever criteria you pass to the .In() method, but not sure what InG() does. never seen it.
@Sean: I only saw InG today because of intellisense. I can't find anything about it in the docs. I'm using NHibernate 2.0
InG is the generic equivalent of In (for collections)
The signatures of the methods are as follows (only the ICollection In overload is shown):
In(string propertyName, ICollection values)
vs.
InG<T>(string propertyName, ICollection<T> values)
Looking at NHibernate's source code (trunk) it seems that they both copy the collection to an object array and use that going forward, so I don't think there is a performance difference between them.
I personally just use the In one most of the time - its easier to read.