{"id":30298151,"url":"https://github.com/Atulin/NpgsqlSourceGenerators","last_synced_at":"2025-08-17T04:03:51.048Z","repository":{"id":215840778,"uuid":"739900190","full_name":"Atulin/NpgsqlSourceGenerators","owner":"Atulin","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-01T05:49:23.000Z","size":75,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-26T12:21:38.840Z","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/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}},"created_at":"2024-01-06T22:06:44.000Z","updated_at":"2024-02-01T04:14:14.000Z","dependencies_parsed_at":"2024-01-09T09:29:02.978Z","dependency_job_id":"380bd8fa-b8df-4dab-a9ca-308977891043","html_url":"https://github.com/Atulin/NpgsqlSourceGenerators","commit_stats":null,"previous_names":["genfic/npgsql-source-generators","atulin/npgsqlsourcegenerators"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Atulin/NpgsqlSourceGenerators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FNpgsqlSourceGenerators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FNpgsqlSourceGenerators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FNpgsqlSourceGenerators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FNpgsqlSourceGenerators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Atulin","download_url":"https://codeload.github.com/Atulin/NpgsqlSourceGenerators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atulin%2FNpgsqlSourceGenerators/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":[],"created_at":"2025-08-17T04:01:32.291Z","updated_at":"2025-08-17T04:03:51.033Z","avatar_url":"https://github.com/Atulin.png","language":"C#","readme":"[![NuGet Version](https://img.shields.io/nuget/v/Atulin.NpgsqlSourceGenerator?style=for-the-badge)](https://www.nuget.org/packages/Atulin.NpgSqlSourceGenerator/)\n![NuGet Downloads](https://img.shields.io/nuget/dt/Atulin.NpgsqlSourceGenerator?style=for-the-badge)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Atulin/NpgsqlSourceGenerators/nuget.yml?style=for-the-badge)\n[![GitHub License](https://img.shields.io/github/license/Atulin/NpgsqlSourceGenerators?style=for-the-badge)](/LICENSE)\n\n# Npgsql Source Generators\n\nRegistering all enums one by one is tedious. Use this.\n\n## Usage\n\nPlace `[PostgresEnum]` attribute on the enums you want to register...\n\n```cs\nnamespace MyCoolApp;\n\n[PostgresEnum]\npublic enum Status {\n    Completed,\n    InProgress,\n    Started,\n    Queued\n}\n\n[PostgresEnum(Name = \"process_priority\")]\npublic enum Priority {\n    High,\n    Medium,\n    Low\n}\n```\n\n...and register them\n\n```cs\nvar source = new NpgsqlDataSourceBuilder(connectionString).npgSourceBuilder\n    .MapPostgresEnums()\n    .Build();\nservices.AddDbContext\u003cMyDbContext\u003e(options =\u003e options.UseNpgsql(source));\n```\n```cs\npublic class MyDbContext : DbContext\n{\n    protected override void OnModelCreating(ModelBuilder builder)\n    {\n        base.OnModelCreating(builder);\n        builder.RegisterPostgresEnums();\n    }    \n}\n```\n\u003e [!TIP]\n\u003e In Npgsql 9.0, you can use *just* this instead of the previous two\n```cs\nbuilder.Services.AddDbContext\u003cMyContext\u003e(options =\u003e options.UseNpgsql(\n    \"\u003cconnection string\u003e\",\n    o =\u003e o.MapPostgresEnums()));\n```\n","funding_links":[],"categories":["Source Generators"],"sub_categories":["Database / ORM"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAtulin%2FNpgsqlSourceGenerators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAtulin%2FNpgsqlSourceGenerators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAtulin%2FNpgsqlSourceGenerators/lists"}