I have a website that I’ve previously built as a personal/learning project in ASP.NET Webforms (up to 4.8) and I’m trying to convert it to ASP.NET Core 8.0 as my first project. This project has a fair bit of complex logic e.g. SQL Server stored procedures that retrieve data from multiple tables that I’ve previously retrieved as datasets and displayed on the site accordingly.
This is where I get stuck on my new site. Because of those stored procedures, I tried to use both SqlServer.Data.SqlClient
and Microsoft.Data.SqlClient
to try and retrieve the data and store it to a dataset, which I then take and convert to my corresponding class(es) from there. The issue is in the retrieval portion; using System.Diagnostics.Stopwatch
, I’ve been able to isolate the bottlenecks to the initial opening of the connection and the loading of the data into a dataset or datatable (I tried this with both SqlDataAdapter
and SqlDataReader
). In some cases, the connection opening is 30-35% of the time elapsed with another 55-60% being associated with the loading of the data.
From what little I can gather, it seems to be an overall issue with ASP.NET Core 8.0, but it’s not clear what issue it is and how to resolve it. Is it in the various Data.SqlClient
namespaces somewhere? Does it have anything to do with the connection string (as in are there new ones that make better use of ASP.NET Core?) What am I looking for in order to diagnose/solve this?
10