Using DataTables-Editor-Server with DotNet Core 3.1
Using DataTables-Editor-Server with DotNet Core 3.1
For anyone that may run into this: I was upgrading my project that uses the Editor Server DLL to handle the data feed for DataTables from DotNet Core 2.2 to 3.1. After the upgrade I was not able to get any data from the ActionResult even though the DLL itself was retrieving data.
The solution was to add a Newtonsoft Json handler and configuring it in startup.cs:
First add the NuGet package:
Install-Package Microsoft.AspNetCore.Mvc.NewtonsoftJson
Then add this to startup.cs
services.AddControllersWithViews()
.AddNewtonsoftJson(o =>
o.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize);
I hope this helps someone
This discussion has been closed.
Replies
Here are the full steps to recreate using an MSSQL database:
Once project is setup, install the following NuGet packages using the Package Manager Console:
- Install-Package DataTables-Editor-Server
- Install-Package System.Data.SqlClient
- Install-Package Microsoft.AspNetCore.Mvc.NewtonsoftJson
Edit Program.cs to add this line before CreateHostBuilder in the Main function
Add a using for the Data.SqlClient and Data.Common
Edit Startup.cs to modify the line that configures the AddControllersWithViews service
Also add a using for Datatables
Finally, add a new ActionResult to the Home controller:
Many thanks for posting this! Our newer example projects have this, for exactly this reason, but you are right, anyone upgrading from .NET Core 2 or before to 3 will need to take similar steps due to how the JSON libraries are now referenced.
Regards,
Allan