Как использовать Kendo.DynamicLinqCore для доступа к очень большому набору данных - PullRequest
0 голосов
/ 11 мая 2019

Он загружает все данные одновременно, и мне приходится каждый раз убивать страницу.Любая помощь приветствуется.Ниже приведен мой код без параметра take, skip.

 public class StudentController : Controller
     {
        private read-only IStudentService _studentService;


        public StudentController(IStudentService studentService)
        {
            _studentService = studentService;
        }


        public IActionResult Index()
        {
            return View();
        }



public IActionResult Read([DataSourceRequest] DataSourceRequest request)
 {
      //How to use the DynamiclinqCore here 
       // GetAll retuns billions of records

      return Json(_studentService.GetAll().ToDataSourceResult(request));

  }     


 }

View:

Ниже приводится мой взгляд.Любая помощь приветствуется.Он извлекает все данные одновременно, и мне приходится каждый раз убивать страницу.Любая помощь приветствуется.Ниже приведен мой код без параметра take, skip.


<script>

    $(function() {
        $("#grid").kendoGrid({
            dataSource: {
                transport: {
                    read: {
                        url: "@Url.Action("Read", "Student")",
                        dataType: 'json',
                        contentType: "application/json",
                        type: "POST"
                    },
                    parameterMap: function (data, options) {
                        debugger;
                        return JSON.stringify(options);
                    }
                },
                schema: {
                    data: "Data",
                    total: "Total",
                    model: {
                        id: "StudentID",
                        fields: {
                            StudentID: { editable: false, nullable: true },
                            StudentName: { editable: false },
                            ParentID: { editable: false }
                        }
                    }
                },
                pageSize: 1000,
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true
            },
            filterable: true,
            sortable: true,
            pageable: true,
            height: 500,
            columns: [
                { field: "StudentID", width: "150px" },
                { field: "StudentName", width: "250px" },
                { field: "ParentID", width: "250px" }
            ]
        });

    });

</script>
<div id="grid"></div>

Вот мой сервис

 public class StudentService : IStudentService
    {
        private readonly CBDBDataContext _context;

        public StudentService(CBDBDataContext context)
        {
            _context = context;
        }

        public IEnumerable<Student> GetAll()
        {
            return _context.Students.ToList();
        }
    }
...