Skip to content

A compile-time, attribute-driven DI helper: generate IServiceCollection extension methods from SingletonService / ScopedService / TransientService attributes.

License

Notifications You must be signed in to change notification settings

ling921/ling-auto-inject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ling.AutoInject NuGet

Ling.AutoInject provides attribute-driven dependency injection registrations plus a source generator that emits IServiceCollection extension methods for automatic registration.

Features

  • Attribute-based registration: SingletonService, ScopedService, TransientService.
  • Compile-time source generator that emits a single extension method to register discovered services.
  • Roslyn analyzers that validate attribute usage and AutoInjectConfig values at design time.
  • Optional keyed service support when the DI abstractions package supports it.
  • Configurable generated method, class and namespace via an assembly-level AutoInjectConfig attribute.
  • Service replacement support: use Replace = true to replace existing registrations instead of skipping when a service is already registered.
  • Class-level customization via AutoInjectExtensionsAttribute for control over method generation behavior, including optional IConfiguration parameter support.

Usage

For detailed usage instructions, including installation, attribute-based registration, and more, see the package README.

Development

  • Build: dotnet build
  • Test: dotnet test
  • Source generator and analyzers live under src/Ling.AutoInject.SourceGenerators.

Planned enhancements

  • Attribute-driven Options registration: upcoming support will generate registrations and configuration binding for IOptions<T> style options classes.

Contributing

  • Contributions are welcome. Please open issues or PRs and include tests for new behavior.

License

About

A compile-time, attribute-driven DI helper: generate IServiceCollection extension methods from SingletonService / ScopedService / TransientService attributes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages