コード例 #1
0
 void OnFetchPage(System.Object sender, DevExpress.Xpf.Data.FetchPageAsyncEventArgs e)
 {
     e.Result = Task.Run <DevExpress.Xpf.Data.FetchRowsResult>(() =>
     {
         const int pageTakeCount = 5;
         using (var session = new DevExpress.Xpo.Session()) {
             var queryable = session.Query <XPOIssues.Issues.Issue>().SortBy(e.SortOrder, defaultUniqueSortPropertyName: nameof(XPOIssues.Issues.Issue.Oid)).Where(MakeFilterExpression((DevExpress.Data.Filtering.CriteriaOperator)e.Filter));
             var items     = queryable.Skip(e.Skip).Take(e.Take * pageTakeCount).ToArray();
             return(_DetachedObjectsHelper.ConvertToDetachedObjects(items));
         }
     });
 }
        void OnFetchPage(System.Object sender, DevExpress.Xpf.Data.FetchPageAsyncEventArgs e)
        {
            const int pageTakeCount = 5;

            e.Result = Task.Run <DevExpress.Xpf.Data.FetchRowsResult>(() =>
            {
                var context   = new EntityFrameworkIssues.Issues.IssuesContext();
                var queryable = context.Issues.AsNoTracking()
                                .SortBy(e.SortOrder, defaultUniqueSortPropertyName: nameof(EntityFrameworkIssues.Issues.Issue.Id))
                                .Where(MakeFilterExpression(e.Filter));
                return(queryable.Skip(e.Skip).Take(e.Take * pageTakeCount).ToArray());
            });
        }