{"id":30298148,"url":"https://github.com/Atulin/AutoDbSet","last_synced_at":"2025-08-17T04:03:48.225Z","repository":{"id":265005286,"uuid":"894848509","full_name":"Atulin/AutoDbSet","owner":"Atulin","description":"Automagically create `DbSet`s in your `DbContext`","archived":false,"fork":false,"pushed_at":"2025-05-21T00:48:57.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-21T01:38:01.549Z","etag":null,"topics":["csharp","csharp-sourcegenerator","dotnet"],"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/Atulin.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,"zenodo":null}},"created_at":"2024-11-27T05:29:23.000Z","updated_at":"2025-05-21T00:49:00.000Z","dependencies_parsed_at":"2024-12-23T19:38:36.540Z","dependency_job_id":null,"html_url":"https://github.com/Atulin/AutoDbSet","commit_stats":null,"previous_names":["atulin/autodbset"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Atulin/AutoDbSet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FAutoDbSet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FAutoDbSet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FAutoDbSet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FAutoDbSet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Atulin","download_url":"https://codeload.github.com/Atulin/AutoDbSet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FAutoDbSet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270803621,"owners_count":24648707,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"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","csharp-sourcegenerator","dotnet"],"created_at":"2025-08-17T04:01:32.232Z","updated_at":"2025-08-17T04:03:48.177Z","avatar_url":"https://github.com/Atulin.png","language":"C#","readme":"[![NuGet Version](https://img.shields.io/nuget/v/Atulin.AutoDbSet?style=for-the-badge)](https://www.nuget.org/packages/Atulin.AutoDbSet/)\n![NuGet Downloads](https://img.shields.io/nuget/dt/Atulin.AutoDbSet?style=for-the-badge)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Atulin/AutoDbSet/nuget.yml?style=for-the-badge)\n[![GitHub License](https://img.shields.io/github/license/Atulin/AutoDbSet?style=for-the-badge)](./LICENSE)\n\n# AutoDbSet\n\nAutomagically add `DbSet\u003cT\u003e`s to your `DbContext`\n\n## Usage\n\nPlace `[AutoDbSet]` attribute on the database models you want to register...\n\n```cs\nusing AutoDbSetGenerators;\n\nnamespace AutoDbSet.Demo;\n\n[AutoDbSet]\npublic class Person\n{\n    public required string Name { get; set; }\n    public required DateOnly Birthday { get; set; }\n    public required float Height { get; set; }\n}\n```\n\nPlace `[AutoDbContext]` attribute on your `DbContext` and make it `partial`...\n\n```cs\nusing AutoDbSetGenerators;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace AutoDbSet.Demo;\n\n[AutoDbContext]\npublic partial class MyCoolDbContext : DbContext\n{\n}\n```\n\nAnd watch the magic happen!\n\n```cs\nnamespace AutoDbSet.Demo;\n\n[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute]\n[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n[global::System.CodeDom.Compiler.GeneratedCode(\"AutoDbSet\", \"1.0.0.0\")]\npublic partial class MyCoolDbContext\n{\n    public required Microsoft.EntityFrameworkCore.DbSet\u003cAutoDbSet.Demo.Person\u003e Persons { get; init; }\n}\n```\n\n## DbSet naming\n\nBy default `AutoDbSet` will try to naively pluralize the names ([here's how](./AutoDbSet/NameHelpers.cs)). It does not,\ntherefore, work with verbs that have irregular plural form, nor does it work with non-English languages.\n\nYou can, however, give the sets your own, custom name:\n\n```cs\n[AutoDbSetGenerators.AutoDbSet(Name = \"People\")]\npublic class Person\n{\n    public required string Name { get; set; }\n    public required DateOnly Birthday { get; set; }\n    public required float Height { get; set; }\n}\n```\n\nwill generate\n\n```cs\nnamespace AutoDbSet.Demo;\n\n[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute]\n[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n[global::System.CodeDom.Compiler.GeneratedCode(\"AutoDbSet\", \"1.0.0.0\")]\npublic partial class MyCoolDbContext\n{\n    public required Microsoft.EntityFrameworkCore.DbSet\u003cAutoDbSet.Demo.Person\u003e People { get; init; }\n}\n```\n\n## Caveats\n\nThe generator only works when there's a single `DbContext` with the attribute in the project.\nI plan to add support for multiple contexts in a future update.","funding_links":[],"categories":["Source Generators"],"sub_categories":["Database / ORM"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAtulin%2FAutoDbSet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAtulin%2FAutoDbSet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAtulin%2FAutoDbSet/lists"}