GodelTech.Database.EntityFrameworkCore
8.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
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.26)
- Microsoft.Extensions.Hosting (>= 8.0.0)
-
net7.0
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.15)
- Microsoft.Extensions.Hosting (>= 8.0.0)
-
net8.0
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.1)
- 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 | 107 | 7/1/2024 | |
8.0.0 | 155 | 1/17/2024 | |
7.0.0 | 348 | 9/13/2023 | |
6.5.0 | 571 | 11/1/2022 | |
6.4.0 | 382 | 10/16/2022 | |
6.2.0 | 482 | 7/15/2022 | |
6.1.1 | 429 | 7/6/2022 | |
6.1.0 | 750 | 4/8/2022 | |
6.0.0 | 569 | 4/4/2022 | |
5.0.0 | 365 | 8/17/2021 | |
1.1.1 | 1,032 | 10/20/2020 | |
1.1.0 | 736 | 10/4/2020 | |
1.0.2 | 432 | 9/29/2020 | |
1.0.1 | 418 | 9/26/2020 | |
1.0.0 | 423 | 9/25/2020 | |
1.0.0-rc.4 | 288 | 9/25/2020 | |
1.0.0-rc.3 | 295 | 9/13/2020 | |
1.0.0-rc.2 | 285 | 9/13/2020 | |
1.0.0-rc.1 | 408 | 9/13/2020 |