ReportSharp.DatabaseReporter 1.0.5

dotnet add package ReportSharp.DatabaseReporter --version 1.0.5                
NuGet\Install-Package ReportSharp.DatabaseReporter -Version 1.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ReportSharp.DatabaseReporter" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ReportSharp.DatabaseReporter --version 1.0.5                
#r "nuget: ReportSharp.DatabaseReporter, 1.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ReportSharp.DatabaseReporter as a Cake Addin
#addin nuget:?package=ReportSharp.DatabaseReporter&version=1.0.5

// Install ReportSharp.DatabaseReporter as a Cake Tool
#tool nuget:?package=ReportSharp.DatabaseReporter&version=1.0.5                

ReportSharp.DatabaseReporter-1.0.5:

Description:

DatabaseReporter for ReportSharp package

Dependencies:

ReportSharp 1.0.5 or later

dotnet-ef tool 3.1 or later

Dotnet Core 3.1 or later

Usage:

Note:

You need to install and configure ReportSharp 1.0.5 or later to use this package.

Dotnet 5 or below:

  1. Add following lines to ConfigureServices method in Startup class:
services.AddReportSharp(options => {
    options.ConfigReportSharp(configBuilder =>
        configBuilder.SetWatchdogPrefix("/")
    );
    var assemblyName = typeof(Startup).Assembly.GetName().Name;
    // For request reporter
    options.AddRequestReporter(() => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
        .SetOptionsBuilder(dbOptions => {
            dbOptions.UseNpgsql(
                Configuration.GetConnectionString("DefaultConnection"),
                sql => sql.MigrationsAssembly(assemblyName)
            );
        })
    );
    // For exception reporter
    options.AddExceptionReporter(() => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
        .SetOptionsBuilder(dbOptions => {
            dbOptions.UseNpgsql(
                Configuration.GetConnectionString("DefaultConnection"),
                sql => sql.MigrationsAssembly(assemblyName)
            );
        })
    );
    // For data reporter
    options.AddDataReporter(() => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
        .SetOptionsBuilder(dbOptions => {
            dbOptions.UseNpgsql(
                Configuration.GetConnectionString("DefaultConnection"),
                sql => sql.MigrationsAssembly(assemblyName)
            );
        })
    );
    // For request, exception and data reporters
    options.AddReporter<DatabaseReporter, DatabaseReportOptionsBuilder<ReportSharpDbContext>>(
        () => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
            .SetOptionsBuilder(dbOptions => {
                dbOptions.UseNpgsql(
                    Configuration.GetConnectionString("DefaultConnection"),
                    sql => sql.MigrationsAssembly(assemblyName)
                );
            })
    );
});
Note: if you want to it for all reporters, you can use only AddReporter method.
  1. Add following lines to Configure method in Startup class:
app.UseReportSharp(configure => {
    configure.UseReportSharpMiddleware<ReportSharpMiddleware>();
});
  1. Add ReportSharp migrations with following command in terminal:
dotnet ef migrations add ReportSharp -c ReportSharpDbContext
  1. Apply ReportSharp migration on the database with following command:
dotnet ef database update -c ReportSharpDbContext

Dotnet 6 or later:

  1. Add following lines to services section, before builder.Build() line:
services.AddReportSharp(options => {
    options.ConfigReportSharp(configBuilder =>
        configBuilder.SetWatchdogPrefix("/")
    );
    var assemblyName = typeof(Startup).Assembly.GetName().Name;
    // For request reporter
    options.AddRequestReporter(() => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
        .SetOptionsBuilder(dbOptions => {
            dbOptions.UseNpgsql(
                Configuration.GetConnectionString("DefaultConnection"),
                sql => sql.MigrationsAssembly(assemblyName)
            );
        })
    );
    // For exception reporter
    options.AddExceptionReporter(() => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
        .SetOptionsBuilder(dbOptions => {
            dbOptions.UseNpgsql(
                Configuration.GetConnectionString("DefaultConnection"),
                sql => sql.MigrationsAssembly(assemblyName)
            );
        })
    );
    // For data reporter
    options.AddDataReporter(() => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
        .SetOptionsBuilder(dbOptions => {
            dbOptions.UseNpgsql(
                Configuration.GetConnectionString("DefaultConnection"),
                sql => sql.MigrationsAssembly(assemblyName)
            );
        })
    );
    // For request, exception and data reporters
    options.AddReporter<DatabaseReporter, DatabaseReportOptionsBuilder<ReportSharpDbContext>>(
        () => new DatabaseReportOptionsBuilder<ReportSharpDbContext>()
            .SetOptionsBuilder(dbOptions => {
                dbOptions.UseNpgsql(
                    Configuration.GetConnectionString("DefaultConnection"),
                    sql => sql.MigrationsAssembly(assemblyName)
                );
            })
    );
});
Note: if you want to it for all reporters, you can use only AddReporter method.
  1. Add following lines to Configure section, somewhere after builder.Build() line and before app.Run() line:
app.UseReportSharp(configure => {
    configure.UseReportSharpMiddleware<ReportSharpMiddleware>();
});
  1. Add ReportSharp migrations with following command in terminal:
dotnet ef migrations add ReportSharp -c ReportSharpDbContext
  1. Apply ReportSharp migration on the database with following command:
dotnet ef database update -c ReportSharpDbContext

Donation:

If you like it, you can support me with USDT:
  1. TJ57yPBVwwK8rjWDxogkGJH1nF3TGPVq98 for USDT TRC20
  2. 0x743379201B80dA1CB680aC08F54b058Ac01346F1 for USDT ERC20
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ReportSharp.DatabaseReporter:

Package Downloads
ReportSharp.Api

Api for ReportSharp.DatabaseReporter of ReportSharp package

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 2,585 12/31/2021