How can I point all generated dataset schema connection string to use appsettings
default connection string in ASP.NET Core Razor pages?
Note: this works perfectly in ASP.NET Webforms and ASP.NET MVC, but not in ASP.NET Core with Razor pages.
Generated code from dataset Xsd Schema:
private void InitConnection()
{
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = "Data Source=(localdb)\\mssqllocaldb;Initial Catalog=mylocaldb;Integrated Security=True";
}
I want the connection string to point to the appsettings.json
default connection.
Thanks
Please click the link to view the Image: How can I override the InitConnection() at runtime. Note: this is actually a generated code by visual studio and everytime I update the dataset it will automatically reset back to default so I can't use change the code.