I do this a lot:
 
IList list = ExecuteQueryForList("FooGetMany", null);
for (int i=0;i<list.Count;i++)
{
fooCollection.Add((Foo)list[i]);
}
 
The only question I've had with that is do I need to check 'list' to
see if is null or am I guaranteed to get an empty (i.e. Count=0) IList
object back if the qeury returned zero results?
 
- Ron

 

It should return at least an initialized list unless something goes wrong with an optional rowDelegate while populating the list with the DataReader’s results.  MappedStatement.RunQueryForList() returns an arraylist or other as defined in the statement:

 

if (_statement.ListClass == null)

{

      list = new ArrayList();

}

else

{

      list = _statement.CreateInstanceOfListClass();

}

 

Roberto

Reply via email to