GodelTech.Database.EntityFrameworkCore
8.1.0
dotnet add package GodelTech.Database.EntityFrameworkCore --version 8.1.0
NuGet\Install-Package GodelTech.Database.EntityFrameworkCore -Version 8.1.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.1.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.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GodelTech.Database.EntityFrameworkCore, 8.1.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.1.0 // Install GodelTech.Database.EntityFrameworkCore as a Cake Tool #tool nuget:?package=GodelTech.Database.EntityFrameworkCore&version=8.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
net6.0
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.31)
- Microsoft.Extensions.Hosting (>= 8.0.0)
-
net7.0
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.20)
- Microsoft.Extensions.Hosting (>= 8.0.0)
-
net8.0
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.6)
- Microsoft.Extensions.Hosting (>= 8.0.0)
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.1.0 | 99 | 7/1/2024 | |
8.0.0 | 150 | 1/17/2024 | |
7.0.0 | 333 | 9/13/2023 | |
6.5.0 | 566 | 11/1/2022 | |
6.4.0 | 377 | 10/16/2022 | |
6.2.0 | 477 | 7/15/2022 | |
6.1.1 | 424 | 7/6/2022 | |
6.1.0 | 735 | 4/8/2022 | |
6.0.0 | 564 | 4/4/2022 | |
5.0.0 | 360 | 8/17/2021 | |
1.1.1 | 1,017 | 10/20/2020 | |
1.1.0 | 721 | 10/4/2020 | |
1.0.2 | 427 | 9/29/2020 | |
1.0.1 | 413 | 9/26/2020 | |
1.0.0 | 418 | 9/25/2020 | |
1.0.0-rc.4 | 283 | 9/25/2020 | |
1.0.0-rc.3 | 292 | 9/13/2020 | |
1.0.0-rc.2 | 282 | 9/13/2020 | |
1.0.0-rc.1 | 403 | 9/13/2020 |