GodelTech.Database.EntityFrameworkCore 8.0.0

dotnet add package GodelTech.Database.EntityFrameworkCore --version 8.0.0
NuGet\Install-Package GodelTech.Database.EntityFrameworkCore -Version 8.0.0
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="GodelTech.Database.EntityFrameworkCore" Version="8.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GodelTech.Database.EntityFrameworkCore --version 8.0.0
#r "nuget: GodelTech.Database.EntityFrameworkCore, 8.0.0"
#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 GodelTech.Database.EntityFrameworkCore as a Cake Addin
#addin nuget:?package=GodelTech.Database.EntityFrameworkCore&version=8.0.0

// Install GodelTech.Database.EntityFrameworkCore as a Cake Tool
#tool nuget:?package=GodelTech.Database.EntityFrameworkCore&version=8.0.0

GodelTech.Database.EntityFrameworkCore

Library to work with database, apply migrations and data using Entity Framework Core

Overview

Using this library you can create console app with database migrations and data.

DatabaseService.cs

public class DatabaseService : DatabaseServiceBase
{
    public DatabaseService(
        BaseContext baseContext,
        WeatherContext weatherContext,
        IHostEnvironment hostEnvironment,
        ILogger<DatabaseService> logger)
        : base(logger, baseContext, weatherContext)
    {
        RegisterDataService(
            new DataService<WeatherEntity, Guid>(
                new ConfigurationBuilder(),
                hostEnvironment,
                @"Data\Weather",
                weatherContext,
                false,
                x => x.Id,
                logger
            )
        );
    }
}

Worker.cs

public class Worker : BackgroundService
{
    private readonly IServiceProvider _serviceProvider;
    private readonly ILogger<Worker> _logger;

    public Worker(IServiceProvider serviceProvider, ILogger<Worker> logger)
    {
        _serviceProvider = serviceProvider;
        _logger = logger;
    }

    private static readonly Action<ILogger, Exception> LogExecuteAsyncApplyDatabaseMigrationsInformation =
        LoggerMessage.Define(
            LogLevel.Information,
            new EventId(0, nameof(ExecuteAsync)),
            "Apply database migrations"
        );

    private static readonly Action<ILogger, Exception> LogExecuteAsyncApplyDatabaseDataInformation =
        LoggerMessage.Define(
            LogLevel.Information,
            new EventId(0, nameof(ExecuteAsync)),
            "Apply database data"
        );

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        using var scope = _serviceProvider.CreateScope();
        var databaseService = scope.ServiceProvider.GetRequiredService<DatabaseService>();

        LogExecuteAsyncApplyDatabaseMigrationsInformation(_logger, null);
        await databaseService.ApplyMigrationsAsync();

        LogExecuteAsyncApplyDatabaseDataInformation(_logger, null);
        await databaseService.ApplyDataAsync();
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 101 1/17/2024
7.0.0 220 9/13/2023
6.5.0 545 11/1/2022
6.4.0 356 10/16/2022
6.2.0 451 7/15/2022
6.1.1 400 7/6/2022
6.1.0 671 4/8/2022
6.0.0 538 4/4/2022
5.0.0 350 8/17/2021
1.1.1 939 10/20/2020
1.1.0 647 10/4/2020
1.0.2 407 9/29/2020
1.0.1 402 9/26/2020
1.0.0 392 9/25/2020
1.0.0-rc.4 274 9/25/2020
1.0.0-rc.3 282 9/13/2020
1.0.0-rc.2 273 9/13/2020
1.0.0-rc.1 394 9/13/2020