日期:2014-05-17 浏览次数:20488 次
public static PagedList<FavoriteVideo> GetPagedFavoriteVideosByLoginName(string loginName, int pageIndex, int pageSize)
{
using(var db=new WebVODDataContext())
{
db.ObjectTrackingEnabled = false;
var dlo=new DataLoadOptions();
dlo.LoadWith<FavoriteVideo>(f=>f.Video);
dlo.LoadWith<Video>(v=>v.VideoCategory);
dlo.LoadWith<Video>(v=>v.Album);
db.LoadOptions = dlo;
return db.FavoriteVideos.Where(f => f.LoginName == loginName).OrderByDescending(f=>f.DateAdded).ToPagedList(pageIndex, pageSize);
}
}