dependency_injection_build 1.0.0.8

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.8                
NuGet\Install-Package dependency_injection_build -Version 1.0.0.8                
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.8" />                
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.8                
#r "nuget: dependency_injection_build, 1.0.0.8"                
#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.8

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

Welcome to the build wiki!

.NET Core 2.1 Dependency Injection framework

VSTS CircleCI Build status Amazon AWS Travis CI

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.8

  • Added totally customizable type system
  • Added ability to use interfaces as first-class objects

Examples

Customizable type system
  • You can use interfaces as first-class objects instead of classes fot typeholders attributes
  • Using interfaces as first-class objects, you will be able to eliminate the need to inject attributes into existing code
  • By implemeting type system interfaces, you will get a fully customzable type system, easily
  • Registration is bound to interfaces only, which can have a several metods named "Rule" (it is evil, i knew it)
  • Type is being instantiatied is actually a return parameter of "Rule" method
  • Arguments passed to the constructor is simply arguments of that particular rule
  • You definetly can break some more rules, just do not try to build inconsistent type system.

Definition:

interface IMyFunRuleSet
{
    Type1 Rule(Arg1 arg1, Arg2 arg2);
}

class Type1
{
    public Type1(Arg1 arg1, Arg2 arg2)
    {
        Arg1 = arg1;
        Arg2 = arg2;
    }

    public Arg1 Arg1 { get; }

    public Arg2 Arg2 { get; }
}

Usage:

var container = new Container(new MyFunTypeConstructor(), new MyFunTypeFilter(), new MyFunTypeParser(), new MyFunTypeResolver());
container.RegisterType<IMyFunRuleSet>();
var type1 = container.CreateInstance("Build.Interfaces.Tests.Type1(Build.Interfaces.Tests.Arg1,Build.Interfaces.Tests.Arg2)");
Assert.NotNull(type1);

Goal

The goal of development of this framework is to build automation of complex types initialization. Build can use declarative approach to define dependencies between types and their requirements. Constructor injection uses type resolution to resolve devendencies

Examples

Create instance with parameters

Usage:

var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var sql = new SqlDataRepository();
var srv1 = (ServiceDataRepository)container.CreateInstance(
    "UnitTests.TestSet14.ServiceDataRepository(UnitTests.TestSet14.SqlDataRepository)", sql);

Load simple types (not attributes specified)

Usage:

IContainer container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();

API

Classes

Definition:

public interface IPersonRepository
{
    Person GetPerson(int personId);
}

public class Person
{
    readonly IPersonRepository _personRepository;

    public Person(IPersonRepository personRepository)
    {
        _personRepository = personRepository;
    }
}

public class SqlDataRepository : IPersonRepository
{
    public SqlDataRepository()
    {
    }

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

public class ServiceDataRepository : IPersonRepository
{
    public ServiceDataRepository(SqlDataRepository 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);
    }
}

Continious Integration

CircleCI TravisCI

Academic papers:

Dependency Injection for Programming by Optimization, Zoltan A. Kocsis and Jerry Swan

  1. School of Mathematics, University of Manchester, Oxford Road, Manchester M13 9PL, UK. zoltan.kocsis@postgrad.manchester.ac.uk
  2. Computer Science, University of York, Deramore Lane, York, YO10 5GH, UK.

Dependency injection in ASP.NET Core

Inversion of Control Containers and the Dependency Injection pattern

Support via PayPal

Please, feel free to donate me 5$ to expand project development (wiki, samples, etc.)

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 539 7/31/2020
1.0.0.28 435 7/31/2020
1.0.0.27 594 3/2/2019
1.0.0.19 857 7/15/2018
1.0.0.18 927 7/11/2018
1.0.0.17 881 7/11/2018
1.0.0.16 774 7/2/2018
1.0.0.15 906 6/23/2018
1.0.0.14 913 6/21/2018
1.0.0.13 894 6/18/2018
1.0.0.12 889 6/17/2018
1.0.0.11 880 6/16/2018
1.0.0.10 922 6/16/2018
1.0.0.9 878 6/16/2018
1.0.0.8 877 6/16/2018
1.0.0.7 946 6/1/2018
1.0.0.6 916 6/1/2018
1.0.0.5 921 5/24/2018
1.0.0.4 931 5/13/2018
1.0.0.3 897 5/12/2018
1.0.0.2 927 5/12/2018
1.0.0.1 976 4/29/2018
1.0.0 949 4/17/2018

Features:
- Added totally customizable type system
- Added ability to use interfaces as first-class objects