Skip to content

Migrate v2 = v3

Matteo Gregoricchio edited this page May 7, 2024 · 5 revisions

Namespaces migration

v3 changed many namespaces to their correct repository folders structure.

If you find your old methods not imported, please import correct namespaces (majority will be either under [Serilog.UI.{Provider}.Extensions] or Serilog.UI.Core.{Folder}).

Change Providers extensions methods to use Fluent interface

All available providers can be registered in Serilog UI with an Use[...] extension method, exposed on ISerilogUiOptionsBuilder.

In v2, each provider exposed a number of parameters directly on its extension method:

// example: mssql provider
services.AddSerilogUi(options => options.UseSqlServer(param1, param2, param3));

In v3, to prevent these methods from adding too many parameters and to prepare for future developments, the registration MUST be migrated to fluent interfaces. Each Use[...] method now exposes an Action, that the user can use to set the configuration data.

// example: mssql provider
services.AddSerilogUi(options => 
  options.UseSqlServer(options => options
    .WithConnectionString("example")
    .WithTable("table")
));

For the complete list of providers API, please check this page.

Move UseSerilogUi Action configuration to fluent interface

UiOptions can now be configured only with fluent interface methods.

Move old configurations to fluent interface (all details here).

Move Authorization filters to .NET DI Registration

Authorization filters are now registered through Dependency Injection.

Move the creation of filters (new Filter(...)) to using extensions methods on IServiceProvider. All nfo can be found here.