Allow parameter list as ienumerable and simplify IQuery
Description
Environment
Attachments
- 14 Dec 2010, 08:29 AM
Activity

Roger December 16, 2010 at 12:40 AM
Just what I was looking for. Thanks!

Roger December 14, 2010 at 11:40 AM
I was hoping to submit a "simple" patch and not creating yet another overload (rather remove some). However - I submitted it way too fast...
I don't need this for any important reason - just wanted to make the query API a little bit easier.

Fabio Maulo December 14, 2010 at 9:38 AM
Roger,
I think that the solution can be a little bit easiest.
public IQuery SetParameterList<T>(string name, IEnumerable<T> vals)
{
if (vals == null)
{
throw new ArgumentNullException("vals");
}
SetParameterList(name, (ICollection)vals.ToList());
return this;
}
or even an extension method.
I'll change the type of the issue to Improv, and if you need we can implement it.

Roger December 14, 2010 at 9:00 AM
No. It won't work. Didn't notice the ParameterListComparer.
Skip this patch. If it's something you need, please say "yes" and I'll do a bigger patch.
IQuery.SetParameterList accepts an ICollection. Today when generic are mainstream it means some wrapping or casting - not that many generic interfaces impl ICollection.
I changed this to accept a more general IEnumerable instead.
Minor:
This patch also changes Restrictions.InG<T> to accept an IEnumerable<T> instead of a ICollection<T>.