Skip to content

3.1.6.0

Choose a tag to compare

@devRoemer devRoemer released this 27 Jan 12:24
· 26 commits to master since this release
3d3f32f

New features

Overrides

It is now possible to have overrides by adding the "Samhammer.DependencyInjection.Override" package.
See readme for further details.

Type resolving

Added new extension point to change how types and matching interfaces are found.
Implement ITypeResolvingStrategy and use options.SetTypeStrategy to set your override.

Methods:

  • ResolveTypesByAttribute = Implement how types are found by DependencyInjectionAttribute
  • GetMatchingInterfaceType = Implement logic to find a matching interface in "Target.Matching" mode. (e.g. for custom naming schemas)

BREAKING CHANGES

Signature changes

If you have a custom provider or custom handlers, you have to change the constructor to:

  • InjectMatchingServiceDescriptorHandler(DependencyResolverOptions options)
  • InjectAsServiceDescriptorHandler()
  • InjectAllServiceDescriptorHandler()
  • FactoryServiceDescriptorHandler()
  • AttributeServiceDescriptorProvider(ILogger logger, DependencyResolverOptions options)

Adding assembly strategy

The name of the extension method to add an assembly strategy changed from
serviceCollection.ResolveDependencies(options => options.SetStrategy(assemblyResolvingStrategy));
to
serviceCollection.ResolveDependencies(options => options.SetAssemblyStrategy(assemblyResolvingStrategy));