dependency_injection_build 1.0.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package dependency_injection_build --version 1.0.0.6
NuGet\Install-Package dependency_injection_build -Version 1.0.0.6
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="dependency_injection_build" Version="1.0.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add dependency_injection_build --version 1.0.0.6
#r "nuget: dependency_injection_build, 1.0.0.6"
#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 dependency_injection_build as a Cake Addin
#addin nuget:?package=dependency_injection_build&version=1.0.0.6

// Install dependency_injection_build as a Cake Tool
#tool nuget:?package=dependency_injection_build&version=1.0.0.6

Welcome to the build wiki!

.NET Core 2.1 Dependency Injection framework

VSTS CircleCI Build status Amazon AWS

Maintainability

build build build build build Coverage Status

Community

Welcome to #build #slack

CodeFactor NuGet version NuGet downloads Discord

Channels

#slack

Repository

build

Docs

wiki

v1.0.0.6

  • Enable/disable automatic type resolution
  • Enable/disable automatic type instantiation

Examples

Automatic type resolution disabled

Parameter is set to true if automatic type resolution for reference types option enabled (does not throws exceptions for reference types contains type dependencies to non-registered types). If automatic type resolution for reference types is enabled, type will defaults to null if not resolved and no exception will be thrown.

Usage:

// Automatic type resolution disabled
// Instantiation reqires SqlDataRepository to be resolved
var container = new Container(false, true);
container.RegisterType<ServiceDataRepository>();
container.RegisterType<WebServiceDataRepository>();
Assert.Throws<TypeInstantiationException>(() => container.CreateInstance("Build.Tests.TestSet15.WebServiceDataRepository(Build.Tests.TestSet15.SqlDataRepository)"));
/// Automatic type resolution enabled
var container = new Container(true, false);
container.RegisterType<WebServiceDataRepository>();
var sql = (WebServiceDataRepository)container.CreateInstance("Build.Tests.TestSet15.WebServiceDataRepository(Build.Tests.TestSet15.SqlDataRepository)");
Assert.Equal(2019, ((SqlDataRepository)sql.Repository).PersonId);

Definition:

public class ServiceDataRepository : IPersonRepository
{
    public ServiceDataRepository([Injection(typeof(SqlDataRepository), 2018)]IPersonRepository repository)
    {
        Repository = repository;
    }

    public IPersonRepository Repository { get; }

    public Person GetPerson(int personId)
    {
        // get the data from Web service and return Person instance.
        return new Person(this);
    }
}

public class WebServiceDataRepository : IPersonRepository
{
    public WebServiceDataRepository([Injection(typeof(SqlDataRepository), 2019)]IPersonRepository repository)
    {
        Repository = repository;
    }

    public IPersonRepository Repository { get; }

    public Person GetPerson(int personId)
    {
        // get the data from Web service and return Person instance.
        return new Person(this);
    }
}
Automatic type instantiation disabled

Parameter is set to true if automatic type instantiation for reference types option enabled (does not throws exceptions for reference types defaults to null). If automatic type instantiation for reference types is enabled, type will defaults to null if not resolved and no exception will be thrown.

Usage:

// Automatic type instantiation disabled
var container = new Container(true, false);
container.RegisterType<ServiceDataRepository2>();
Assert.Throws<TypeInstantiationException>(() => container.CreateInstance<ServiceDataRepository2>());
// Automatic type instantiation enabled
// ServiceDataRepository2 depends upon non existent Build.Tests.Fail_TestSet1.Other2
// and resolved to null
var container = new Container(true, true);
container.RegisterType<ServiceDataRepository2>();
var sql = container.CreateInstance<ServiceDataRepository2>();
Assert.Null(sql.Repository);

Definition:

public class ServiceDataRepository2 : IPersonRepository
{
    public ServiceDataRepository2([Injection("Build.Tests.Fail_TestSet1.Other2")]IPersonRepository repository)
    {
        Repository = repository;
    }

    public IPersonRepository Repository { get; }

    public Person GetPerson(int personId)
    {
        // get the data from Web service and return Person instance.
        return new Person(this);
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.31 500 7/31/2020
1.0.0.28 402 7/31/2020
1.0.0.27 559 3/2/2019
1.0.0.19 830 7/15/2018
1.0.0.18 899 7/11/2018
1.0.0.17 855 7/11/2018
1.0.0.16 747 7/2/2018
1.0.0.15 875 6/23/2018
1.0.0.14 885 6/21/2018
1.0.0.13 868 6/18/2018
1.0.0.12 862 6/17/2018
1.0.0.11 855 6/16/2018
1.0.0.10 896 6/16/2018
1.0.0.9 852 6/16/2018
1.0.0.8 850 6/16/2018
1.0.0.7 918 6/1/2018
1.0.0.6 893 6/1/2018
1.0.0.5 887 5/24/2018
1.0.0.4 908 5/13/2018
1.0.0.3 872 5/12/2018
1.0.0.2 904 5/12/2018
1.0.0.1 948 4/29/2018
1.0.0 922 4/17/2018

Features:
- Added option to enable/disable automatic type resolution
- Added option to enable/disable automatic type instantiation