{"id":23567129,"url":"https://github.com/godeltech/godeltech.database.entityframeworkcore","last_synced_at":"2025-04-30T19:40:45.204Z","repository":{"id":42366980,"uuid":"295150336","full_name":"GodelTech/GodelTech.Database.EntityFrameworkCore","owner":"GodelTech","description":"Library to work with database, apply migrations and data using Entity Framework Core","archived":false,"fork":false,"pushed_at":"2024-12-27T16:08:09.000Z","size":134,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-11T20:19:44.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GodelTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-09-13T12:50:05.000Z","updated_at":"2024-12-27T15:59:41.000Z","dependencies_parsed_at":"2024-01-17T15:05:37.554Z","dependency_job_id":null,"html_url":"https://github.com/GodelTech/GodelTech.Database.EntityFrameworkCore","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GodelTech%2FGodelTech.Database.EntityFrameworkCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GodelTech%2FGodelTech.Database.EntityFrameworkCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GodelTech%2FGodelTech.Database.EntityFrameworkCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GodelTech%2FGodelTech.Database.EntityFrameworkCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GodelTech","download_url":"https://codeload.github.com/GodelTech/GodelTech.Database.EntityFrameworkCore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251770930,"owners_count":21641176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T18:19:04.326Z","updated_at":"2025-04-30T19:40:45.199Z","avatar_url":"https://github.com/GodelTech.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GodelTech.Database.EntityFrameworkCore\n\n# Description\nGodelTech.Database.EntityFrameworkCore is a .NET library designed to work with databases, apply migrations, and manage data using Entity Framework Core. It simplifies the process of creating console applications with database migrations and data operations.\n\n## Overview\n\nUsing this library you can create console app with database migrations and data.\n\n`DatabaseService.cs`\n```csharp\npublic class DatabaseService : DatabaseServiceBase\n{\n    public DatabaseService(\n        BaseContext baseContext,\n        WeatherContext weatherContext,\n        IHostEnvironment hostEnvironment,\n        ILogger\u003cDatabaseService\u003e logger)\n        : base(logger, baseContext, weatherContext)\n    {\n        RegisterDataService(\n            new DataService\u003cWeatherEntity, Guid\u003e(\n                new ConfigurationBuilder(),\n                hostEnvironment,\n                @\"Data\\Weather\",\n                weatherContext,\n                false,\n                x =\u003e x.Id,\n                logger\n            )\n        );\n    }\n}\n```\n\n`Worker.cs`\n```csharp\npublic class Worker : BackgroundService\n{\n    private readonly IServiceProvider _serviceProvider;\n    private readonly ILogger\u003cWorker\u003e _logger;\n\n    public Worker(IServiceProvider serviceProvider, ILogger\u003cWorker\u003e logger)\n    {\n        _serviceProvider = serviceProvider;\n        _logger = logger;\n    }\n\n    private static readonly Action\u003cILogger, Exception\u003e LogExecuteAsyncApplyDatabaseMigrationsInformation =\n        LoggerMessage.Define(\n            LogLevel.Information,\n            new EventId(0, nameof(ExecuteAsync)),\n            \"Apply database migrations\"\n        );\n\n    private static readonly Action\u003cILogger, Exception\u003e LogExecuteAsyncApplyDatabaseDataInformation =\n        LoggerMessage.Define(\n            LogLevel.Information,\n            new EventId(0, nameof(ExecuteAsync)),\n            \"Apply database data\"\n        );\n\n    protected override async Task ExecuteAsync(CancellationToken stoppingToken)\n    {\n        using var scope = _serviceProvider.CreateScope();\n        var databaseService = scope.ServiceProvider.GetRequiredService\u003cDatabaseService\u003e();\n\n        LogExecuteAsyncApplyDatabaseMigrationsInformation(_logger, null);\n        await databaseService.ApplyMigrationsAsync();\n\n        LogExecuteAsyncApplyDatabaseDataInformation(_logger, null);\n        await databaseService.ApplyDataAsync();\n    }\n}\n```\n\n# License\nThis project is licensed under the MIT License. See the LICENSE file for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgodeltech%2Fgodeltech.database.entityframeworkcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgodeltech%2Fgodeltech.database.entityframeworkcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgodeltech%2Fgodeltech.database.entityframeworkcore/lists"}