{"id":29828161,"url":"https://github.com/feedboards/entityframeworkcore.utils","last_synced_at":"2026-02-14T13:03:13.268Z","repository":{"id":305829156,"uuid":"857352393","full_name":"feedboards/EntityFrameworkCore.Utils","owner":"feedboards","description":"A library aimed at simplifying standard CRUD operations for Entity Framework Core","archived":false,"fork":false,"pushed_at":"2025-03-20T13:37:58.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2025-11-09T22:06:21.580Z","etag":null,"topics":["clouds-dotnet","dotnet","dotnet-7","dotnet-8","dotnet7","dotnet8","efcore","entity-framework","nuget","nuget-package"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/EntityFrameworkCore.Utils","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/feedboards.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-14T12:32:55.000Z","updated_at":"2025-03-20T13:38:03.000Z","dependencies_parsed_at":"2025-07-22T08:42:01.553Z","dependency_job_id":"f235bf30-fbeb-4e45-9696-4345c8e6a2e0","html_url":"https://github.com/feedboards/EntityFrameworkCore.Utils","commit_stats":null,"previous_names":["feedboards/entityframeworkcore.utils"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/feedboards/EntityFrameworkCore.Utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedboards%2FEntityFrameworkCore.Utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedboards%2FEntityFrameworkCore.Utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedboards%2FEntityFrameworkCore.Utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedboards%2FEntityFrameworkCore.Utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feedboards","download_url":"https://codeload.github.com/feedboards/EntityFrameworkCore.Utils/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedboards%2FEntityFrameworkCore.Utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29444060,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T12:43:28.304Z","status":"ssl_error","status_checked_at":"2026-02-14T12:43:14.160Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["clouds-dotnet","dotnet","dotnet-7","dotnet-8","dotnet7","dotnet8","efcore","entity-framework","nuget","nuget-package"],"created_at":"2025-07-29T07:40:37.712Z","updated_at":"2026-02-14T13:03:13.263Z","avatar_url":"https://github.com/feedboards.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Documentation\n\n\u003e [!IMPORTANT]\n\u003e Make sure that `Middleware` has been added\n\u003e\n\u003e [Add `Middleware`](#add-middleware-into-api)\n\n# Overview\n\n## CRUDController\n\n\u003e [!NOTE]\n\u003e The default `Id` type is `Guid` \n\n- `GetAsync()`: get all data.\n- `GetByIdAsync(TId id)`: get one object by id.\n\n- `ExecuteSqlAsync([FromBody] ExecuteSqlRequestDto obj)`: run sql command.\n\n- `InsertAsync([FromBody] TRequestDto obj)`: insert one object.\n- `InsertAsync([FromBody] List\u003cTRequestDto\u003e obj)`: insert many objects.\n\n- `UpdateAsync([FromBody] TRequestDto obj)`: update one object.\n- `UpdateAsync([FromBody] List\u003cTRequestDto\u003e obj)`: update many objects\n\n- `DeleteAsync(TId id)`: delete one object by id.\n- `DeleteAsync([FromBody] List\u003cTId\u003e ids)`: delete many objects by ids\n\n- `SoftDeleteAsync(TId id)`: GPT: MAKE HERE DELCRIPTION OF THE METHOD\n- `SoftDeleteAsync([FromBody] List\u003cTId\u003e id)`: GPT: MAKE HERE DELCRIPTION OF THE METHOD\n\n## CRUDService\n\n\u003e [!NOTE]\n\u003e The default `Id` type is `Guid` \n\n- `GetAsync()`: get all data.\n- `GetByIdAsync(TId id)`: get one object by id.\n\n- `ExecuteSqlAsync([FromBody] ExecuteSqlRequestDto obj)`: run sql command.\n\n- `InsertAsync([FromBody] TRequestDto obj)`: insert one object.\n- `InsertAsync([FromBody] List\u003cTRequestDto\u003e obj)`: insert many objects.\n\n- `UpdateAsync([FromBody] TRequestDto obj)`: update one object.\n- `UpdateAsync([FromBody] List\u003cTRequestDto\u003e obj)`: update many objects\n\n- `DeleteAsync(TId id)`: delete one object by id.\n- `DeleteAsync([FromBody] List\u003cTId\u003e ids)`: delete many objects by ids\n\n- `SoftDeleteAsync(TId id)`: GPT: MAKE HERE DELCRIPTION OF THE METHOD\n- `SoftDeleteAsync([FromBody] List\u003cTId\u003e id)`: GPT: MAKE HERE DELCRIPTION OF THE METHOD\n\n# How to add `EntityFrameworkCore.Utils` to the project\n\nHere’s a step-by-step guide on how to add `EntityFrameworkCore.Utils`\n\n## installation\n\n```\ndotnet add package Clouds.Net.AWS\n```\n\n# Example Usage\n\n## CRUDController\n\n`Controllers/YOUR_CONTOLLER_NAME`\n\n```cs\nusing Utils.EF.Controllers;\nusing Utils.EF.Interfaces;\n\nnamespace PROJECT_NAME.API.Controllers\n{\n    public class YOUR_CONTOLLER_NAME : CRUDController\u003cRESPONSE_TYPE, REQUEST_TYPE\u003e\n    {\n        public YOUR_CONTOLLER_NAME(ICRUDService\u003cRESPONSE_TYPE, REQUEST_TYPE\u003e service) : base(service)\n        {\n        }\n\n        // Here is your code\n    }\n}\n```\n\nAlso, you can use your Id type\n\n```cs\nusing Utils.EF.Controllers;\nusing Utils.EF.Interfaces;\n\nnamespace PROJECT_NAME.API.Controllers\n{\n    public class YOUR_CONTOLLER_NAME : CRUDController\u003cYOUR_ID_TYPE, RESPONSE_TYPE, REQUEST_TYPE\u003e\n    {\n        public YOUR_CONTOLLER_NAME(ICRUDService\u003cYOUR_ID_TYPE, RESPONSE_TYPE, REQUEST_TYPE\u003e service) : base(service)\n        {\n        }\n\n        // Here is your code\n    }\n}\n```\n\n## CRUDService\n\nThere're protected fields\n\n- `_mapper` AutoMapper\n- `_context` Your database context\n- `_table` the table which has been found for your TModel type. You can use it to make CRUD operation in your service\n\n```c#\nusing Utils.EF.Interfaces;\n\nnamespace PROJECT_NAME\n{\n    public static class DI\n    {\n        public static IServiceCollection AddServices(this IServiceCollection services)\n        {\n            services.AddTransient\u003cICRUDService\u003cRESPONSE_TYPE, REQUEST_TYPE\u003e, CRUDService\u003cRESPONSE_TYPE, REQUEST_TYPE\u003e\u003e();\n\n            // Here are other injections\n\n            return services;\n        }\n    }\n}\n```\n\n## How to add the CRUDService in DI\n\n`DI.cs`\n\nAlso, you can use your Id type\n\n```c#\nusing Utils.EF.Interfaces;\nusing Utils.EF.Services;\n\nnamespace PROJECT_NAME\n{\n    public static class DI\n    {\n        public static IServiceCollection AddServices(this IServiceCollection services)\n        {\n            services.AddTransient\u003cICRUDService\u003cYOUR_ID_TYPE, RESPONSE_TYPE, REQUEST_TYPE\u003e, CRUDService\u003cYOUR_ID_TYPE, RESPONSE_TYPE, REQUEST_TYPE\u003e\u003e();\n\n            // Here are other injections\n\n            return services;\n        }\n    }\n}\n```\n\n## How to create your own service based on the CRUDService\n\n`Services/YOUR_SERVICE_NAME.cs`\n\n```c#\nusing Utils.EF.Services;\n\nnamespace PROJECT_NAME\n{\n    public class Service : CRUDService\u003cRESPONSE_TYPE, REQUEST_TYPE\u003e\n    {\n        public Service(IMapper mapper, DB_CONTEXT context) : base(mapper, context)\n        {\n        }\n\n        // Here is your code\n    }\n}\n```\n\nAlso, you can use your Id type\n\n```c#\nusing Utils.EF.Services;\n\nnamespace PROJECT_NAME\n{\n    public class Service : CRUDService\u003cYOUR_ID_TYPE, RESPONSE_TYPE, REQUEST_TYPE\u003e\n    {\n        public Service(IMapper mapper, DB_CONTEXT context) : base(mapper, context)\n        {\n        }\n\n        // Here is your code\n    }\n}\n```\n\n## Add `Middleware` into API\n\n`Middleware/ErrorHandlerMiddleware.cs`\n\n```c#\nusing System.Net;\n\nnamespace PROJECT_NAME.API.Middleware\n{\n    public class ErrorHandlerMiddleware\n    {\n        private readonly RequestDelegate _next;\n\n        public ErrorHandlerMiddleware(RequestDelegate next)\n        {\n            _next = next;\n        }\n\n        public async Task Invoke(HttpContext context)\n        {\n            try\n            {\n                await _next(context);\n            }\n            catch (Exception ex)\n            {\n                await HandleExceptionAsync(context, ex);\n            }\n        }\n\n        private static async Task HandleExceptionAsync(HttpContext context, Exception exception)\n        {\n            context.Response.ContentType = \"application/json\";\n            context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;\n\n            var result = System.Text.Json.JsonSerializer.Serialize(new\n            {\n                error = new\n                {\n                    message = \"An unexpected error occurred.\",\n                    detailed = exception.Message\n                }\n            });\n\n            await context.Response.WriteAsync(result);\n        }\n    }\n}\n```\n\n## Use `ErrorHandlerMiddleware`\n\n`Program.cs`\n\n```c#\napp.UseMiddleware\u003cErrorHandlerMiddleware\u003e();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeedboards%2Fentityframeworkcore.utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeedboards%2Fentityframeworkcore.utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeedboards%2Fentityframeworkcore.utils/lists"}