Repository navigation
v1.3.0
Changes since stable v1.2.0 (including features first shipped in v1.3.0-preview.1).
- Unified
[AutoInject(ServiceLifetime, ...)]attribute, declarative registration of all implemented interfaces, andAdd,TryAdd,Replace,TryAddEnumerablestrategies. Existing lifetime-specific attributes remain supported. - All four strategies support keyed services on DI 8+. Keys are compared by value, including numeric and enum keys on DI 8.0. Keyed enumerable registration is supported; the preview's incorrect restriction has been removed.
- Fix multi-interface enumerable registration failures, interface forwarding to unrelated implementations, repeated discovery of partial classes, named service-type precedence, and generation without implicit usings.
- Add
LAI009for invalid registration options and validate overlapping interface registrations. UnkeyedStrategy = Replacesupports every targeted DI version; the legacyReplace = truecompatibility behavior is preserved. - Update English/Chinese repository and package documentation, preserve CRLF generated sources, and ensure NuGet packing includes the current generator.
Compatibility: Interface-only registrations now map directly to their implementation and have independent lifetime caches. Add an explicit self-registration when shared scoped/singleton instances are desired with the default strategy. TryAddEnumerable keeps interface instances independent and uses TryAdd behavior for self-registration. Default strategy remains TryAdd.
Validated with 937 tests across seven target frameworks, real-container strategy/lifetime/key scenarios, the runnable sample, and an actual NuGet consumer build.
完整用法与兼容说明见中文包文档。