Build.DependencyInjection
1.0.0.16
See the version list below for details.
dotnet add package Build.DependencyInjection --version 1.0.0.16
NuGet\Install-Package Build.DependencyInjection -Version 1.0.0.16
<PackageReference Include="Build.DependencyInjection" Version="1.0.0.16" />
paket add Build.DependencyInjection --version 1.0.0.16
#r "nuget: Build.DependencyInjection, 1.0.0.16"
// Install Build.DependencyInjection as a Cake Addin #addin nuget:?package=Build.DependencyInjection&version=1.0.0.16 // Install Build.DependencyInjection as a Cake Tool #tool nuget:?package=Build.DependencyInjection&version=1.0.0.16
Welcome to the build wiki!
.NET Core 2.1 Dependency Injection framework
Maintainability
Community
Channels
Repository
Docs
v1.0.0.16
- Added TypeBuilderOptions class
- Added sample implementation of property-based type dependency injector
v1.0.0.15
- Added ASP.NET Core 2.1 middleware extensibility
- Added System.Func<T> type initialization
- Added TypeBuilder.GetInstance(...) methods
v1.0.0.14
- Added type registration parameters
- Added support for generic parameter types
- Use standart type definiton (Type.ToString())
v1.0.0.13
- Added runtimes for .NET Standart 2.0, .NET Framework 4.5/4.5.1/4.5.2/4.6/4.6.1/4.6.2/4.7/4.7.1/4.7.2
v1.0.0.12
- Added runtime default checks to avoid System.MissingMethodException and System.Reflection.AmbiguousMatchException.
v1.0.0.11
- Added automatic type attribute overwrite optional parameter to the build system
- By default, type runtime attributes overrides each other and optionally can be turned off. Exception will be trown.
Example:
[MyFun]
interface IMyFunRuleSet2
{
[MyFunDependency(RuntimeInstance.Singleton)]
SqlDataRepository Rule(int repositoryId);
}
[MyFun]
interface IMyFunRuleSet2_Overwrite
{
[MyFunDependency(RuntimeInstance.Singleton)]
SqlDataRepository Rule(int repositoryId);
}
v1.0.0.10
- Added method CanRegisterParameter to ITypeFilter to control parameter registration
v1.0.0.9
- Added public sealed classes TypeDependencyObject, TypeInjectionObject
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);
Features
- Declarative metadata attribute driven initialization
- Lazy type resolution and initialization (supports pure dependency decoupling anti-pattern)
- Circular references detection
- Singleton initialization
- Automated and manual type registration
- Type aliases
- External assembly types
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
Continious Integration
Academic papers:
Dependency Injection for Programming by Optimization, Zoltan A. Kocsis and Jerry Swan
- School of Mathematics, University of Manchester, Oxford Road, Manchester M13 9PL, UK. zoltan.kocsis@postgrad.manchester.ac.uk
- Computer Science, University of York, Deramore Lane, York, YO10 5GH, UK.
Links
Dependency injection in ASP.NET Core
Inversion of Control Containers and the Dependency Injection pattern
Donate
Please, feel free to donate me 5$ to expand project development (wiki, samples, etc.)
Product | Versions 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.0 was computed. netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 2.1
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.0
- 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.
Features:
- Added TypeBuilderOptions for more grained control of type builder parameters