{"id":18310048,"url":"https://github.com/wilsonsergio2500/efturbo","last_synced_at":"2026-07-07T00:31:27.322Z","repository":{"id":178179222,"uuid":"661455099","full_name":"wilsonsergio2500/efTurbo","owner":"wilsonsergio2500","description":"EF Repository Pattern Library with Specification","archived":false,"fork":false,"pushed_at":"2023-07-05T00:47:17.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-23T10:51:24.005Z","etag":null,"topics":["csharp","entity-framework-core","netcore6","repository-management","repository-pattern"],"latest_commit_sha":null,"homepage":"","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/wilsonsergio2500.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-02T22:33:54.000Z","updated_at":"2023-07-05T00:27:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"af8c10a9-f85b-4c8e-a903-0e70f7f0aa80","html_url":"https://github.com/wilsonsergio2500/efTurbo","commit_stats":null,"previous_names":["wilsonsergio2500/efturbo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wilsonsergio2500/efTurbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsergio2500%2FefTurbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsergio2500%2FefTurbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsergio2500%2FefTurbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsergio2500%2FefTurbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonsergio2500","download_url":"https://codeload.github.com/wilsonsergio2500/efTurbo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsergio2500%2FefTurbo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35210429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["csharp","entity-framework-core","netcore6","repository-management","repository-pattern"],"created_at":"2024-11-05T16:13:04.806Z","updated_at":"2026-07-07T00:31:27.124Z","avatar_url":"https://github.com/wilsonsergio2500.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\n\u003cimg src=\"https://im.ages.io/c3YfIintl2\" width=\"50px\"\u003e\nEF Turpo Repo\n\u003c/h1\u003e\n\n[![GitHub](https://img.shields.io/github/license/wilsonsergio2500/efTurbo?style=flat-square)](https://github.com/wilsonsergio2500/efTurbo/blob/master/LICENSE)\n![Nuget](https://img.shields.io/nuget/v/EF.Turbo.Repo?style=flat-square)\n[![Build](https://github.com/wilsonsergio2500/efTurbo/actions/workflows/build.yml/badge.svg)](https://github.com/wilsonsergio2500/efTurbo/actions/workflows/build.yml)\n\n\n\nSimple and speedy but opinionated Repository pattern with query specification.\n\n## The idea\nI envision creating a pattern that while not befitting for every use case, could aid in introducing an elegant abstraction while boilerplating at lighting speed.\n\nThe note worthy word here is �abstraction.� Emphasizing that this not a principle or library that would likely be brought into every project. However, if utilizing Entity Framework as a ORM you may find this approach useful, and subscribe to this implementation for the sake of simplicity while adhering to its ingredients.\n\n\n\n## Installation\n```bash\ndotnet add package EF.Turbo.Repo\n```\n\n## Usage\nFor a given Context\n```c#\npublic class CustomerContext: DbContext\n{\n    readonly string SCHEMA = \"Customer\";\n    public CustomerContext(DbContextOptions\u003cCustomerContext\u003e options) : base(options)\n    {\n    }\n    public virtual DbSet\u003cEntities.Contact\u003e Contacts { get; set; } = null!;\n  ....\n}\n```\n\nWe could bring about a repository declaration like such:\n```c#\nusing Customer.Repo.Core.Entities;\nusing EF.Turbo.Repo.Core.Interfaces;\nusing EF.Turbo.Repo.Core.Repo;\n\nnamespace Customer.Repo.Core.Repos\n{\n    public class ContactRepo : BaseRepo\u003cCustomerContext, Contact\u003e, IBaseRepo\u003cCustomerContext, Contact\u003e\n    {\n        public ContactRepo(CustomerContext dbContext) : base(dbContext)\n        {\n        }\n    }\n}\n```\nand This is all would ever be needed :smile: (If not extending the base repo, when seeking your own implementation) Subsequently, the repo could be inject as such\n```c#\npublic static IServiceCollection AddCustomerRepository(this IServiceCollection services)\n{\n    services.AddScoped\u003cIBaseRepo\u003cCustomerContext, Contact\u003e, ContactRepo\u003e();\n    ...\n}\n```\nAny service could then consume the repository as such\n```c#\npublic class ContactService : IContactService\n{\n\tprivate readonly IBaseRepo\u003cCustomerContext, Contact\u003e _contactRepo;\n\tpublic ContactService(IBaseRepo\u003cCustomerContext, Contact\u003e contactRepo)\n\t{\n\t\t_contactRepo = contactRepo;\n\t}\n\tpublic async Task\u003cContact\u003e GetContactByIdAsync(int id)\n\t{\n\t\treturn await _contactRepo.GetByIdAsync(id);\n\t}\n\t...\n}\n\n```\n\n## Query Specification\nAs stated the library exposes a Query Specification pattern created by [@ardalis](https://github.com/ardalis/Specification).\nThere are plenty of examples that could be found. However, In summary the specification allows for a query against the underlining Entity brought about by the generic type implementation.\n```c#\nusing Ardalis.Specification;\nusing Customer.Repo.Core.Entities;\n\nnamespace Customer.Service.Core.Specs.Contacts\n{\n    public class ByEmail: Specification\u003cContact\u003e\n    {\n        public ByEmail(string email)\n        {\n            Query.Where(contact =\u003e contact.EmailAddress == email);\n        }\n    }\n    public class HasPhone: Specification\u003cContact\u003e\n    {\n        public HasPhone()\n        {\n            Query.Where(contact =\u003e !string.IsNullOrEmpty(contact.PhoneNumber));\n        }\n    }\n}\n...\n```\nHence We could have the following:\n```c#\npublic async Task\u003cbool\u003e HasAnyContactWithEmail(string Email)\n{\n    return await contactRepo.AnyAsync(new ByEmail(Email));\n}\n\npublic async Task\u003cint\u003e NumberOfContactsWithPhoneNumbers()\n{\n    return await contactRepo.CountAsync(new HasPhone());\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsergio2500%2Fefturbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonsergio2500%2Fefturbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsergio2500%2Fefturbo/lists"}