serilog-sinks-mssqlserver icon indicating copy to clipboard operation
serilog-sinks-mssqlserver copied to clipboard

[Question] ConnectionString in .NET Framework

Open novelhawk opened this issue 3 years ago • 0 comments

Bug Report / Support Request Template

Hello, I'm trying to port my .NET Core project's Serilog configuration to another project that targets .NET Framework. I was wondering if it was possible to load the connection strings from the project's XML configuration (from MSSql's XML or JSON configuration).

Ideally I would like to have the connection strings where they are and refer to them with their name.

I would be willing to port the complete XML project configuration to appsettings.json but it doesn't seem possible.

Code to load the configuration right now:

var configuration = new ConfigurationBuilder()
    .AddJsonFile("Config/Log.json")
    .Build();

Log.Logger = new LoggerConfiguration()
    .ReadFrom.Configuration(configuration)
    .CreateLogger();

List the names and versions of all Serilog packages used in the project:

  • Serilog: 2.11.0
  • Serilog.Sinks.MSSqlServer: 5.7.0

Target framework and operating system:

[ ] .NET Core 6 [ ] .NET Core 3.1 [ ] .NET Framework 4.8 [X] .NET Framework 4.7.x [ ] .NET Framework 4.6.x [ ] .NET Framework 4.5.x OS: Windows 10

novelhawk avatar May 05 '22 14:05 novelhawk