[求助]castle多对多的分页大家都是怎么样做的?(更新)
这个是我自己做的,感觉效率很低,而且无法查询。
public IList GetPictureByPTypeID(string PTypesID, int firstResult, int maxResults, out int recordcount)
{
IList plist = pm.PType.Find(int.Parse(PTypesID)).Pictures;
recordcount = plist.Count;
return IListPage(firstResult, maxResults, plist);
}
public IList IListPage(int firstResult, int maxResults, IList list)
{
ArrayList tlist = new ArrayList();
int i = 0;
foreach (object obj in list)
{
if (i >= firstResult && i < (firstResult+maxResults))
{
tlist.Add(obj);
}
i++;
}
return tlist;
}
{
IList plist = pm.PType.Find(int.Parse(PTypesID)).Pictures;
recordcount = plist.Count;
return IListPage(firstResult, maxResults, plist);
}
public IList IListPage(int firstResult, int maxResults, IList list)
{
ArrayList tlist = new ArrayList();
int i = 0;
foreach (object obj in list)
{
if (i >= firstResult && i < (firstResult+maxResults))
{
tlist.Add(obj);
}
i++;
}
return tlist;
}