I am using linq for nhibernate to query data from a large table. I am trying to limit my data request and get only the last 1000 rows and only then do filtering, sorting and pagin.
When I try to use .Take (), I got an error:
unable to locate HQL query plan in cache; generating (.Count[X4Data.Entity.IEventView](.OrderBy[X4Data.Entity.IEventView,System.DateTime](.Take[X4Data.Entity.IEventView](.Where[X4Data.Entity.IEventView](NHibernate.Linq.NhQueryable`1[X4Data.Entity.IEventView], Quote((x, ) => (Equal(x.DeviceId, p1))), ), p2, ), Quote((c5d4d87c-87ba-4e91-9652-bcdc87e3f0ba, ) => (c5d4d87c-87ba-4e91-9652-bcdc87e3f0ba.AtmTime)), ), ))
My code is:
query = query.Take(rowCount); query = query.ApplyFiltering(cmd, binder); query = query.ApplySorting(cmd, binder); binder.TotalCount = query.Count(); query = query.ApplyPaging(cmd);
Thank you very much and sorry for my bad english
AleGO source share