Database 在亚音速2.1中,如何从find中获取强类型对象?

Database 在亚音速2.1中,如何从find中获取强类型对象?,database,c#-3.0,subsonic,idatareader,Database,C# 3.0,Subsonic,Idatareader,在亚音速2.1中,如何从Find中获取T型 Animal criteria = new Animal(); IDataReader result = Animal.Find(criteria); 我希望结果是动物型的,而不是IDataReader型的。我怎样才能把IDataReader变成动物?我希望有一种亚音速或框架方法可以帮我做到这一点。试试这个(从: 谢谢你的回答。我现在正致力于将其转化为一种良好的扩展方法: IDataReader result = An

在亚音速2.1中,如何从Find中获取T型

        Animal criteria = new Animal();
        IDataReader result = Animal.Find(criteria);
我希望结果是动物型的,而不是IDataReader型的。我怎样才能把IDataReader变成动物?我希望有一种亚音速或框架方法可以帮我做到这一点。

试试这个(从:


谢谢你的回答。我现在正致力于将其转化为一种良好的扩展方法:
IDataReader result = Animal.Find(criteria);
AnimalCollection coll = new AnimalCollection();
coll.Load(result);
result.Close();

// do something with coll
foreach (Animal anm in coll)
{
    // do something with animal object
}