We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

.Net Core 3.0 search problem

After upgrading my project to .net core 3.0, I'm having some problems with seraching the grid.

This is the grid:


And when I try to search something:



The error is:



This must be related to the json.net new things in .net core 3.0, but how can I solve this?

Thanks!
Bernard.

8 Replies

PS Pavithra Subramaniyam Syncfusion Team October 1, 2019 11:26 AM UTC

Hi Bernard, 
 
Greetings from Syncfusion. 
 
We have validated your query and checked the reported problem at our end by preparing a sample based on your requirement. But It works fine. Refer the below code snippets and sample for your reference. 
 
[code snippets] 
public class HomeController : Controller 
    { 
        OrderDataAccessLayer db = new OrderDataAccessLayer(); 
        public IActionResult UrlDatasource([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable<Order> DataSource = (from k in db.GetAllOrders().AsQueryable() where k.EmployeeID == 1 orderby k.CustomerID select k); 
            DataOperations operation = new DataOperations(); 
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                DataSource = operation.PerformSorting(DataSource, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); 
            } 
            int count = DataSource.Cast<Order>().Count(); 
            if (dm.Skip != 0) 
            { 
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging 
            } 
            if (dm.Take != 0) 
            { 
                DataSource = operation.PerformTake(DataSource, dm.Take); 
            } 
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
 
 
We suspect that this is general issue not from our side. Refer below links for information. 
 
 
Also could you please ensure your database side operations at your end. If you are still facing the problem, please reproduce the reported problem in the provided sample if possible. 
 
Regards, 
Pavithra S. 



BJ Bernard Jurlina October 5, 2019 07:54 AM UTC

Hi Pavithra!

Can you try with this modified example?
Thanks!

Bernard.

Attachment: WebApplication3_test_b489de65.zip


PS Pavithra Subramaniyam Syncfusion Team October 9, 2019 12:39 PM UTC

Hi Bernard, 
 
Thanks for the sample. 
 
We have validated the provided sample and checked with our end. The reported problem occurred because of type casting issue so we suggest you to convert as list to get the count.  
 
Please refer the below code example for more information. 
 
public class HomeController : Controller 
    { 
        OrderDataAccessLayer db = new OrderDataAccessLayer(); 
        public IActionResult UrlDatasource([FromBody]DataManagerRequest dm) 
        { 
            // Here we have converted dataSource as list to resolve the problem 
            IEnumerable<Order> DataSource = (from k in db.GetAllOrders().AsQueryable() where k.EmployeeID == 1 orderby k.CustomerID select k).ToList(); 
            DataOperations operation = new DataOperations(); 
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); 
            } 
            int count = DataSource.Cast<Order>().Count(); 
            if (dm.Skip != 0) 
            { 
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging 
            } 
            if (dm.Take != 0) 
            { 
                DataSource = operation.PerformTake(DataSource, dm.Take); 
            } 
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
 
 
 
Please get back to us if you need further assistance on this. 
 
Regards, 
Pavithra S. 



CK Christian Kogler October 27, 2019 05:59 PM UTC

Hi, 

We are facing the same problem. Entity Framework Core 3 now executes queries in the database - EF Core 2.x did it in memory (which was really a bad thing). Any search (e.g. with a search query) now leads to the mentioned problem.

IEnumerable DataSource = (from k in db.GetAllOrders().AsQueryable() where k.EmployeeID == 1 orderby k.CustomerID select k).ToList(); 
is not a satisfying solution, since for performance reason the following filtering and searching operations should also be executed on the database, not in memory(what acutally happens when you implement your proposed solution)

We identified a .ToString() (in your .PerformSearch() implementation) within a linq query as the source of the problem, and since we don't know if EF Core3 will soon be able to translate ToString(), it would be nice to have a patch for that behaviour.




BS Balaji Sekar Syncfusion Team October 29, 2019 10:44 AM UTC

Hi Christian, 

We have considered this as a usability feature improvement “Problem with DataOperations when bind IQueryable data to Grid”, and logged a task for the same. 
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
 
 
We have planned to implement this feature in our Volume 4, 2019 release. Until then we suggest you to bind List values to Grid to overcome the problem you are facing. 
 
Regards, 
Balaji S. 



FR Fabio Rosa December 16, 2019 08:03 PM UTC

Hi guys,

I have same problem here... using EJ1 with ASP .NET Core...
What is the status of this issue now? I would'nt change all of my application from IQueryable to IEnumerable... I've used IQueryable to performance reasons and I don't want do return to IEnumerable.... please consider solve this issue urgent....


LU luis December 17, 2019 08:53 PM UTC

This works for me in .net Core 3 …

 

allowPaging="true" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Search"})" actionComplete="actionComplete">

        <e-data-manager url="/Cargos/UrlDataSource" adaptor="UrlAdaptor" insertUrl="/Cargos/Insert" updateUrl="/Cargos/Update" removeUrl="/Cargos/Delete"></e-data-manager>

        <e-grid-searchsettings fields="@(new string[] { "Codigo","Nombre"})"></e-grid-searchsettings>

 

In controller file

public IActionResult UrlDataSource([FromBody]DataManagerRequest dm)

        {

            IEnumerable<CargoSet> DataSource = _context.CargoSet.OrderBy(o => o.Codigo).ToList();

            DataOperations operation = new DataOperations();

 

            if (dm.Search != null && dm.Search.Count > 0)

            {

                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search

            }

            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting

            {

                DataSource = operation.PerformSorting(DataSource, dm.Sorted);

            }

            if (dm.Where != null && dm.Where.Count > 0) //Filtering

            {

                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);

            }

            int count = DataSource.Cast<CargoSet>().Count();

            if (dm.Skip != 0)

            {

                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging

            }

            if (dm.Take != 0)

            {

                DataSource = operation.PerformTake(DataSource, dm.Take);

            }

            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);

        }

 

In Startup file

services.AddControllersWithViews().AddNewtonsoftJson(options =>

            {

                options.SerializerSettings.ContractResolver = new DefaultContractResolver();

            });

 

I hope it serves


PK Padmavathy Kamalanathan Syncfusion Team December 19, 2019 03:10 PM UTC

Hi Fabio, 
 
Thanks for your patience. 
 
QUERY: Issue in searching of grid 
 
We have prepared sample with IQueryable data and shared you here. We can be able to search and filter properly. Please check the below sample and video demo, 
 
 
 
 
If you have further queries, please get back to us. Please compare your code with the sample. Still facing the issue, please reproduce the issue in the above sample and share us (If possible) 
 
Regards, 
Padmavathy Kamalanathan 


Loader.
Live Chat Icon For mobile
Up arrow icon