Using Subsonic 2.1 I want to make my method call to results look like this: results(searchCriteria) right now I have to pass the CollectionType as well as the type.
Animal searchCriteria = GetSearchCritera();
AnimalCollection results = results<Animal, AnimalCollection>(searchCriteria);
// I want the call to be results(searchCriteria);
Here is the results method that I want to just take Y
public static T results<Y, T>(Y searchCriteria)
where Y: ReadOnlyRecord<Y>, new()
where T: ReadOnlyList<Y, T>, new()
{
using (IDataReader results = ReadOnlyRecord<Y>.Find(searchCriteria))
{
T a = new T();
a.Load(results);
return a;
}
}
I made this class:
changed this code:
and I’m able to call it like this:
Oh yeah I wanted this to be an extension method: