jeffward01 / Dazinator.Extensions.DependencyInjection

Useful additions to Microsoft.Extensions.DependencyInjection such as Named Services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Branch DevOps
Master Build Status
Develop Build Status
Package Stable Pre-release
Dazinator.Extensions.DependencyInjection.NamedServices Dazinator.Extensions.DependencyInjection.NamedServices Dazinator.Extensions.DependencyInjection.NamedServices
Dazinator.Extensions.DependencyInjection.ChildContainers Dazinator.Extensions.DependencyInjection.ChildContainers Dazinator.Extensions.DependencyInjection.ChildContainers
Dazinator.Extensions.DependencyInjection.Microsoft Dazinator.Extensions.DependencyInjection.Microsoft Dazinator.Extensions.DependencyInjection.Microsoft

Intro

This repository builds on Microsoft.Extensions.DependencyInjection.Abstractions to provide additional features, which currently are:

  • Named Services
  • Child Containers

It also provides a seperate (and optional) nuget package called Dazinator.Extensions.DependencyInjection.Microsoft which basically contains a copy of the native MS ServiceProvider but with some changes as published here: dotnet/runtime#45497

Named Services

Allows you to register services that can be resolved by name.

For more detailed docs see here

Child Containers

For more detailed docs see here

Allows you to configure "child containers" using the normal IServiceCollection interface. The child service provider can be implemented by your conforming container of choice i.e Autofac, Structuremap, Microsoft DI - any DI package that supports IServiceProvider.

It means, thanks to a standard interface for building / configuring child containers, you can take a DI container library that doesn't have a child container feature, (like I did with Microsofts) and create "child containers" with it! The caveat is that:

- Your DI container of choice must support building a container from an `IServiceCollection` or IEnumerable<ServiceDescriptor>`

If you are interested in that, look at the tests for ChildServiceCollection

For docs, see here

About

Useful additions to Microsoft.Extensions.DependencyInjection such as Named Services.


Languages

Language:C# 97.9%Language:HTML 1.7%Language:CSS 0.3%Language:JavaScript 0.0%