{"id":15648266,"url":"https://github.com/xljiulang/dependencyinjection.annotation","last_synced_at":"2025-07-08T01:10:35.868Z","repository":{"id":188689546,"uuid":"679213493","full_name":"xljiulang/DependencyInjection.Annotation","owner":"xljiulang","description":"基于注解的服务自动查找与注册的DI扩展","archived":false,"fork":false,"pushed_at":"2023-12-04T17:53:45.000Z","size":79,"stargazers_count":49,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-05T23:18:28.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/xljiulang.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":"2023-08-16T10:47:38.000Z","updated_at":"2025-06-14T13:43:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"cca721a3-b043-4088-9a39-95989e034ceb","html_url":"https://github.com/xljiulang/DependencyInjection.Annotation","commit_stats":null,"previous_names":["xljiulang/dependencyinjection.annotation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xljiulang/DependencyInjection.Annotation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xljiulang%2FDependencyInjection.Annotation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xljiulang%2FDependencyInjection.Annotation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xljiulang%2FDependencyInjection.Annotation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xljiulang%2FDependencyInjection.Annotation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xljiulang","download_url":"https://codeload.github.com/xljiulang/DependencyInjection.Annotation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xljiulang%2FDependencyInjection.Annotation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263822525,"owners_count":23516169,"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","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":"2024-10-03T12:24:22.287Z","updated_at":"2025-07-08T01:10:35.848Z","avatar_url":"https://github.com/xljiulang.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DependencyInjection.Annotation\n基于注解的服务自动查找与注册的DI扩展。使用SourceGenerator无反射，完美支持AOT。\n\n### 食用步骤\n#### 1 nuget引用 \n```xml\n\u003cPackageReference Include=\"DependencyInjection.Annotation\" Version=\"1.1.2\" /\u003e\n```\n\n#### 2 服务标记\n```c#\n[Service(ServiceLifetime.Singleton)]\nclass MyService \n{    \n}\n```\n\n```c#\n[Service(ServiceLifetime.Singleton, typeof(IMyService1))]\nclass MyService : IMyService1\n{    \n}\n```\n\n```c#\n[Service(ServiceLifetime.Singleton, typeof(IMyService1), typeof(IMyService2))]\nclass MyService : IMyService1, IMyService2, IDisposable\n{    \n}\n```\n\n#### 3 服务注册\n```c#\nbuilder.Services.Add{AssemblyName}();\n```\n其中{AssemblyName}为包含服务的程序集名。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxljiulang%2Fdependencyinjection.annotation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxljiulang%2Fdependencyinjection.annotation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxljiulang%2Fdependencyinjection.annotation/lists"}