{"id":30759037,"url":"https://github.com/ivmazurenko/factory-generator","last_synced_at":"2026-01-14T04:21:19.732Z","repository":{"id":275461105,"uuid":"924850158","full_name":"ivmazurenko/factory-generator","owner":"ivmazurenko","description":"factory-generator","archived":false,"fork":false,"pushed_at":"2025-02-02T17:37:50.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T22:45:35.136Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivmazurenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-01-30T19:00:14.000Z","updated_at":"2025-02-02T17:37:53.000Z","dependencies_parsed_at":"2025-02-02T18:19:29.716Z","dependency_job_id":"8645f025-72b7-4fee-8f86-e0e7cab0cfc0","html_url":"https://github.com/ivmazurenko/factory-generator","commit_stats":null,"previous_names":["ivmazurenko/factory-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivmazurenko/factory-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivmazurenko%2Ffactory-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivmazurenko%2Ffactory-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivmazurenko%2Ffactory-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivmazurenko%2Ffactory-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivmazurenko","download_url":"https://codeload.github.com/ivmazurenko/factory-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivmazurenko%2Ffactory-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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-09-04T12:01:26.481Z","updated_at":"2026-01-14T04:21:19.727Z","avatar_url":"https://github.com/ivmazurenko.png","language":"C#","funding_links":[],"categories":["Content"],"sub_categories":["224. [FactoryGenerator.Abstractions](https://ignatandrei.github.io/RSCG_Examples/v2/docs/FactoryGenerator.Abstractions) , in the [DependencyInjection](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#dependencyinjection) category"],"readme":"# FactoryGenerator\n\n.NET source generator that automatically\ngenerates and registers [factories](https://github.com/ivmazurenko/factory-generator/blob/master/FactoryGenerator.Abstractions/IFactory.cs)\n\n\n## Installation\n\nAdd the following packages to your project:\n\n```bash\n$ dotnet add package FactoryGenerator.Abstractions\n$ dotnet add package FactoryGenerator.Microsoft.Extensions.DependencyInjection\n```\n\n## Usage\n\n### Add the attribute to your class\n\nUse one of the `GenerateIFactory` attributes to specify how your factory should be\ngenerated:\n\n```c#\n[GenerateIFactory\u003cint\u003e]\npublic class Service(int value, Dependency dependency)\n{\n    // ...\n}\n```\n\nThis will generate an implementation of `IFactory\u003cint, Service\u003e`, allowing you to create instances of `Service` with an\n`int` parameter while automatically resolving other dependencies from the DI container. FactoryGenerator\nprovides [multiple attribute variations](https://github.com/ivmazurenko/factory-generator/blob/master/FactoryGenerator.Abstractions/GenerateIFactoryAttribute.cs)\ndepending on the number of parameters your factory should accept.\n\n### Register generated factories in the DI container\n\nThe `RegisterGeneratedFactories()` method automatically registers all factories created by the source\ngenerator.\n\n```c#\n\nvar serviceCollection = new ServiceCollection()\n    .RegisterGeneratedFactories();\n\n```\n\n### Use the factory\n\n```c#\nusing var serviceProvider = serviceCollection.BuildServiceProvider();\n\nvar factory = serviceProvider.GetRequiredService\u003cIFactory\u003cint, Service\u003e\u003e();\n\nvar service = factory.Create(1);\n```\n\nFull sample can be found [here](https://github.com/ivmazurenko/factory-generator/blob/master/Samples/Program.cs).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivmazurenko%2Ffactory-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivmazurenko%2Ffactory-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivmazurenko%2Ffactory-generator/lists"}