Bdziam.ExternalDependencyResolver 0.0.9

dotnet add package Bdziam.ExternalDependencyResolver --version 0.0.9                
NuGet\Install-Package Bdziam.ExternalDependencyResolver -Version 0.0.9                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bdziam.ExternalDependencyResolver" Version="0.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bdziam.ExternalDependencyResolver --version 0.0.9                
#r "nuget: Bdziam.ExternalDependencyResolver, 0.0.9"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bdziam.ExternalDependencyResolver as a Cake Addin
#addin nuget:?package=Bdziam.ExternalDependencyResolver&version=0.0.9

// Install Bdziam.ExternalDependencyResolver as a Cake Tool
#tool nuget:?package=Bdziam.ExternalDependencyResolver&version=0.0.9                

Bdziam.ExternalDependencyResolver

Bdziam.ExternalDependencyResolver is a C# library that provides a mechanism to resolve dependencies for a given type using a combination of a service provider and additional dependencies.

Features

  • Resolves dependencies using a service provider.
  • Supports additional dependencies.
  • Allows overriding dependencies with additional ones.

Installation

To install Bdziam.ExternalDependencyResolver, add the following package to your project:

dotnet add package Bdziam.ExternalDependencyResolver

Usage

Registering the Resolver

To register the ExternalDependencyResolver in your IServiceCollection, use the AddExternalDependencyResolver extension method:

using Microsoft.Extensions.DependencyInjection;
using Bdziam.ExternalDependencyResolver;

var services = new ServiceCollection();
services.AddExternalDependencyResolver();

You can also provide a custom IServiceProvider:

var customServiceProvider = new ServiceCollection().BuildServiceProvider();
services.AddExternalDependencyResolver(customServiceProvider);

Resolving Dependencies

To resolve dependencies, use the ExternalDependencyResolver class:

using Bdziam.ExternalDependencyResolver;
using System;
using System.Collections.Generic;

var serviceProvider = new ServiceCollection().BuildServiceProvider();
var resolver = new ExternalDependencyResolver(serviceProvider);

var instance = resolver.Resolve<MyClass>();

You can also provide additional dependencies and override existing ones:

var additionalDependencies = new KeyValuePair<Type, object>[]
{
    new KeyValuePair<Type, object>(typeof(IMyDependency), new MyDependency())
};

var instance = resolver.Resolve<MyClass>(true, additionalDependencies);

Testing

The project includes unit tests using xUnit and Moq. To run the tests, use the following command:

dotnet test

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MPL License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bdziam.ExternalDependencyResolver:

Package Downloads
BdziamPak

BdziamPak is a C# library that provides a mechanism to resolve dependencies for a given metadata using customizable resolvement process

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.9 14 1/8/2025