Skip to content

v1.3.0

Choose a tag to compare

@ling921 ling921 released this 05 Sep 01:43
d29f88d

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, and Add, TryAdd, Replace, TryAddEnumerable strategies. 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 LAI009 for invalid registration options and validate overlapping interface registrations. Unkeyed Strategy = Replace supports every targeted DI version; the legacy Replace = true compatibility 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.

完整用法与兼容说明见中文包文档。

Full comparison: v1.2.0...v1.3.0