{"id":23740208,"url":"https://github.com/mustaddon/lazydependencyinjection","last_synced_at":"2025-08-12T02:15:10.124Z","repository":{"id":262088248,"uuid":"886181283","full_name":"mustaddon/LazyDependencyInjection","owner":"mustaddon","description":"Lazy injection for Microsoft.Extensions.DependencyInjection. Decorates registered services with lazy proxies that instantiate the original service only after the first method or property call. Intended to prevent the creation of unused injected dependencies.","archived":false,"fork":false,"pushed_at":"2024-11-27T06:36:06.000Z","size":657,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T03:34:20.145Z","etag":null,"topics":["dependency-injection","dispatch-proxy","lazy-injection","lazy-loading","lazy-proxy","lazy-service","proxy-pattern","service-collection","service-provider","virtual-proxy"],"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/mustaddon.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-11-10T12:21:56.000Z","updated_at":"2024-11-27T06:36:10.000Z","dependencies_parsed_at":"2024-11-10T13:34:17.809Z","dependency_job_id":"701e6584-c9df-4627-aa9b-ce44db14d16a","html_url":"https://github.com/mustaddon/LazyDependencyInjection","commit_stats":null,"previous_names":["mustaddon/lazydependencyinjection"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mustaddon/LazyDependencyInjection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FLazyDependencyInjection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FLazyDependencyInjection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FLazyDependencyInjection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FLazyDependencyInjection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mustaddon","download_url":"https://codeload.github.com/mustaddon/LazyDependencyInjection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FLazyDependencyInjection/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269987123,"owners_count":24508176,"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-12T02:00:09.011Z","response_time":80,"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":["dependency-injection","dispatch-proxy","lazy-injection","lazy-loading","lazy-proxy","lazy-service","proxy-pattern","service-collection","service-provider","virtual-proxy"],"created_at":"2024-12-31T09:47:27.686Z","updated_at":"2025-08-12T02:15:10.043Z","avatar_url":"https://github.com/mustaddon.png","language":"C#","readme":"# LazyDependencyInjection [![NuGet version](https://badge.fury.io/nu/LazyDependencyInjection.svg?105)](http://badge.fury.io/nu/LazyDependencyInjection)\nLazy injection for Microsoft.Extensions.DependencyInjection using the [Proxy pattern](https://en.wikipedia.org/wiki/Proxy_pattern).\\\nDecorates registered services with lazy proxies that instantiate the original service only after the first method or property call.\\\nIntended to prevent the creation of unused injected dependencies.\n\n### Example\n```C#\nusing LazyDependencyInjection;\n\nvar services = new ServiceCollection()\n    .AddTransient\u003cIExampleService1, ExampleService1\u003e()\n    .AddTransient\u003cIExampleService2, ExampleService2\u003e()\n    .AddTransient\u003cIExampleService3, ExampleService3\u003e()\n    .AddTransient\u003cServiceWithManyUnusedDeps\u003e()\n     \n    // DEFAULT: Adds for any service that has dependencies \n    // and injections into other services with multiple methods and dependencies\n    .AddLazyProxy()\n    \n    // OR: Default analog with additional assembly condition for services\n    .AddLazyProxy(Assembly.GetExecutingAssembly())\n\n    // OR: Adds only for specified services\n    .AddLazyProxy(typeof(IExampleService1), typeof(IExampleService2))\n    \n    // OR: Adds with your custom filter\n    .AddLazyProxy(x =\u003e !x.Descriptor.IsKeyedService \u0026\u0026 x.Descriptor.HasDependenciesCountGreaterThan(0))\n\n    // OR: Adds for any service that has dependencies and injections into specific services\n    .AddLazyProxy(ServiceFilters.HasDependencies()\n        .And(ServiceFilters.IsInjectedTo(typeof(ServiceWithManyUnusedDeps))))\n\n    .BuildServiceProvider();\n```\n\n[Program.cs](https://github.com/mustaddon/LazyDependencyInjection/blob/main/Example/Program.cs)\n\n### Concept\n[![](https://raw.githubusercontent.com/mustaddon/LazyDependencyInjection/master/dgrm.png)](https://app.dgrm.net/?u=https://raw.githubusercontent.com/mustaddon/LazyDependencyInjection/master/dgrm.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustaddon%2Flazydependencyinjection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustaddon%2Flazydependencyinjection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustaddon%2Flazydependencyinjection/lists"}