English 中文(简体)
如果I m不使用LINQ的电荷装载,从我的模型中回去pList <T”是否有意义?
原标题:Does it make sense to return PageList<T> from my Model if I m not using LINQ s lazy loading?

Im在协会撰写的矿址信息系统上工作。 NET MVC。 现在,我试图用讽刺眼镜/字眼抹黑。

I vepind onto Rob Connery s PagedList<T>, 似乎就该问题而言是个冰箱解决办法。

然而,我的使用案例和Rob s之间的一个区别是,我不从我的《模式》中收回可证明的教益,我与ToList(在他们(当时返回一个可计算的数字)之后提出的所有问询,以确保在《示范方法》采用时,我的质问。

由于这一差异,使用其<代码>仍然有意义。 页: 1 我基本上只想归还总结果的一小部分,以及其他一些财产,如“HasNextPage”、“Totalcount”等。

然而,由于我不想让这名德高尚的阶级直接叫上IQueryable,我很想知道,我是否应该像我所希望的那样,建立自己的基本类别?

我知道如何利用准则得出特定成果:

public IEnumerable<Entities.Message> GetInboxMessages(int userID, int pageSize, int pageIndex)
{
     using (MainDataContext db = new MainDataContext())
     {
         var messages = (from m in db.Messages
                         join o in db.MessageRecipients on m.MessageID equals o.MessageID
                         orderby m.DateSent
                         select new Entities.Message
                         {
                            // ... 

                          }).Skip(pageIndex * pageSize).Take(pageSize).ToList();

          return messages;
      }
  }

但如果没有其他信息,我需要有关NextPage、NoutItemsCount等的资料。

我在这种情况下应该做些什么? Can 我仍然使用上述<代码>PagedList<T>,尽管我没有制定拉齐·洛达宁计划? 我是否应该建立自己?

问题回答

你们仍然能够使用英文版。 体面的支持只是其中的一部分,所有其他的轨道都将被罚款。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签