I cannot get pastJsonSerializationExceptions when using ef core entities that have cirular references or self references to which many of my models do. I have placed the following line in my startup but this has no effect for syncfusion controls:
There are some other solutions like adding [JsonIgnore] to these properties work but this is unworkable because I use database first and often scaffold which removes the attributes. I have also tried usingMetadataType attribute to adorn these properties with [JsonIgnore] but I get a runtime error when doing so indicating that System.ComponentModel.DataAnnotations cannot be loaded. I have also tried ModelMetadataType but that did not work and I don't like the idea of referencing Asp.NetCore in my entity library just to add this attribute.
The only other option would be to create new classes but I would need to pretty much duplicate my whole model and then updating the model I would need to copy the data from the classes to the model classes. This is a lot of work just to get around Json serialisation errors. Is there a possibility of setting an option in the syncfusion library to ignore ReferenceLoopHandling?
MSMadhu Sudhanan P Syncfusion Team December 13, 2018 07:20 AM
Thanks for contacting Syncfusion support.
Currently we cannot provide serialization settings to the serialization used by EJ2 controls. Using ViewModel concept is the one of the recommended solution to avoid this exception. Also for updating the entity there is no need to use the ViewModel instead you can simply use the original entity class. If you have faced any difficulties in updating please let us know we will be help you out.
Madhu Sudhanan P
KHKarl Heinz BrehmeMay 14, 2019 09:51 PM
Hi, is really annoying to have all database in my hand with Context, and simply do a query object with Linq on EntityFramework and I can't bind the result on a grid showing fields from many objects like a normal database query, because we have to build a new class just to show data on a grid and repeat code...
I think Syncfusion could do something to make this more clean in this matter.
HJHariharan J V Syncfusion Team May 22, 2019 11:19 AM
Greetings from Syncfusion,
Currently we do not have support to achieve your requirement “Serialization support for datasource object in ASP.NET Core “ but we have logged a feature request on this and it can be tracked through our feedback portal below.