Grid infinite loading on EFCore Circular refecences

Hi, 

My team is using EF Core and Syncfusion 18.1.0.44 and when trying to use a model with circular references, the Grid component displays a loading and is frozen.

public class Car {
     public int Id { get; set; }
     public ICollection<CarPart> CarParts { get; set; }
}

public class CarPart {
     public int Id { get; set; }
     public int CarId { get; set; }
     public Car Car { get; set; }
}

We are using a model like this and the table receives the data as List<Car> through a custom adaptor implemented from this example: https://blazor.syncfusion.com/demos/datagrid/custom-binding?theme=material

If we remove the CarParts property from Car, the table works as expected, but we need the property to be there.

Unfortunately, we cannot share the code in our project so let me know if this example is enough or if you require a demo application and I can provide it.

Thank you,
Nicu

1 Reply

VN Vignesh Natarajan Syncfusion Team April 17, 2020 02:29 PM UTC

Hi Nicu,  
 
Greetings from Syncfusion support.  
 
Query:  My team is using EF Core and Syncfusion 18.1.0.44 and when trying to use a model with circular references, the Grid component displays a loading and is frozen. 
 
We have analyzed your query and we suggest you to use JsonIgnore property to CarParts property of Car class to overcome the reported issue. Refer the below code example.  
 
@page "/" 
@using Syncfusion.Blazor.Grids 
@using Newtonsoft.Json 
 
@code{ 
    public List<EmployeeData> Employees { getset; } 
    public class Car 
    { 
        public int Id { getset; } 
        [JsonIgnore] 
        public ICollection<CarPart> CarParts { getset; } 
    } 
  
    public class CarPart 
    { 
        public int Id { getset; } 
        public int CarId { getset; } 
        public Car Car { getset; } 
    } 
    
} 
 
 
If you are still facing the issue, kindly share the demo application to validate the reported issue further at our end   
 
Regards, 
Vignesh Natarajan  
 


Loader.
Up arrow icon