diff --git a/readme/ArrayDetails.md b/readme/ArrayDetails.md index 212257a52..879167a67 100644 --- a/readme/ArrayDetails.md +++ b/readme/ArrayDetails.md @@ -88,16 +88,16 @@ classDiagram ```c# partial class Array { - private readonly Array _rootM03D26di; + private readonly Array _rootM03D27di; public Array() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Array(Array baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR() @@ -107,20 +107,20 @@ partial class Array public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -132,10 +132,10 @@ partial class Array public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -224,25 +224,25 @@ partial class Array " Array ..> CompositionRoot : CompositionRoot PureDIByCR()"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Array() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Array composite) { @@ -255,7 +255,7 @@ partial class Array } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Array composition) { diff --git a/readme/Avalonia.md b/readme/Avalonia.md index 3b102973f..2ecb7ebc2 100644 --- a/readme/Avalonia.md +++ b/readme/Avalonia.md @@ -107,7 +107,7 @@ The [project file](/samples/AvaloniaApp/AvaloniaApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/BlazorServerApp.md b/readme/BlazorServerApp.md index 5f1e0826c..19ed3b7c5 100644 --- a/readme/BlazorServerApp.md +++ b/readme/BlazorServerApp.md @@ -68,11 +68,11 @@ The [project file](/samples/BlazorServerApp/BlazorServerApp.csproj) looks like t - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/BlazorWebAssemblyApp.md b/readme/BlazorWebAssemblyApp.md index eda8ebaf4..d766859f5 100644 --- a/readme/BlazorWebAssemblyApp.md +++ b/readme/BlazorWebAssemblyApp.md @@ -67,11 +67,11 @@ The [project file](/samples/BlazorWebAssemblyApp/BlazorWebAssemblyApp.csproj) lo - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/Console.md b/readme/Console.md index a8bc0693d..88510d279 100644 --- a/readme/Console.md +++ b/readme/Console.md @@ -90,7 +90,7 @@ The [project file](/samples/ShroedingersCat/ShroedingersCat.csproj) looks like t - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ConsoleNativeAOT.md b/readme/ConsoleNativeAOT.md index 58d0d87c4..7da496158 100644 --- a/readme/ConsoleNativeAOT.md +++ b/readme/ConsoleNativeAOT.md @@ -16,7 +16,7 @@ The [project file](/samples/ShroedingersCatNativeAOT/ShroedingersCatNativeAOT.cs - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ConsoleTopLevelStatements.md b/readme/ConsoleTopLevelStatements.md index e5449086e..034a288d4 100644 --- a/readme/ConsoleTopLevelStatements.md +++ b/readme/ConsoleTopLevelStatements.md @@ -78,7 +78,7 @@ The [project file](/samples/ShroedingersCatTopLevelStatements/ShroedingersCatTop - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/EnumDetails.md b/readme/EnumDetails.md index 071c27fbb..526ef44ed 100644 --- a/readme/EnumDetails.md +++ b/readme/EnumDetails.md @@ -88,48 +88,48 @@ classDiagram ```c# partial class Enum { - private readonly Enum _rootM03D26di; + private readonly Enum _rootM03D27di; public Enum() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Enum(Enum baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR() { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable LocalperBlockM03D26di10_IEnumerable() + System.Collections.Generic.IEnumerable LocalperBlockM03D27di10_IEnumerable() { yield return new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); yield return new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); yield return new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); yield return new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); } - System.Collections.Generic.IEnumerable perBlockM03D26di10_IEnumerable = LocalperBlockM03D26di10_IEnumerable(); - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D26di10_IEnumerable)), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D26di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D26di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D26di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); + System.Collections.Generic.IEnumerable perBlockM03D27di10_IEnumerable = LocalperBlockM03D27di10_IEnumerable(); + return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D27di10_IEnumerable)), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D27di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D27di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D27di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -141,10 +141,10 @@ partial class Enum public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -233,25 +233,25 @@ partial class Enum " Enum ..> CompositionRoot : CompositionRoot PureDIByCR()"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Enum() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Enum composite) { @@ -264,7 +264,7 @@ partial class Enum } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Enum composition) { diff --git a/readme/FuncDetails.md b/readme/FuncDetails.md index d474a0ecb..c097ae32d 100644 --- a/readme/FuncDetails.md +++ b/readme/FuncDetails.md @@ -67,46 +67,46 @@ classDiagram ```c# partial class Func { - private readonly Func _rootM03D26di; + private readonly Func _rootM03D27di; public Func() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Func(Func baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR() { - System.Func perBlockM03D26di10_Func = new Func( + System.Func perBlockM03D27di10_Func = new Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var value_M03D26di1 = new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); - return value_M03D26di1; + var value_M03D27di1 = new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); + return value_M03D27di1; }); - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D26di10_Func)), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D26di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D26di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D26di10_Func), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); + return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D27di10_Func)), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D27di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D27di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM03D27di10_Func), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -118,10 +118,10 @@ partial class Func public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -189,25 +189,25 @@ partial class Func " FuncᐸIService3ᐳ *-- Service3 : IService3"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Func() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Func composite) { @@ -220,7 +220,7 @@ partial class Func } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Func composition) { diff --git a/readme/GrpcService.md b/readme/GrpcService.md index 5867cbc17..febbf2a63 100644 --- a/readme/GrpcService.md +++ b/readme/GrpcService.md @@ -53,11 +53,11 @@ The [project file](/samples/GrpcService/GrpcService.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/Maui.md b/readme/Maui.md index 3b68cd382..e5f4d9542 100644 --- a/readme/Maui.md +++ b/readme/Maui.md @@ -208,11 +208,11 @@ The [project file](/samples/MAUIApp/MAUIApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/MinimalWebAPI.md b/readme/MinimalWebAPI.md index 9f930a904..ee2f5ee18 100644 --- a/readme/MinimalWebAPI.md +++ b/readme/MinimalWebAPI.md @@ -76,11 +76,11 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/SingletonDetails.md b/readme/SingletonDetails.md index 87b8fdfe8..2196faad4 100644 --- a/readme/SingletonDetails.md +++ b/readme/SingletonDetails.md @@ -69,49 +69,49 @@ classDiagram ```c# partial class Singleton { - private readonly Singleton _rootM03D26di; - private Pure.DI.Benchmarks.Model.Service1 _scopedM03D26di37_Service1; - private Pure.DI.Benchmarks.Model.Service4 _scopedM03D26di40_Service4; + private readonly Singleton _rootM03D27di; + private Pure.DI.Benchmarks.Model.Service1 _scopedM03D27di37_Service1; + private Pure.DI.Benchmarks.Model.Service4 _scopedM03D27di40_Service4; public Singleton() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Singleton(Singleton baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR() { - if (ReferenceEquals(_scopedM03D26di40_Service4, null)) + if (ReferenceEquals(_scopedM03D27di40_Service4, null)) { - _scopedM03D26di40_Service4 = new Pure.DI.Benchmarks.Model.Service4(); + _scopedM03D27di40_Service4 = new Pure.DI.Benchmarks.Model.Service4(); } - if (ReferenceEquals(_scopedM03D26di37_Service1, null)) + if (ReferenceEquals(_scopedM03D27di37_Service1, null)) { - _scopedM03D26di37_Service1 = new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4))); + _scopedM03D27di37_Service1 = new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4))); } - return new Pure.DI.Benchmarks.Model.CompositionRoot(_scopedM03D26di37_Service1, new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4)), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D26di40_Service4, _scopedM03D26di40_Service4), _scopedM03D26di40_Service4, _scopedM03D26di40_Service4); + return new Pure.DI.Benchmarks.Model.CompositionRoot(_scopedM03D27di37_Service1, new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4)), new Pure.DI.Benchmarks.Model.Service3(_scopedM03D27di40_Service4, _scopedM03D27di40_Service4), _scopedM03D27di40_Service4, _scopedM03D27di40_Service4); } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -123,10 +123,10 @@ partial class Singleton public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -196,25 +196,25 @@ partial class Singleton " Singleton ..> CompositionRoot : CompositionRoot PureDIByCR()"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Singleton() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Singleton composite) { @@ -227,7 +227,7 @@ partial class Singleton } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Singleton composition) { diff --git a/readme/TransientDetails.md b/readme/TransientDetails.md index bc57a6ae2..14339afb1 100644 --- a/readme/TransientDetails.md +++ b/readme/TransientDetails.md @@ -69,16 +69,16 @@ classDiagram ```c# partial class Transient { - private readonly Transient _rootM03D26di; + private readonly Transient _rootM03D27di; public Transient() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Transient(Transient baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR() @@ -88,20 +88,20 @@ partial class Transient public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -113,10 +113,10 @@ partial class Transient public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -186,25 +186,25 @@ partial class Transient " Transient ..> CompositionRoot : CompositionRoot PureDIByCR()"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Transient() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Transient composite) { @@ -217,7 +217,7 @@ partial class Transient } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Transient composition) { diff --git a/readme/WebAPI.md b/readme/WebAPI.md index 79bd5837d..af9fa71bf 100644 --- a/readme/WebAPI.md +++ b/readme/WebAPI.md @@ -51,11 +51,11 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/WebApp.md b/readme/WebApp.md index 5065ef47c..07488e6c6 100644 --- a/readme/WebApp.md +++ b/readme/WebApp.md @@ -51,11 +51,11 @@ The [project file](/samples/WebApp/WebApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/readme/WinFormsApp.md b/readme/WinFormsApp.md index a73d3395f..ab28c8983 100644 --- a/readme/WinFormsApp.md +++ b/readme/WinFormsApp.md @@ -55,7 +55,7 @@ The [project file](/samples/WinFormsApp/WinFormsApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WinFormsAppNetCore.md b/readme/WinFormsAppNetCore.md index af5c8e75c..7fd8787cc 100644 --- a/readme/WinFormsAppNetCore.md +++ b/readme/WinFormsAppNetCore.md @@ -62,7 +62,7 @@ The [project file](/samples/WinFormsAppNetCore/WinFormsAppNetCore.csproj) looks - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Wpf.md b/readme/Wpf.md index b55bb50c7..5e1fce822 100644 --- a/readme/Wpf.md +++ b/readme/Wpf.md @@ -68,7 +68,7 @@ The [project file](/samples/WpfAppNetCore/WpfAppNetCore.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/a-few-partial-classes.md b/readme/a-few-partial-classes.md index c4c3e5077..6de85b30e 100644 --- a/readme/a-few-partial-classes.md +++ b/readme/a-few-partial-classes.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService Root @@ -101,20 +101,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -126,10 +126,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -168,25 +168,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -199,7 +199,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService Resolve(Composition composition) { diff --git a/readme/accumulators.md b/readme/accumulators.md index 76b348598..854f261d1 100644 --- a/readme/accumulators.md +++ b/readme/accumulators.md @@ -90,67 +90,67 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM03D26di38_XyzDependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM03D27di38_XyzDependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public (Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator) Root { get { - var accumulatorM03D26di41 = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator(); - Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency perBlockM03D26di4_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); - if (ReferenceEquals(_rootM03D26di._singletonM03D26di38_XyzDependency, null)) + var accumulatorM03D27di41 = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator(); + Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency perBlockM03D27di4_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); + if (ReferenceEquals(_rootM03D27di._singletonM03D27di38_XyzDependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di38_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di38_XyzDependency, null)) { - Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM03D26di38_XyzDependencyTemp; - _singletonM03D26di38_XyzDependencyTemp = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency(); - accumulatorM03D26di41.Add(_singletonM03D26di38_XyzDependencyTemp); + Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM03D27di38_XyzDependencyTemp; + _singletonM03D27di38_XyzDependencyTemp = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency(); + accumulatorM03D27di41.Add(_singletonM03D27di38_XyzDependencyTemp); global::System.Threading.Thread.MemoryBarrier(); - _singletonM03D26di38_XyzDependency = _singletonM03D26di38_XyzDependencyTemp; - _rootM03D26di._singletonM03D26di38_XyzDependency = _singletonM03D26di38_XyzDependency; + _singletonM03D27di38_XyzDependency = _singletonM03D27di38_XyzDependencyTemp; + _rootM03D27di._singletonM03D27di38_XyzDependency = _singletonM03D27di38_XyzDependency; } } } - Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency transientM03D26di3_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); - accumulatorM03D26di41.Add(transientM03D26di3_AbcDependency); - Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service transientM03D26di1_Service = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service(transientM03D26di3_AbcDependency, _rootM03D26di._singletonM03D26di38_XyzDependency, perBlockM03D26di4_AbcDependency); - accumulatorM03D26di41.Add(transientM03D26di1_Service); - return (transientM03D26di1_Service, accumulatorM03D26di41); + Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency transientM03D27di3_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); + accumulatorM03D27di41.Add(transientM03D27di3_AbcDependency); + Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service transientM03D27di1_Service = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service(transientM03D27di3_AbcDependency, _rootM03D27di._singletonM03D27di38_XyzDependency, perBlockM03D27di4_AbcDependency); + accumulatorM03D27di41.Add(transientM03D27di1_Service); + return (transientM03D27di1_Service, accumulatorM03D27di41); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -162,10 +162,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -216,25 +216,25 @@ partial class Composition " Composition ..> ValueTupleᐸIServiceˏMyAccumulatorᐳ : ValueTupleᐸIServiceˏMyAccumulatorᐳ Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di<(Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)>.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di<(Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)>.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof((Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof((Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -247,7 +247,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver, global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver, global::Pure.DI.IResolver { public (Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator) Resolve(Composition composition) { diff --git a/readme/advanced-interception.md b/readme/advanced-interception.md index d61f7c0fe..081f1d037 100644 --- a/readme/advanced-interception.md +++ b/readme/advanced-interception.md @@ -93,7 +93,7 @@ internal partial class Composition: IInterceptor // OnDependencyInjection = On DI.Setup(nameof(Composition)) - .Bind().To() + .Bind().To() .RootBind("Root").To(); var log = new List(); @@ -147,16 +147,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService Root @@ -169,20 +169,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -194,10 +194,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -238,25 +238,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -269,7 +269,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService Resolve(Composition composition) { diff --git a/readme/arguments.md b/readme/arguments.md index ce64038f8..425edd9f4 100644 --- a/readme/arguments.md +++ b/readme/arguments.md @@ -34,9 +34,13 @@ class Service( DI.Setup(nameof(Composition)) .Bind().To() .Bind().To() + + // Composition root .Root("Root") + // Some kind of identifier .Arg("id") + // An argument can be tagged (e.g., tag "name") // to be injectable by type and this tag .Arg("serviceName", "name"); @@ -92,53 +96,53 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly int _argM03D26di_id; - private readonly string _argM03D26di_serviceName; + private readonly Composition _rootM03D27di; + private readonly int _argM03D27di_id; + private readonly string _argM03D27di_serviceName; public Composition(int id, string serviceName) { - _rootM03D26di = this; + _rootM03D27di = this; if (ReferenceEquals(serviceName, null)) { throw new global::System.ArgumentNullException("serviceName"); } - _argM03D26di_id = id; - _argM03D26di_serviceName = serviceName; + _argM03D27di_id = id; + _argM03D27di_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _argM03D26di_id = baseComposition._argM03D26di_id; - _argM03D26di_serviceName = baseComposition._argM03D26di_serviceName; + _rootM03D27di = baseComposition._rootM03D27di; + _argM03D27di_id = baseComposition._argM03D27di_id; + _argM03D27di_serviceName = baseComposition._argM03D27di_serviceName; } public Pure.DI.UsageTests.Basics.ArgumentsScenario.IService Root { get { - return new Pure.DI.UsageTests.Basics.ArgumentsScenario.Service(_argM03D26di_serviceName, new Pure.DI.UsageTests.Basics.ArgumentsScenario.Dependency(_argM03D26di_id)); + return new Pure.DI.UsageTests.Basics.ArgumentsScenario.Service(_argM03D27di_serviceName, new Pure.DI.UsageTests.Basics.ArgumentsScenario.Dependency(_argM03D27di_id)); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -150,10 +154,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -196,25 +200,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ArgumentsScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ArgumentsScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -227,7 +231,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.ArgumentsScenario.IService Resolve(Composition composition) { diff --git a/readme/array.md b/readme/array.md index 01717abdf..1238de719 100644 --- a/readme/array.md +++ b/readme/array.md @@ -104,16 +104,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.ArrayScenario.IService Root @@ -126,20 +126,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -151,10 +151,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -200,25 +200,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ArrayScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ArrayScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -231,7 +231,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ArrayScenario.IService Resolve(Composition composition) { diff --git a/readme/async-enumerable.md b/readme/async-enumerable.md index 16fa84bfa..69f9e6af5 100644 --- a/readme/async-enumerable.md +++ b/readme/async-enumerable.md @@ -87,16 +87,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService Root @@ -104,32 +104,32 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - async System.Collections.Generic.IAsyncEnumerable LocaltransientM03D26di1_IAsyncEnumerable() + async System.Collections.Generic.IAsyncEnumerable LocaltransientM03D27di1_IAsyncEnumerable() { yield return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.XyzDependency(); } - System.Collections.Generic.IAsyncEnumerable transientM03D26di1_IAsyncEnumerable = LocaltransientM03D26di1_IAsyncEnumerable(); - return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.Service(transientM03D26di1_IAsyncEnumerable); + System.Collections.Generic.IAsyncEnumerable transientM03D27di1_IAsyncEnumerable = LocaltransientM03D27di1_IAsyncEnumerable(); + return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.Service(transientM03D27di1_IAsyncEnumerable); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -141,10 +141,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -190,25 +190,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -221,7 +221,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService Resolve(Composition composition) { diff --git a/readme/auto-bindings.md b/readme/auto-bindings.md index c6b04f560..a76c68722 100644 --- a/readme/auto-bindings.md +++ b/readme/auto-bindings.md @@ -11,6 +11,7 @@ class Service(Dependency dependency); // Specifies to create a partial class "Composition" DI.Setup("Composition") + // Specifies to create a property "MyService" .Root("MyService"); @@ -50,16 +51,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.AutoBindingsScenario.Service MyService diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index 6b03acfd4..f2cec5579 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -29,11 +29,11 @@ partial class Composition { private static void Setup() => DI.Setup(nameof(Composition)) - .Bind().As(Scoped).To() + .Bind().As(Scoped).To() // Session composition root .Root("SessionRoot", kind: RootKinds.Private) // Auto scoped - .Bind().To(ctx => + .Bind().To(ctx => { // Injects a base composition ctx.Inject(out Composition baseComposition); @@ -43,6 +43,7 @@ partial class Composition return session.SessionRoot; }) + // Program composition root .Root("ProgramRoot"); } @@ -105,37 +106,37 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency _scopedM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency _scopedM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } private Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service SessionRoot { get { - if (ReferenceEquals(_scopedM03D26di36_Dependency, null)) + if (ReferenceEquals(_scopedM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_scopedM03D26di36_Dependency, null)) + if (ReferenceEquals(_scopedM03D27di36_Dependency, null)) { - _scopedM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency(); + _scopedM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency(); } } } - return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service(_scopedM03D26di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service(_scopedM03D27di36_Dependency); } } @@ -143,42 +144,42 @@ partial class Composition { get { - var perResolveM03D26di41_Func = default(System.Func); - perResolveM03D26di41_Func = new global::System.Func( + var perResolveM03D27di41_Func = default(System.Func); + perResolveM03D27di41_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Composition transientM03D26di2_Composition = this; - Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.IService transientM03D26di1_IService; + Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Composition transientM03D27di2_Composition = this; + Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.IService transientM03D27di1_IService; { - var baseComposition_M03D26di2 = transientM03D26di2_Composition; + var baseComposition_M03D27di2 = transientM03D27di2_Composition; // Creates a session - var session_M03D26di3 = new Composition(baseComposition_M03D26di2); - transientM03D26di1_IService = session_M03D26di3.SessionRoot; + var session_M03D27di3 = new Composition(baseComposition_M03D27di2); + transientM03D27di1_IService = session_M03D27di3.SessionRoot; } - var factory_M03D26di1 = transientM03D26di1_IService; - return factory_M03D26di1; + var factory_M03D27di1 = transientM03D27di1_IService; + return factory_M03D27di1; }); - return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program(perResolveM03D26di41_Func); + return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program(perResolveM03D27di41_Func); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -190,10 +191,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -239,28 +240,28 @@ partial class Composition " FuncᐸIServiceᐳ *-- IService : IService"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -273,7 +274,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service Resolve(Composition composition) { @@ -291,7 +292,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program Resolve(Composition composition) { diff --git a/readme/check-for-a-root.md b/readme/check-for-a-root.md index b6075e86e..56bd0598e 100644 --- a/readme/check-for-a-root.md +++ b/readme/check-for-a-root.md @@ -34,9 +34,10 @@ partial class Composition // to register each root .Hint(Hint.OnNewRoot, "On") - .Bind("MyDep").To() - .Bind().To() + .Bind("MyDep").To() + .Bind().To() + // Composition roots .Root(tag: "MyDep") .Root("Root"); @@ -64,7 +65,7 @@ Composition.HasRoot(typeof(IComparable)).ShouldBeFalse(); classDiagram class Composition { +IService Root - -IDependency RootM03D26di0001 + -IDependency _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) @@ -86,7 +87,7 @@ classDiagram <> } Service *-- Dependency : "MyDep" IDependency - Composition ..> Dependency : IDependency RootM03D26di0001 + Composition ..> Dependency : IDependency _ Composition ..> Service : IService Root ``` @@ -98,16 +99,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Hints.CheckForRootScenario.IService Root @@ -121,7 +122,7 @@ partial class Composition } } - public Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency RootM03D26di0001 + public Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency RootM03D27di0001 { get { @@ -131,20 +132,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -156,10 +157,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -175,7 +176,7 @@ partial class Composition "classDiagram\n" + " class Composition {\n" + " +IService Root\n" + - " -IDependency RootM03D26di0001\n" + + " -IDependency _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object Resolve(Type type)\n" + @@ -197,36 +198,36 @@ partial class Composition " <>\n" + " }\n" + " Service *-- Dependency : \"MyDep\" IDependency\n" + - " Composition ..> Dependency : IDependency RootM03D26di0001\n" + + " Composition ..> Dependency : IDependency _\n" + " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; private static partial void OnNewRoot(global::Pure.DI.IResolver resolver, string name, object? tag, global::Pure.DI.Lifetime lifetime); static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - OnNewRoot(valResolverM03D26di_0000, "Root", null, Pure.DI.Lifetime.Transient); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - OnNewRoot(valResolverM03D26di_0001, "RootM03D26di0001", "MyDep", Pure.DI.Lifetime.Transient); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + OnNewRoot(valResolverM03D27di_0000, "Root", null, Pure.DI.Lifetime.Transient); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + OnNewRoot(valResolverM03D27di_0001, "RootM03D27di0001", "MyDep", Pure.DI.Lifetime.Transient); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -239,7 +240,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.CheckForRootScenario.IService Resolve(Composition composition) { @@ -257,7 +258,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency Resolve(Composition composition) { @@ -269,7 +270,7 @@ partial class Composition switch (tag) { case "MyDep": - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency."); } diff --git a/readme/complex-generics.md b/readme/complex-generics.md index 7fb8ae399..13788a710 100644 --- a/readme/complex-generics.md +++ b/readme/complex-generics.md @@ -46,6 +46,8 @@ DI.Setup(nameof(Composition)) .Bind>("value type").To>() .Bind, TTDictionary>>() .To, TTDictionary>>() + + // Composition root .Root>("Root"); var composition = new Composition(); @@ -108,16 +110,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program Root @@ -130,20 +132,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -155,10 +157,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -209,25 +211,25 @@ partial class Composition " ServiceᐸStringˏInt32ˏListᐸStringᐳˏDictionaryᐸStringˏInt32ᐳᐳ *-- DependencyStructᐸInt32ᐳ : \"value type\" IDependencyᐸInt32ᐳ"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di>.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di>.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -240,7 +242,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver> + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program Resolve(Composition composition) { diff --git a/readme/composition-root-kinds.md b/readme/composition-root-kinds.md index eb417d099..659b3e796 100644 --- a/readme/composition-root-kinds.md +++ b/readme/composition-root-kinds.md @@ -87,16 +87,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } private partial Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService GetRoot() @@ -119,20 +119,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -144,10 +144,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -194,28 +194,28 @@ partial class Composition " Composition ..> Dependency : IDependency Dependency"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IDependency), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IDependency), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -228,7 +228,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService Resolve(Composition composition) { @@ -248,7 +248,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IDependency Resolve(Composition composition) { diff --git a/readme/composition-roots-simplified.md b/readme/composition-roots-simplified.md index 9d8c88904..15f5d74b8 100644 --- a/readme/composition-roots-simplified.md +++ b/readme/composition-roots-simplified.md @@ -2,6 +2,8 @@ [![CSharp](https://img.shields.io/badge/C%23-code-blue.svg)](../tests/Pure.DI.UsageTests/Basics/CompositionRootsSimplifiedScenario.cs) +You can use `RootBind()` method in order to reduce repetitions. + ```c# interface IDependency; @@ -44,7 +46,7 @@ var someOtherService = composition.Resolve("Other"); classDiagram class Composition { +IService MyRoot - -IService RootM03D26di0002 + -IService _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) @@ -70,7 +72,7 @@ classDiagram } Service *-- Dependency : IDependency Composition ..> Service : IService MyRoot - Composition ..> OtherService : IService RootM03D26di0002 + Composition ..> OtherService : IService _ ``` @@ -81,16 +83,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService MyRoot @@ -101,7 +103,7 @@ partial class Composition } } - public Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService RootM03D26di0002 + public Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService RootM03D27di0002 { get { @@ -111,20 +113,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -136,10 +138,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -155,7 +157,7 @@ partial class Composition "classDiagram\n" + " class Composition {\n" + " +IService MyRoot\n" + - " -IService RootM03D26di0002\n" + + " -IService _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object Resolve(Type type)\n" + @@ -181,28 +183,28 @@ partial class Composition " }\n" + " Service *-- Dependency : IDependency\n" + " Composition ..> Service : IService MyRoot\n" + - " Composition ..> OtherService : IService RootM03D26di0002"; + " Composition ..> OtherService : IService _"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -215,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService Resolve(Composition composition) { @@ -227,7 +229,7 @@ partial class Composition switch (tag) { case "Other": - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; case null: return composition.MyRoot; } diff --git a/readme/composition-roots.md b/readme/composition-roots.md index 45ae8267b..029418838 100644 --- a/readme/composition-roots.md +++ b/readme/composition-roots.md @@ -71,7 +71,7 @@ classDiagram class Composition { +IService MyRoot +IService SomeOtherService - -IDependency RootM03D26di0003 + -IDependency _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) @@ -98,7 +98,7 @@ classDiagram Service *-- Dependency : IDependency Composition ..> OtherService : IService SomeOtherService Composition ..> Service : IService MyRoot - Composition ..> Dependency : IDependency RootM03D26di0003 + Composition ..> Dependency : IDependency _ ``` @@ -109,16 +109,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService MyRoot @@ -137,7 +137,7 @@ partial class Composition } } - public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency RootM03D26di0003 + public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency RootM03D27di0003 { get { @@ -147,20 +147,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -172,10 +172,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -192,7 +192,7 @@ partial class Composition " class Composition {\n" + " +IService MyRoot\n" + " +IService SomeOtherService\n" + - " -IDependency RootM03D26di0003\n" + + " -IDependency _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object Resolve(Type type)\n" + @@ -219,31 +219,31 @@ partial class Composition " Service *-- Dependency : IDependency\n" + " Composition ..> OtherService : IService SomeOtherService\n" + " Composition ..> Service : IService MyRoot\n" + - " Composition ..> Dependency : IDependency RootM03D26di0003"; + " Composition ..> Dependency : IDependency _"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -256,7 +256,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService Resolve(Composition composition) { @@ -276,11 +276,11 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency Resolve(Composition composition) { - return composition.RootM03D26di0003; + return composition.RootM03D27di0003; } public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -288,7 +288,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM03D26di0003; + return composition.RootM03D27di0003; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency."); } diff --git a/readme/constructor-ordinal-attribute.md b/readme/constructor-ordinal-attribute.md index 10b1b3525..a47c4d292 100644 --- a/readme/constructor-ordinal-attribute.md +++ b/readme/constructor-ordinal-attribute.md @@ -71,50 +71,50 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly string _argM03D26di_serviceName; + private readonly Composition _rootM03D27di; + private readonly string _argM03D27di_serviceName; public Composition(string serviceName) { - _rootM03D26di = this; + _rootM03D27di = this; if (ReferenceEquals(serviceName, null)) { throw new global::System.ArgumentNullException("serviceName"); } - _argM03D26di_serviceName = serviceName; + _argM03D27di_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _argM03D26di_serviceName = baseComposition._argM03D26di_serviceName; + _rootM03D27di = baseComposition._rootM03D27di; + _argM03D27di_serviceName = baseComposition._argM03D27di_serviceName; } public Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService Root { get { - return new Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.Service(_argM03D26di_serviceName); + return new Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.Service(_argM03D27di_serviceName); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -126,10 +126,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -162,25 +162,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -193,7 +193,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService Resolve(Composition composition) { diff --git a/readme/custom-attributes.md b/readme/custom-attributes.md index fadd0d65e..59e7a8148 100644 --- a/readme/custom-attributes.md +++ b/readme/custom-attributes.md @@ -87,48 +87,48 @@ classDiagram ```c# partial class PersonComposition { - private readonly PersonComposition _rootM03D26di; - private readonly int _argM03D26di_personId; + private readonly PersonComposition _rootM03D27di; + private readonly int _argM03D27di_personId; public PersonComposition(int personId) { - _rootM03D26di = this; - _argM03D26di_personId = personId; + _rootM03D27di = this; + _argM03D27di_personId = personId; } internal PersonComposition(PersonComposition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _argM03D26di_personId = baseComposition._argM03D26di_personId; + _rootM03D27di = baseComposition._rootM03D27di; + _argM03D27di_personId = baseComposition._argM03D27di_personId; } public Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson Person { get { - string transientM03D26di1_String = "Nik"; - Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person transientM03D26di0_Person = new Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person(transientM03D26di1_String); - transientM03D26di0_Person.Id = _argM03D26di_personId; - return transientM03D26di0_Person; + string transientM03D27di1_String = "Nik"; + Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person transientM03D27di0_Person = new Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person(transientM03D27di1_String); + transientM03D27di0_Person.Id = _argM03D27di_personId; + return transientM03D27di0_Person; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -140,10 +140,10 @@ partial class PersonComposition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -179,25 +179,25 @@ partial class PersonComposition " PersonComposition ..> Person : IPerson Person"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static PersonComposition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(PersonComposition composite) { @@ -210,7 +210,7 @@ partial class PersonComposition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson Resolve(PersonComposition composition) { diff --git a/readme/decorator.md b/readme/decorator.md index 08c3b230d..de508fe44 100644 --- a/readme/decorator.md +++ b/readme/decorator.md @@ -19,8 +19,8 @@ class GreetingService([Tag("base")] IService baseService): IService DI.Setup(nameof(Composition)) - .Bind("base").To() - .Bind().To().Root("Root"); + .Bind("base").To() + .RootBind("Root").To(); var composition = new Composition(); var service = composition.Root; @@ -64,16 +64,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Interception.DecoratorScenario.IService Root @@ -86,20 +86,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -111,10 +111,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -150,25 +150,25 @@ partial class Composition " Composition ..> GreetingService : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.DecoratorScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.DecoratorScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -181,7 +181,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Interception.DecoratorScenario.IService Resolve(Composition composition) { diff --git a/readme/default-lifetime.md b/readme/default-lifetime.md index 3980566b7..d613060a5 100644 --- a/readme/default-lifetime.md +++ b/readme/default-lifetime.md @@ -28,8 +28,8 @@ class Service( DI.Setup(nameof(Composition)) .DefaultLifetime(Lifetime.Singleton) - .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + .RootBind("Root").To(); var composition = new Composition(); var service1 = composition.Root; @@ -77,63 +77,63 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service _singletonM03D26di37_Service; - private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service _singletonM03D27di37_Service; + private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService Root { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_Service, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_Service, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_Service, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_Service, null)) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } - _singletonM03D26di37_Service = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service(_singletonM03D26di36_Dependency, _rootM03D26di._singletonM03D26di36_Dependency); - _rootM03D26di._singletonM03D26di37_Service = _singletonM03D26di37_Service; + _singletonM03D27di37_Service = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service(_singletonM03D27di36_Dependency, _rootM03D27di._singletonM03D27di36_Dependency); + _rootM03D27di._singletonM03D27di37_Service = _singletonM03D27di37_Service; } } } - return _rootM03D26di._singletonM03D26di37_Service; + return _rootM03D27di._singletonM03D27di37_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -145,10 +145,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -188,25 +188,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -219,7 +219,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService Resolve(Composition composition) { diff --git a/readme/default-values.md b/readme/default-values.md index 041cbcfa1..03f6da4ff 100644 --- a/readme/default-values.md +++ b/readme/default-values.md @@ -23,7 +23,10 @@ class Service(string name = "My Service") : IService DI.Setup(nameof(Composition)) .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -70,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService Root @@ -95,20 +98,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -120,10 +123,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -163,25 +166,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -194,7 +197,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService Resolve(Composition composition) { diff --git a/readme/dependent-compositions.md b/readme/dependent-compositions.md index aa891e0f6..62a3630c3 100644 --- a/readme/dependent-compositions.md +++ b/readme/dependent-compositions.md @@ -89,16 +89,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Root @@ -111,20 +111,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -136,10 +136,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -178,25 +178,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -209,7 +209,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Resolve(Composition composition) { @@ -237,16 +237,16 @@ partial class Composition ```c# partial class OtherComposition { - private readonly OtherComposition _rootM03D26di; + private readonly OtherComposition _rootM03D27di; public OtherComposition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal OtherComposition(OtherComposition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Root @@ -267,20 +267,20 @@ partial class OtherComposition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -292,10 +292,10 @@ partial class OtherComposition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -340,28 +340,28 @@ partial class OtherComposition " OtherComposition ..> Program : Program Program"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static OtherComposition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.Program), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.Program), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(OtherComposition composite) { @@ -374,7 +374,7 @@ partial class OtherComposition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Resolve(OtherComposition composition) { @@ -392,7 +392,7 @@ partial class OtherComposition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.Program Resolve(OtherComposition composition) { diff --git a/readme/disposable-singleton.md b/readme/disposable-singleton.md index 4790143db..7ad494536 100644 --- a/readme/disposable-singleton.md +++ b/readme/disposable-singleton.md @@ -28,9 +28,8 @@ class Service(IDependency dependency): IService } DI.Setup(nameof(Composition)) - .Bind().As(Lifetime.Singleton).To() - .Bind().To() - .Root("Root"); + .Bind().As(Lifetime.Singleton).To() + .RootBind("Root").To(); IDependency dependency; using (var composition = new Composition()) @@ -83,61 +82,61 @@ classDiagram ```c# partial class Composition: global::System.IDisposable { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private readonly global::System.IDisposable[] _disposablesM03D26di; - private int _disposeIndexM03D26di; - private Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private readonly global::System.IDisposable[] _disposablesM03D27di; + private int _disposeIndexM03D27di; + private Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); - _disposablesM03D26di = new global::System.IDisposable[1]; + _rootM03D27di = this; + _lockM03D27di = new object(); + _disposablesM03D27di = new global::System.IDisposable[1]; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService Root { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; - _rootM03D26di._disposablesM03D26di[_rootM03D26di._disposeIndexM03D26di++] = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; + _rootM03D27di._disposablesM03D27di[_rootM03D27di._disposeIndexM03D27di++] = _singletonM03D27di36_Dependency; } } } - return new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Service(_rootM03D26di._singletonM03D26di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Service(_rootM03D27di._singletonM03D27di36_Dependency); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -149,10 +148,10 @@ partial class Composition: global::System.IDisposable public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -165,11 +164,11 @@ partial class Composition: global::System.IDisposable public void Dispose() { - lock (_lockM03D26di) + lock (_lockM03D27di) { - while (_disposeIndexM03D26di > 0) + while (_disposeIndexM03D27di > 0) { - var disposableInstance = _disposablesM03D26di[--_disposeIndexM03D26di]; + var disposableInstance = _disposablesM03D27di[--_disposeIndexM03D27di]; try { disposableInstance.Dispose(); @@ -180,7 +179,7 @@ partial class Composition: global::System.IDisposable } } - _singletonM03D26di36_Dependency = null; + _singletonM03D27di36_Dependency = null; } } @@ -216,25 +215,25 @@ partial class Composition: global::System.IDisposable " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -247,7 +246,7 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService Resolve(Composition composition) { diff --git a/readme/enumerable-generics.md b/readme/enumerable-generics.md index cde617d58..967287575 100644 --- a/readme/enumerable-generics.md +++ b/readme/enumerable-generics.md @@ -109,16 +109,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService IntRoot @@ -126,13 +126,13 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM03D26di1_IEnumerable() + System.Collections.Generic.IEnumerable> LocalperBlockM03D27di1_IEnumerable() { yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM03D26di1_IEnumerable = LocalperBlockM03D26di1_IEnumerable(); - return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM03D26di1_IEnumerable); + System.Collections.Generic.IEnumerable> perBlockM03D27di1_IEnumerable = LocalperBlockM03D27di1_IEnumerable(); + return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM03D27di1_IEnumerable); } } @@ -141,32 +141,32 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM03D26di1_IEnumerable() + System.Collections.Generic.IEnumerable> LocalperBlockM03D27di1_IEnumerable() { yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM03D26di1_IEnumerable = LocalperBlockM03D26di1_IEnumerable(); - return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM03D26di1_IEnumerable); + System.Collections.Generic.IEnumerable> perBlockM03D27di1_IEnumerable = LocalperBlockM03D27di1_IEnumerable(); + return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM03D27di1_IEnumerable); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -178,10 +178,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -251,28 +251,28 @@ partial class Composition " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di>.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di>.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di>.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di>.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -285,7 +285,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver> + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService Resolve(Composition composition) { @@ -303,7 +303,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver> + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService Resolve(Composition composition) { diff --git a/readme/enumerable.md b/readme/enumerable.md index b82018560..b1e1072f6 100644 --- a/readme/enumerable.md +++ b/readme/enumerable.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.EnumerableScenario.IService Root @@ -96,32 +96,32 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable LocalperBlockM03D26di1_IEnumerable() + System.Collections.Generic.IEnumerable LocalperBlockM03D27di1_IEnumerable() { yield return new Pure.DI.UsageTests.BCL.EnumerableScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.EnumerableScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable perBlockM03D26di1_IEnumerable = LocalperBlockM03D26di1_IEnumerable(); - return new Pure.DI.UsageTests.BCL.EnumerableScenario.Service(perBlockM03D26di1_IEnumerable); + System.Collections.Generic.IEnumerable perBlockM03D27di1_IEnumerable = LocalperBlockM03D27di1_IEnumerable(); + return new Pure.DI.UsageTests.BCL.EnumerableScenario.Service(perBlockM03D27di1_IEnumerable); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -133,10 +133,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -182,25 +182,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -213,7 +213,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.EnumerableScenario.IService Resolve(Composition composition) { diff --git a/readme/factory.md b/readme/factory.md index 7e9d1fc38..ce0f4b5de 100644 --- a/readme/factory.md +++ b/readme/factory.md @@ -32,13 +32,17 @@ class Service(IDependency dependency) : IService } DI.Setup(nameof(Composition)) - .Bind().To(_ => + .Bind().To(_ => DateTimeOffset.Now) + .Bind().To(ctx => { - var dependency = new Dependency(DateTimeOffset.Now); + ctx.Inject(out Dependency dependency); dependency.Initialize(); return dependency; }) - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -57,18 +61,58 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } - Dependency --|> IDependency : - class Dependency + class Dependency { + +Dependency(DateTimeOffset time) + } + DateTimeOffset --|> IComparable : + DateTimeOffset --|> IComparableᐸDateTimeOffsetᐳ : + DateTimeOffset --|> IEquatableᐸDateTimeOffsetᐳ : + DateTimeOffset --|> ISpanFormattable : + DateTimeOffset --|> IFormattable : + DateTimeOffset --|> ISpanParsableᐸDateTimeOffsetᐳ : + DateTimeOffset --|> IParsableᐸDateTimeOffsetᐳ : + DateTimeOffset --|> IDeserializationCallback : + DateTimeOffset --|> ISerializable : + DateTimeOffset --|> IUtf8SpanFormattable : + class DateTimeOffset Service --|> IService : class Service { +Service(IDependency dependency) } - class IDependency { + class IComparable { + <> + } + class IComparableᐸDateTimeOffsetᐳ { + <> + } + class IEquatableᐸDateTimeOffsetᐳ { + <> + } + class ISpanFormattable { + <> + } + class IFormattable { + <> + } + class ISpanParsableᐸDateTimeOffsetᐳ { + <> + } + class IParsableᐸDateTimeOffsetᐳ { + <> + } + class IDeserializationCallback { + <> + } + class ISerializable { + <> + } + class IUtf8SpanFormattable { <> } class IService { <> } + Dependency *-- DateTimeOffset : DateTimeOffset Service *-- Dependency : IDependency Composition ..> Service : IService Root ``` @@ -81,48 +125,49 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.FactoryScenario.IService Root { get { - Pure.DI.UsageTests.Basics.FactoryScenario.Dependency transientM03D26di1_Dependency; + System.DateTimeOffset transientM03D27di3_DateTimeOffset = DateTimeOffset.Now; + Pure.DI.UsageTests.Basics.FactoryScenario.Dependency transientM03D27di1_Dependency; { - var dependency_M03D26di1 = new Dependency(DateTimeOffset.Now); - dependency_M03D26di1.Initialize(); - transientM03D26di1_Dependency = dependency_M03D26di1; + var dependency_M03D27di1 = new Pure.DI.UsageTests.Basics.FactoryScenario.Dependency(transientM03D27di3_DateTimeOffset); + dependency_M03D27di1.Initialize(); + transientM03D27di1_Dependency = dependency_M03D27di1; } - return new Pure.DI.UsageTests.Basics.FactoryScenario.Service(transientM03D26di1_Dependency); + return new Pure.DI.UsageTests.Basics.FactoryScenario.Service(transientM03D27di1_Dependency); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -134,10 +179,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -158,41 +203,81 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " Dependency --|> IDependency : \n" + - " class Dependency\n" + + " class Dependency {\n" + + " +Dependency(DateTimeOffset time)\n" + + " }\n" + + " DateTimeOffset --|> IComparable : \n" + + " DateTimeOffset --|> IComparableᐸDateTimeOffsetᐳ : \n" + + " DateTimeOffset --|> IEquatableᐸDateTimeOffsetᐳ : \n" + + " DateTimeOffset --|> ISpanFormattable : \n" + + " DateTimeOffset --|> IFormattable : \n" + + " DateTimeOffset --|> ISpanParsableᐸDateTimeOffsetᐳ : \n" + + " DateTimeOffset --|> IParsableᐸDateTimeOffsetᐳ : \n" + + " DateTimeOffset --|> IDeserializationCallback : \n" + + " DateTimeOffset --|> ISerializable : \n" + + " DateTimeOffset --|> IUtf8SpanFormattable : \n" + + " class DateTimeOffset\n" + " Service --|> IService : \n" + " class Service {\n" + " +Service(IDependency dependency)\n" + " }\n" + - " class IDependency {\n" + + " class IComparable {\n" + + " <>\n" + + " }\n" + + " class IComparableᐸDateTimeOffsetᐳ {\n" + + " <>\n" + + " }\n" + + " class IEquatableᐸDateTimeOffsetᐳ {\n" + + " <>\n" + + " }\n" + + " class ISpanFormattable {\n" + + " <>\n" + + " }\n" + + " class IFormattable {\n" + + " <>\n" + + " }\n" + + " class ISpanParsableᐸDateTimeOffsetᐳ {\n" + + " <>\n" + + " }\n" + + " class IParsableᐸDateTimeOffsetᐳ {\n" + + " <>\n" + + " }\n" + + " class IDeserializationCallback {\n" + + " <>\n" + + " }\n" + + " class ISerializable {\n" + + " <>\n" + + " }\n" + + " class IUtf8SpanFormattable {\n" + " <>\n" + " }\n" + " class IService {\n" + " <>\n" + " }\n" + + " Dependency *-- DateTimeOffset : DateTimeOffset\n" + " Service *-- Dependency : IDependency\n" + " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FactoryScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FactoryScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -205,7 +290,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.FactoryScenario.IService Resolve(Composition composition) { diff --git a/readme/field-injection.md b/readme/field-injection.md index 030564df3..1d648b5b0 100644 --- a/readme/field-injection.md +++ b/readme/field-injection.md @@ -24,7 +24,10 @@ class Service : IService DI.Setup(nameof(Composition)) .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -70,44 +73,44 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService Root { get { - Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service transientM03D26di0_Service = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service(); - transientM03D26di0_Service.DependencyVal = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Dependency(); - return transientM03D26di0_Service; + Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service transientM03D27di0_Service = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service(); + transientM03D27di0_Service.DependencyVal = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Dependency(); + return transientM03D27di0_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -119,10 +122,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -162,25 +165,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -193,7 +196,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/func-with-arguments.md b/readme/func-with-arguments.md index 652424020..1a72bc56b 100644 --- a/readme/func-with-arguments.md +++ b/readme/func-with-arguments.md @@ -107,63 +107,63 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock _singletonM03D26di36_Clock; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock _singletonM03D27di36_Clock; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService Root { get { - System.Func transientM03D26di1_Func = dependencyId => + System.Func transientM03D27di1_Func = dependencyId => { - int transientM03D26di3_Int32 = dependencyId; - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Clock, null)) + int transientM03D27di3_Int32 = dependencyId; + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Clock, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Clock, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Clock, null)) { - _singletonM03D26di36_Clock = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock(); - _rootM03D26di._singletonM03D26di36_Clock = _singletonM03D26di36_Clock; + _singletonM03D27di36_Clock = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock(); + _rootM03D27di._singletonM03D27di36_Clock = _singletonM03D27di36_Clock; } } } - var dependency_M03D26di1 = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Dependency(_rootM03D26di._singletonM03D26di36_Clock, transientM03D26di3_Int32); - return dependency_M03D26di1; + var dependency_M03D27di1 = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Dependency(_rootM03D27di._singletonM03D27di36_Clock, transientM03D27di3_Int32); + return dependency_M03D27di1; }; - return new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Service(transientM03D26di1_Func); + return new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Service(transientM03D27di1_Func); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -175,10 +175,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -225,25 +225,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -256,7 +256,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService Resolve(Composition composition) { diff --git a/readme/func-with-tag.md b/readme/func-with-tag.md index d839efcd9..cf1ced246 100644 --- a/readme/func-with-tag.md +++ b/readme/func-with-tag.md @@ -72,53 +72,53 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService Root { get { - var perResolveM03D26di38_Func = default(System.Func); - perResolveM03D26di38_Func = new global::System.Func( + var perResolveM03D27di38_Func = default(System.Func); + perResolveM03D27di38_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M03D26di1 = new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Dependency(); - return factory_M03D26di1; + var factory_M03D27di1 = new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Dependency(); + return factory_M03D27di1; }); - return new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Service(perResolveM03D26di38_Func); + return new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Service(perResolveM03D27di38_Func); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -130,10 +130,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -174,25 +174,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : \"my tag\" IDependency"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -205,7 +205,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService Resolve(Composition composition) { diff --git a/readme/func.md b/readme/func.md index f93db26bb..7de73e9e9 100644 --- a/readme/func.md +++ b/readme/func.md @@ -75,53 +75,53 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.BCL.FuncScenario.IService Root { get { - var perResolveM03D26di38_Func = default(System.Func); - perResolveM03D26di38_Func = new global::System.Func( + var perResolveM03D27di38_Func = default(System.Func); + perResolveM03D27di38_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M03D26di1 = new Pure.DI.UsageTests.BCL.FuncScenario.Dependency(); - return factory_M03D26di1; + var factory_M03D27di1 = new Pure.DI.UsageTests.BCL.FuncScenario.Dependency(); + return factory_M03D27di1; }); - return new Pure.DI.UsageTests.BCL.FuncScenario.Service(perResolveM03D26di38_Func); + return new Pure.DI.UsageTests.BCL.FuncScenario.Service(perResolveM03D27di38_Func); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -133,10 +133,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -177,25 +177,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -208,7 +208,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.FuncScenario.IService Resolve(Composition composition) { diff --git a/readme/generic-composition-roots-with-constraints.md b/readme/generic-composition-roots-with-constraints.md index a25209836..d1cf93924 100644 --- a/readme/generic-composition-roots-with-constraints.md +++ b/readme/generic-composition-roots-with-constraints.md @@ -95,16 +95,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.IService GetMyRoot() @@ -117,12 +117,12 @@ partial class Composition public Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.IService GetOtherService() where T: System.IDisposable { - Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.OtherService transientM03D26di0_OtherService; + Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.OtherService transientM03D27di0_OtherService; { - var dependency_M03D26di1 = new Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.Dependency(); - transientM03D26di0_OtherService = new OtherService(dependency_M03D26di1); + var dependency_M03D27di1 = new Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.Dependency(); + transientM03D27di0_OtherService = new OtherService(dependency_M03D27di1); } - return transientM03D26di0_OtherService; + return transientM03D27di0_OtherService; } public override string ToString() diff --git a/readme/generic-composition-roots.md b/readme/generic-composition-roots.md index 67f6e1ce1..b09edfe22 100644 --- a/readme/generic-composition-roots.md +++ b/readme/generic-composition-roots.md @@ -89,16 +89,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.IService GetMyRoot() @@ -108,12 +108,12 @@ partial class Composition public Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.IService GetOtherService() { - Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.OtherService transientM03D26di0_OtherService; + Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.OtherService transientM03D27di0_OtherService; { - var dependency_M03D26di1 = new Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.Dependency(); - transientM03D26di0_OtherService = new OtherService(dependency_M03D26di1); + var dependency_M03D27di1 = new Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.Dependency(); + transientM03D27di0_OtherService = new OtherService(dependency_M03D27di1); } - return transientM03D26di0_OtherService; + return transientM03D27di0_OtherService; } public override string ToString() diff --git a/readme/generics.md b/readme/generics.md index 2adce2364..c85cc0d35 100644 --- a/readme/generics.md +++ b/readme/generics.md @@ -28,7 +28,10 @@ class Service( DI.Setup(nameof(Composition)) .Bind>().To>() - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -93,16 +96,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Generics.GenericsScenario.IService Root @@ -115,20 +118,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -140,10 +143,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -190,25 +193,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.GenericsScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.GenericsScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -221,7 +224,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Generics.GenericsScenario.IService Resolve(Composition composition) { diff --git a/readme/injection.md b/readme/injection.md index a2e1f30ed..5b85fc965 100644 --- a/readme/injection.md +++ b/readme/injection.md @@ -27,6 +27,8 @@ DI.Setup(nameof(Composition)) ctx.Inject(out var dependency); return new Service(dependency); }) + + // Composition root .Root("Root"); var composition = new Composition(); @@ -71,47 +73,47 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.InjectionScenario.IService Root { get { - Pure.DI.UsageTests.Basics.InjectionScenario.Service transientM03D26di0_Service; + Pure.DI.UsageTests.Basics.InjectionScenario.Service transientM03D27di0_Service; { - var dependency_M03D26di1 = new Pure.DI.UsageTests.Basics.InjectionScenario.Dependency(); - transientM03D26di0_Service = new Service(dependency_M03D26di1); + var dependency_M03D27di1 = new Pure.DI.UsageTests.Basics.InjectionScenario.Dependency(); + transientM03D27di0_Service = new Service(dependency_M03D27di1); } - return transientM03D26di0_Service; + return transientM03D27di0_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -123,10 +125,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -163,25 +165,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.InjectionScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.InjectionScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -194,7 +196,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.InjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/injections-of-abstractions.md b/readme/injections-of-abstractions.md index 15a96336a..48db4aeac 100644 --- a/readme/injections-of-abstractions.md +++ b/readme/injections-of-abstractions.md @@ -25,16 +25,17 @@ class Program(IService service) } DI.Setup(nameof(Composition)) - // Binding abstractions to their implementations: + // Binding abstractions to their implementations .Bind().To() .Bind().To() + // Specifies to create a composition root (a property) - // of type "Program" with the name "Root": + // of type "Program" with the name "Root" .Root("Root"); var composition = new Composition(); -// root = new Program(new Service(new Dependency())); +// var root = new Program(new Service(new Dependency())); var root = composition.Root; root.Run(); @@ -78,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.InjectionsOfAbstractionsScenario.Program Root diff --git a/readme/instance-initialization.md b/readme/instance-initialization.md index 116bdac61..efec5edcd 100644 --- a/readme/instance-initialization.md +++ b/readme/instance-initialization.md @@ -87,56 +87,56 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly string _argM03D26di_serviceName; + private readonly Composition _rootM03D27di; + private readonly string _argM03D27di_serviceName; public Composition(string serviceName) { - _rootM03D26di = this; + _rootM03D27di = this; if (ReferenceEquals(serviceName, null)) { throw new global::System.ArgumentNullException("serviceName"); } - _argM03D26di_serviceName = serviceName; + _argM03D27di_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _argM03D26di_serviceName = baseComposition._argM03D26di_serviceName; + _rootM03D27di = baseComposition._rootM03D27di; + _argM03D27di_serviceName = baseComposition._argM03D27di_serviceName; } public Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService Root { get { - Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service transientM03D26di0_Service; + Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service transientM03D27di0_Service; { - var service_M03D26di1 = new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service(_argM03D26di_serviceName, new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Dependency()); - service_M03D26di1.Initialize(); - transientM03D26di0_Service = service_M03D26di1; + var service_M03D27di1 = new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service(_argM03D27di_serviceName, new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Dependency()); + service_M03D27di1.Initialize(); + transientM03D27di0_Service = service_M03D27di1; } - return transientM03D26di0_Service; + return transientM03D27di0_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -148,10 +148,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -188,25 +188,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -219,7 +219,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService Resolve(Composition composition) { diff --git a/readme/interception.md b/readme/interception.md index 8d5d74296..7d43c0550 100644 --- a/readme/interception.md +++ b/readme/interception.md @@ -46,7 +46,7 @@ partial class Composition: IInterceptor // OnDependencyInjection = On // OnDependencyInjectionContractTypeNameRegularExpression = IService DI.Setup(nameof(Composition)) - .Bind().To().Root("Root"); + .RootBind("Root").To(); var composition = new Composition(); var service = composition.Root; @@ -83,16 +83,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Interception.InterceptionScenario.IService Root @@ -105,20 +105,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -130,10 +130,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -166,25 +166,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.InterceptionScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.InterceptionScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -197,7 +197,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Interception.InterceptionScenario.IService Resolve(Composition composition) { diff --git a/readme/keyed-service-provider.md b/readme/keyed-service-provider.md index 1c53a1a87..6f0fed5a1 100644 --- a/readme/keyed-service-provider.md +++ b/readme/keyed-service-provider.md @@ -50,8 +50,8 @@ service.Dependency.ShouldBe(dependency); ```mermaid classDiagram class Composition { - -IDependency RootM03D26di0001 - -IService RootM03D26di0002 + -IDependency _ + -IService _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object GetService(Type type) @@ -72,8 +72,8 @@ classDiagram <> } Service o-- "Singleton" Dependency : "Dependency Key" IDependency - Composition ..> Dependency : IDependency RootM03D26di0001 - Composition ..> Service : IService RootM03D26di0002 + Composition ..> Dependency : IDependency _ + Composition ..> Service : IService _ ``` @@ -84,76 +84,76 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } - public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency RootM03D26di0001 + public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency RootM03D27di0001 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return _rootM03D26di._singletonM03D26di36_Dependency; + return _rootM03D27di._singletonM03D27di36_Dependency; } } - public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService RootM03D26di0002 + public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService RootM03D27di0002 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Service(_rootM03D26di._singletonM03D26di36_Dependency); + return new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Service(_rootM03D27di._singletonM03D27di36_Dependency); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object GetService(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -165,10 +165,10 @@ partial class Composition public object GetRequiredKeyedService(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -183,8 +183,8 @@ partial class Composition return "classDiagram\n" + " class Composition {\n" + - " -IDependency RootM03D26di0001\n" + - " -IService RootM03D26di0002\n" + + " -IDependency _\n" + + " -IService _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object GetService(Type type)\n" + @@ -205,32 +205,32 @@ partial class Composition " <>\n" + " }\n" + " Service o-- \"Singleton\" Dependency : \"Dependency Key\" IDependency\n" + - " Composition ..> Dependency : IDependency RootM03D26di0001\n" + - " Composition ..> Service : IService RootM03D26di0002"; + " Composition ..> Dependency : IDependency _\n" + + " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -243,7 +243,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency Resolve(Composition composition) { @@ -255,13 +255,13 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency."); } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService Resolve(Composition composition) { @@ -273,7 +273,7 @@ partial class Composition switch (tag) { case "Service Key": - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService."); } diff --git a/readme/lazy.md b/readme/lazy.md index 3ca3e34bf..df0207b5c 100644 --- a/readme/lazy.md +++ b/readme/lazy.md @@ -68,58 +68,58 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.BCL.LazyScenario.IService Root { get { - var perResolveM03D26di39_Func = default(System.Func); - perResolveM03D26di39_Func = new global::System.Func( + var perResolveM03D27di39_Func = default(System.Func); + perResolveM03D27di39_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M03D26di1 = new Pure.DI.UsageTests.BCL.LazyScenario.Dependency(); - return factory_M03D26di1; + var factory_M03D27di1 = new Pure.DI.UsageTests.BCL.LazyScenario.Dependency(); + return factory_M03D27di1; }); - System.Lazy transientM03D26di1_Lazy; + System.Lazy transientM03D27di1_Lazy; { - var factory_M03D26di2 = perResolveM03D26di39_Func; - transientM03D26di1_Lazy = new global::System.Lazy(factory_M03D26di2, true); + var factory_M03D27di2 = perResolveM03D27di39_Func; + transientM03D27di1_Lazy = new global::System.Lazy(factory_M03D27di2, true); } - return new Pure.DI.UsageTests.BCL.LazyScenario.Service(transientM03D26di1_Lazy); + return new Pure.DI.UsageTests.BCL.LazyScenario.Service(transientM03D27di1_Lazy); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -131,10 +131,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -177,25 +177,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.LazyScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.LazyScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -208,7 +208,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.LazyScenario.IService Resolve(Composition composition) { diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index b3d4e7130..2606a587c 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -109,38 +109,38 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.BCL.ManualTaskScenario.IService GetRoot(System.Threading.CancellationToken cancellationToken) { - var perResolveM03D26di41_Func = default(System.Func); - perResolveM03D26di41_Func = new global::System.Func( + var perResolveM03D27di41_Func = default(System.Func); + perResolveM03D27di41_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M03D26di1 = new Pure.DI.UsageTests.BCL.ManualTaskScenario.Dependency(); - return factory_M03D26di1; + var factory_M03D27di1 = new Pure.DI.UsageTests.BCL.ManualTaskScenario.Dependency(); + return factory_M03D27di1; }); - System.Threading.Tasks.Task transientM03D26di1_Task; + System.Threading.Tasks.Task transientM03D27di1_Task; { - var factory_M03D26di2 = perResolveM03D26di41_Func; - var cancellationToken_M03D26di3 = cancellationToken; - transientM03D26di1_Task = new Task(factory_M03D26di2, cancellationToken_M03D26di3); + var factory_M03D27di2 = perResolveM03D27di41_Func; + var cancellationToken_M03D27di3 = cancellationToken; + transientM03D27di1_Task = new Task(factory_M03D27di2, cancellationToken_M03D27di3); } - return new Pure.DI.UsageTests.BCL.ManualTaskScenario.Service(transientM03D26di1_Task); + return new Pure.DI.UsageTests.BCL.ManualTaskScenario.Service(transientM03D27di1_Task); } public override string ToString() diff --git a/readme/member-ordinal-attribute.md b/readme/member-ordinal-attribute.md index 57b505c5d..0b1f38387 100644 --- a/readme/member-ordinal-attribute.md +++ b/readme/member-ordinal-attribute.md @@ -97,60 +97,60 @@ classDiagram ```c# partial class PersonComposition { - private readonly PersonComposition _rootM03D26di; - private readonly int _argM03D26di_personId; - private readonly string _argM03D26di_personName; - private readonly System.DateTime _argM03D26di_personBirthday; + private readonly PersonComposition _rootM03D27di; + private readonly int _argM03D27di_personId; + private readonly string _argM03D27di_personName; + private readonly System.DateTime _argM03D27di_personBirthday; public PersonComposition(int personId, string personName, System.DateTime personBirthday) { - _rootM03D26di = this; + _rootM03D27di = this; if (ReferenceEquals(personName, null)) { throw new global::System.ArgumentNullException("personName"); } - _argM03D26di_personId = personId; - _argM03D26di_personName = personName; - _argM03D26di_personBirthday = personBirthday; + _argM03D27di_personId = personId; + _argM03D27di_personName = personName; + _argM03D27di_personBirthday = personBirthday; } internal PersonComposition(PersonComposition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _argM03D26di_personId = baseComposition._argM03D26di_personId; - _argM03D26di_personName = baseComposition._argM03D26di_personName; - _argM03D26di_personBirthday = baseComposition._argM03D26di_personBirthday; + _rootM03D27di = baseComposition._rootM03D27di; + _argM03D27di_personId = baseComposition._argM03D27di_personId; + _argM03D27di_personName = baseComposition._argM03D27di_personName; + _argM03D27di_personBirthday = baseComposition._argM03D27di_personBirthday; } public Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson Person { get { - Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person transientM03D26di0_Person = new Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person(); - transientM03D26di0_Person.Id = _argM03D26di_personId; - transientM03D26di0_Person.FirstName = _argM03D26di_personName; - transientM03D26di0_Person.Birthday = _argM03D26di_personBirthday; - return transientM03D26di0_Person; + Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person transientM03D27di0_Person = new Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person(); + transientM03D27di0_Person.Id = _argM03D27di_personId; + transientM03D27di0_Person.FirstName = _argM03D27di_personName; + transientM03D27di0_Person.Birthday = _argM03D27di_personBirthday; + return transientM03D27di0_Person; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -162,10 +162,10 @@ partial class PersonComposition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -205,25 +205,25 @@ partial class PersonComposition " PersonComposition ..> Person : IPerson Person"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static PersonComposition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(PersonComposition composite) { @@ -236,7 +236,7 @@ partial class PersonComposition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson Resolve(PersonComposition composition) { diff --git a/readme/method-injection.md b/readme/method-injection.md index 236c34f1a..0deb10d38 100644 --- a/readme/method-injection.md +++ b/readme/method-injection.md @@ -25,7 +25,10 @@ class Service : IService DI.Setup(nameof(Composition)) .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -71,44 +74,44 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService Root { get { - Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service transientM03D26di0_Service = new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service(); - transientM03D26di0_Service.SetDependency(new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Dependency()); - return transientM03D26di0_Service; + Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service transientM03D27di0_Service = new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service(); + transientM03D27di0_Service.SetDependency(new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Dependency()); + return transientM03D27di0_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -120,10 +123,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -163,25 +166,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -194,7 +197,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/multi-contract-bindings.md b/readme/multi-contract-bindings.md index 43772a892..669358fa4 100644 --- a/readme/multi-contract-bindings.md +++ b/readme/multi-contract-bindings.md @@ -22,7 +22,10 @@ DI.Setup(nameof(Composition)) .Bind().To() // .Bind().Bind().To() // is also allowed - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -71,16 +74,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService Root @@ -93,20 +96,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -118,10 +121,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -165,25 +168,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -196,7 +199,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService Resolve(Composition composition) { diff --git a/readme/oncannotresolve-hint.md b/readme/oncannotresolve-hint.md index 17d4d0eed..270839a51 100644 --- a/readme/oncannotresolve-hint.md +++ b/readme/oncannotresolve-hint.md @@ -44,7 +44,7 @@ partial class Composition // OnCannotResolveContractTypeNameRegularExpression = string DI.Setup(nameof(Composition)) .Hint(OnCannotResolve, "On") - .Bind().To() + .Bind().To() .RootBind("Root").To(); var composition = new Composition(); @@ -96,43 +96,43 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService Root { get { - string transientM03D26di2_String = OnCannotResolve(null, Pure.DI.Lifetime.Transient); - return new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Service(new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Dependency(transientM03D26di2_String)); + string transientM03D27di2_String = OnCannotResolve(null, Pure.DI.Lifetime.Transient); + return new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Service(new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Dependency(transientM03D27di2_String)); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -144,10 +144,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -190,25 +190,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -221,7 +221,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService Resolve(Composition composition) { diff --git a/readme/ondependencyinjection-hint.md b/readme/ondependencyinjection-hint.md index e69b847a8..76641b593 100644 --- a/readme/ondependencyinjection-hint.md +++ b/readme/ondependencyinjection-hint.md @@ -42,7 +42,7 @@ partial class Composition // OnDependencyInjection = On DI.Setup(nameof(Composition)) .Hint(OnDependencyInjectionContractTypeNameRegularExpression, nameof(IDependency)) - .Bind().To() + .Bind().To() .RootBind("Root").To(); var log = new List(); @@ -93,16 +93,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService Root @@ -115,20 +115,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -140,10 +140,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -184,25 +184,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -215,7 +215,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService Resolve(Composition composition) { diff --git a/readme/onnewinstance-hint.md b/readme/onnewinstance-hint.md index bbecdc161..2463d88f0 100644 --- a/readme/onnewinstance-hint.md +++ b/readme/onnewinstance-hint.md @@ -43,8 +43,8 @@ internal partial class Composition DI.Setup(nameof(Composition)) .Hint(OnNewInstance, "On") - .Bind().As(Lifetime.Singleton).To() - .Bind().To().Root("Root"); + .Bind().As(Lifetime.Singleton).To() + .RootBind("Root").To(); var log = new List(); var composition = new Composition(log); @@ -95,63 +95,63 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService Root { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM03D26di36_DependencyTemp; - _singletonM03D26di36_DependencyTemp = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency(); - OnNewInstance(ref _singletonM03D26di36_DependencyTemp, null, Pure.DI.Lifetime.Singleton); + Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM03D27di36_DependencyTemp; + _singletonM03D27di36_DependencyTemp = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency(); + OnNewInstance(ref _singletonM03D27di36_DependencyTemp, null, Pure.DI.Lifetime.Singleton); global::System.Threading.Thread.MemoryBarrier(); - _singletonM03D26di36_Dependency = _singletonM03D26di36_DependencyTemp; - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = _singletonM03D27di36_DependencyTemp; + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service transientM03D26di0_Service = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service(_rootM03D26di._singletonM03D26di36_Dependency); - OnNewInstance(ref transientM03D26di0_Service, null, Pure.DI.Lifetime.Transient); - return transientM03D26di0_Service; + Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service transientM03D27di0_Service = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service(_rootM03D27di._singletonM03D27di36_Dependency); + OnNewInstance(ref transientM03D27di0_Service, null, Pure.DI.Lifetime.Transient); + return transientM03D27di0_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -163,10 +163,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -207,25 +207,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -238,7 +238,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService Resolve(Composition composition) { diff --git a/readme/overriding-the-bcl-binding.md b/readme/overriding-the-bcl-binding.md index 612fbbb64..dd275e349 100644 --- a/readme/overriding-the-bcl-binding.md +++ b/readme/overriding-the-bcl-binding.md @@ -70,48 +70,48 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService Root { get { - Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IDependency[] transientM03D26di1_ = new IDependency[] + Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IDependency[] transientM03D27di1_ = new IDependency[] { new AbcDependency(), new XyzDependency(), new AbcDependency() }; - return new Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.Service(transientM03D26di1_); + return new Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.Service(transientM03D27di1_); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -123,10 +123,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -159,25 +159,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -190,7 +190,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService Resolve(Composition composition) { diff --git a/readme/partial-class.md b/readme/partial-class.md index 2faca913b..567628056 100644 --- a/readme/partial-class.md +++ b/readme/partial-class.md @@ -104,45 +104,45 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } internal Pure.DI.UsageTests.Advanced.PartialClassScenario.Service Root { get { - long transientM03D26di5_Int64 = GenerateId(); - long transientM03D26di4_Int64 = GenerateId(); - string transientM03D26di1_String = $"{_serviceName}_{GenerateId()}"; - return new Pure.DI.UsageTests.Advanced.PartialClassScenario.Service(transientM03D26di1_String, new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM03D26di5_Int64), new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM03D26di4_Int64)); + long transientM03D27di5_Int64 = GenerateId(); + long transientM03D27di4_Int64 = GenerateId(); + string transientM03D27di1_String = $"{_serviceName}_{GenerateId()}"; + return new Pure.DI.UsageTests.Advanced.PartialClassScenario.Service(transientM03D27di1_String, new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM03D27di5_Int64), new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM03D27di4_Int64)); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -154,10 +154,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -197,25 +197,25 @@ partial class Composition " Composition ..> Service : Service Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.PartialClassScenario.Service), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.PartialClassScenario.Service), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -228,7 +228,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.PartialClassScenario.Service Resolve(Composition composition) { diff --git a/readme/perblock.md b/readme/perblock.md index 174e7b4e4..e779d5719 100644 --- a/readme/perblock.md +++ b/readme/perblock.md @@ -24,7 +24,7 @@ class Service( } DI.Setup(nameof(Composition)) - .Bind().As(Lifetime.PerBlock).To() + .Bind().As(Lifetime.PerBlock).To() .Root("Root"); var composition = new Composition(); @@ -83,60 +83,60 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service Root { get { - var perResolveM03D26di42_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>); - perResolveM03D26di42_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>( + var perResolveM03D27di42_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>); + perResolveM03D27di42_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM03D26di4_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); - var factory_M03D26di1 = (perBlockM03D26di4_Dependency, perBlockM03D26di4_Dependency); - return factory_M03D26di1; + Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM03D27di4_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); + var factory_M03D27di1 = (perBlockM03D27di4_Dependency, perBlockM03D27di4_Dependency); + return factory_M03D27di1; }); - System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)> transientM03D26di2_Lazy; + System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)> transientM03D27di2_Lazy; { - var factory_M03D26di2 = perResolveM03D26di42_Func; - transientM03D26di2_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>(factory_M03D26di2, true); + var factory_M03D27di2 = perResolveM03D27di42_Func; + transientM03D27di2_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>(factory_M03D27di2, true); } - Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM03D26di1_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); - return new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service(perBlockM03D26di1_Dependency, perBlockM03D26di1_Dependency, transientM03D26di2_Lazy); + Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM03D27di1_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); + return new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service(perBlockM03D27di1_Dependency, perBlockM03D27di1_Dependency, transientM03D27di2_Lazy); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -148,10 +148,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -197,25 +197,25 @@ partial class Composition " FuncᐸValueTupleᐸIDependencyˏIDependencyᐳᐳ *-- ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -228,7 +228,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service Resolve(Composition composition) { diff --git a/readme/perresolve.md b/readme/perresolve.md index 764bf272c..7769573f4 100644 --- a/readme/perresolve.md +++ b/readme/perresolve.md @@ -24,7 +24,7 @@ class Service( } DI.Setup(nameof(Composition)) - .Bind().As(Lifetime.PerResolve).To() + .Bind().As(Lifetime.PerResolve).To() .Root("Root"); var composition = new Composition(); @@ -83,79 +83,79 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service Root { get { - var perResolveM03D26di36_Dependency = default(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency); - var perResolveM03D26di42_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>); - perResolveM03D26di42_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>( + var perResolveM03D27di36_Dependency = default(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency); + var perResolveM03D27di42_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>); + perResolveM03D27di42_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - if (ReferenceEquals(perResolveM03D26di36_Dependency, null)) + if (ReferenceEquals(perResolveM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(perResolveM03D26di36_Dependency, null)) + if (ReferenceEquals(perResolveM03D27di36_Dependency, null)) { - perResolveM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); + perResolveM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); } } } - var factory_M03D26di1 = (perResolveM03D26di36_Dependency, perResolveM03D26di36_Dependency); - return factory_M03D26di1; + var factory_M03D27di1 = (perResolveM03D27di36_Dependency, perResolveM03D27di36_Dependency); + return factory_M03D27di1; }); - System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)> transientM03D26di1_Lazy; + System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)> transientM03D27di1_Lazy; { - var factory_M03D26di2 = perResolveM03D26di42_Func; - transientM03D26di1_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>(factory_M03D26di2, true); + var factory_M03D27di2 = perResolveM03D27di42_Func; + transientM03D27di1_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>(factory_M03D27di2, true); } - if (ReferenceEquals(perResolveM03D26di36_Dependency, null)) + if (ReferenceEquals(perResolveM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(perResolveM03D26di36_Dependency, null)) + if (ReferenceEquals(perResolveM03D27di36_Dependency, null)) { - perResolveM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); + perResolveM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); } } } - return new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service(perResolveM03D26di36_Dependency, perResolveM03D26di36_Dependency, transientM03D26di1_Lazy); + return new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service(perResolveM03D27di36_Dependency, perResolveM03D27di36_Dependency, transientM03D27di1_Lazy); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -167,10 +167,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -216,25 +216,25 @@ partial class Composition " FuncᐸValueTupleᐸIDependencyˏIDependencyᐳᐳ *-- ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -247,7 +247,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service Resolve(Composition composition) { diff --git a/readme/property-injection.md b/readme/property-injection.md index 4eab2a460..121662f0c 100644 --- a/readme/property-injection.md +++ b/readme/property-injection.md @@ -22,7 +22,10 @@ class Service : IService DI.Setup(nameof(Composition)) .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -68,44 +71,44 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService Root { get { - Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service transientM03D26di0_Service = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service(); - transientM03D26di0_Service.Dependency = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Dependency(); - return transientM03D26di0_Service; + Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service transientM03D27di0_Service = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service(); + transientM03D27di0_Service.Dependency = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Dependency(); + return transientM03D27di0_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -117,10 +120,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -160,25 +163,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -191,7 +194,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/required-properties-or-fields.md b/readme/required-properties-or-fields.md index e3e61f723..9a38d701d 100644 --- a/readme/required-properties-or-fields.md +++ b/readme/required-properties-or-fields.md @@ -28,7 +28,10 @@ class Service : IService DI.Setup(nameof(Composition)) .Arg("name") .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + + // Composition root + .Root("Root"); var composition = new Composition(name: "My Service"); var service = composition.Root; @@ -78,24 +81,24 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly string _argM03D26di_name; + private readonly Composition _rootM03D27di; + private readonly string _argM03D27di_name; public Composition(string name) { - _rootM03D26di = this; + _rootM03D27di = this; if (ReferenceEquals(name, null)) { throw new global::System.ArgumentNullException("name"); } - _argM03D26di_name = name; + _argM03D27di_name = name; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _argM03D26di_name = baseComposition._argM03D26di_name; + _rootM03D27di = baseComposition._rootM03D27di; + _argM03D27di_name = baseComposition._argM03D27di_name; } public Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService Root @@ -104,7 +107,7 @@ partial class Composition { return new Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.Service() { - ServiceNameField = _argM03D26di_name, + ServiceNameField = _argM03D27di_name, Dependency = new Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.Dependency() }; } @@ -112,20 +115,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -137,10 +140,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -183,25 +186,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -214,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService Resolve(Composition composition) { diff --git a/readme/resolve-hint.md b/readme/resolve-hint.md index 8c00f328d..b26a8d744 100644 --- a/readme/resolve-hint.md +++ b/readme/resolve-hint.md @@ -18,8 +18,8 @@ class Service(IDependency dependency) : IService; DI.Setup(nameof(Composition)) .Hint(Resolve, "Off") - .Bind().To().Root("DependencyRoot") - .Bind().To().Root("Root"); + .RootBind("DependencyRoot").To() + .RootBind("Root").To(); var composition = new Composition(); var service = composition.Root; @@ -64,16 +64,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Hints.ResolveHintScenario.IDependency DependencyRoot diff --git a/readme/resolve-methods.md b/readme/resolve-methods.md index 0a114bbf9..9c06cdb97 100644 --- a/readme/resolve-methods.md +++ b/readme/resolve-methods.md @@ -17,17 +17,20 @@ class OtherService : IService; DI.Setup(nameof(Composition)) .Bind().To() - // Specifies to create a private composition root - // of type "IDependency" with the name "Dependency" - .Root() .Bind().To() - // Specifies to create a private root - // that is only accessible from _Resolve_ methods - .Root() .Bind("Other").To() - // Specifies to create a public root named _OtherService_ - // using the _Other_ tag - .Root("OtherService", "Other"); + + // Specifies to create a private composition root + // of type "IDependency" with the name "Dependency" + .Root() + + // Specifies to create a private root + // that is only accessible from _Resolve_ methods + .Root() + + // Specifies to create a public root named _OtherService_ + // using the _Other_ tag + .Root("OtherService", "Other"); var composition = new Composition(); var dependency = composition.Resolve(); @@ -46,8 +49,8 @@ var otherService2 = composition.Resolve(typeof(IService),"Other"); classDiagram class Composition { +IService OtherService - -IDependency RootM03D26di0001 - -IService RootM03D26di0002 + -IDependency _ + -IService _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) @@ -72,8 +75,8 @@ classDiagram <> } Service *-- Dependency : IDependency - Composition ..> Dependency : IDependency RootM03D26di0001 - Composition ..> Service : IService RootM03D26di0002 + Composition ..> Dependency : IDependency _ + Composition ..> Service : IService _ Composition ..> OtherService : IService OtherService ``` @@ -85,16 +88,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.ResolveScenario.IService OtherService @@ -105,7 +108,7 @@ partial class Composition } } - public Pure.DI.UsageTests.Basics.ResolveScenario.IDependency RootM03D26di0001 + public Pure.DI.UsageTests.Basics.ResolveScenario.IDependency RootM03D27di0001 { get { @@ -113,7 +116,7 @@ partial class Composition } } - public Pure.DI.UsageTests.Basics.ResolveScenario.IService RootM03D26di0002 + public Pure.DI.UsageTests.Basics.ResolveScenario.IService RootM03D27di0002 { get { @@ -123,20 +126,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -148,10 +151,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -167,8 +170,8 @@ partial class Composition "classDiagram\n" + " class Composition {\n" + " +IService OtherService\n" + - " -IDependency RootM03D26di0001\n" + - " -IService RootM03D26di0002\n" + + " -IDependency _\n" + + " -IService _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object Resolve(Type type)\n" + @@ -193,33 +196,33 @@ partial class Composition " <>\n" + " }\n" + " Service *-- Dependency : IDependency\n" + - " Composition ..> Dependency : IDependency RootM03D26di0001\n" + - " Composition ..> Service : IService RootM03D26di0002\n" + + " Composition ..> Dependency : IDependency _\n" + + " Composition ..> Service : IService _\n" + " Composition ..> OtherService : IService OtherService"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IDependency), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IDependency), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -232,11 +235,11 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.ResolveScenario.IService Resolve(Composition composition) { - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } public Pure.DI.UsageTests.Basics.ResolveScenario.IService ResolveByTag(Composition composition, object tag) @@ -246,17 +249,17 @@ partial class Composition case "Other": return composition.OtherService; case null: - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.ResolveScenario.IService."); } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.ResolveScenario.IDependency Resolve(Composition composition) { - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } public Pure.DI.UsageTests.Basics.ResolveScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -264,7 +267,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.ResolveScenario.IDependency."); } diff --git a/readme/root-arguments.md b/readme/root-arguments.md index e9b733388..8573e304b 100644 --- a/readme/root-arguments.md +++ b/readme/root-arguments.md @@ -40,13 +40,18 @@ DI.Setup(nameof(Composition)) // This hint indicates to not generate methods such as Resolve .Hint(Hint.Resolve, "Off") .Bind().To() - .Bind().To().Root("CreateService") + .Bind().To() + // Some argument .RootArg("id") .RootArg("dependencyName") + // An argument can be tagged (e.g., tag "forService") // to be injectable by type and this tag - .RootArg("serviceName", "forService"); + .RootArg("serviceName", "forService") + + // Composition root + .Root("CreateService"); var composition = new Composition(); @@ -99,16 +104,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.RootArgumentsScenario.IService CreateService(int id, string dependencyName, string serviceName) diff --git a/readme/rootbind.md b/readme/rootbind.md index bdca79dc8..3487ae502 100644 --- a/readme/rootbind.md +++ b/readme/rootbind.md @@ -5,15 +5,15 @@ You might want to register some services as roots. You can use `RootBind()` method in order to reduce repetitions. The registration `composition.RootBind().To()` is an equivalent to `composition.Bind().To().Root()`. ```c# -interface IDependency; +interface IService; -class Dependency : IDependency; +class Service : IService; DI.Setup(nameof(Composition)) - .RootBind("Root").To(); + .RootBind("Root").To(); var composition = new Composition(); -composition.Root.ShouldBeOfType(); +composition.Root.ShouldBeOfType(); ```
@@ -22,20 +22,20 @@ composition.Root.ShouldBeOfType(); ```mermaid classDiagram class Composition { - +IDependency Root + +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) } - Dependency --|> IDependency : - class Dependency { - +Dependency() + Service --|> IService : + class Service { + +Service() } - class IDependency { + class IService { <> } - Composition ..> Dependency : IDependency Root + Composition ..> Service : IService Root ```
@@ -46,42 +46,42 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } - public Pure.DI.UsageTests.Basics.RootBindScenario.IDependency Root + public Pure.DI.UsageTests.Basics.RootBindScenario.IService Root { get { - return new Pure.DI.UsageTests.Basics.RootBindScenario.Dependency(); + return new Pure.DI.UsageTests.Basics.RootBindScenario.Service(); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -93,10 +93,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -111,41 +111,41 @@ partial class Composition return "classDiagram\n" + " class Composition {\n" + - " +IDependency Root\n" + + " +IService Root\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " Dependency --|> IDependency : \n" + - " class Dependency {\n" + - " +Dependency()\n" + + " Service --|> IService : \n" + + " class Service {\n" + + " +Service()\n" + " }\n" + - " class IDependency {\n" + + " class IService {\n" + " <>\n" + " }\n" + - " Composition ..> Dependency : IDependency Root"; + " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RootBindScenario.IDependency), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RootBindScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -158,21 +158,21 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { - public Pure.DI.UsageTests.Basics.RootBindScenario.IDependency Resolve(Composition composition) + public Pure.DI.UsageTests.Basics.RootBindScenario.IService Resolve(Composition composition) { return composition.Root; } - public Pure.DI.UsageTests.Basics.RootBindScenario.IDependency ResolveByTag(Composition composition, object tag) + public Pure.DI.UsageTests.Basics.RootBindScenario.IService ResolveByTag(Composition composition, object tag) { switch (tag) { case null: return composition.Root; } - throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.RootBindScenario.IDependency."); + throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.RootBindScenario.IService."); } } } diff --git a/readme/scope.md b/readme/scope.md index 9463e70e4..4e481c22f 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -39,10 +39,11 @@ partial class Composition { private static void Setup() => DI.Setup(nameof(Composition)) - .Bind().As(Scoped).To() - .Bind().To() + .Bind().As(Scoped).To() + // Session composition root - .Root("SessionRoot") + .RootBind("SessionRoot").To() + // Program composition root .Root("ProgramRoot"); } @@ -128,42 +129,42 @@ classDiagram ```c# partial class Composition: global::System.IDisposable { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private readonly global::System.IDisposable[] _disposablesM03D26di; - private int _disposeIndexM03D26di; - private Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency _scopedM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private readonly global::System.IDisposable[] _disposablesM03D27di; + private int _disposeIndexM03D27di; + private Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency _scopedM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); - _disposablesM03D26di = new global::System.IDisposable[1]; + _rootM03D27di = this; + _lockM03D27di = new object(); + _disposablesM03D27di = new global::System.IDisposable[1]; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; - _disposablesM03D26di = new global::System.IDisposable[1]; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; + _disposablesM03D27di = new global::System.IDisposable[1]; } public Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService SessionRoot { get { - if (ReferenceEquals(_scopedM03D26di36_Dependency, null)) + if (ReferenceEquals(_scopedM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_scopedM03D26di36_Dependency, null)) + if (ReferenceEquals(_scopedM03D27di36_Dependency, null)) { - _scopedM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency(); - _disposablesM03D26di[_disposeIndexM03D26di++] = _scopedM03D26di36_Dependency; + _scopedM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency(); + _disposablesM03D27di[_disposeIndexM03D27di++] = _scopedM03D27di36_Dependency; } } } - return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Service(_scopedM03D26di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Service(_scopedM03D27di36_Dependency); } } @@ -171,35 +172,35 @@ partial class Composition: global::System.IDisposable { get { - var perResolveM03D26di42_Func = default(System.Func); - perResolveM03D26di42_Func = new global::System.Func( + var perResolveM03D27di42_Func = default(System.Func); + perResolveM03D27di42_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - Pure.DI.UsageTests.Lifetimes.ScopeScenario.Composition transientM03D26di2_Composition = this; - var factory_M03D26di1 = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Session(transientM03D26di2_Composition); - return factory_M03D26di1; + Pure.DI.UsageTests.Lifetimes.ScopeScenario.Composition transientM03D27di2_Composition = this; + var factory_M03D27di1 = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Session(transientM03D27di2_Composition); + return factory_M03D27di1; }); - return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program(perResolveM03D26di42_Func); + return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program(perResolveM03D27di42_Func); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -211,10 +212,10 @@ partial class Composition: global::System.IDisposable public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -227,11 +228,11 @@ partial class Composition: global::System.IDisposable public void Dispose() { - lock (_lockM03D26di) + lock (_lockM03D27di) { - while (_disposeIndexM03D26di > 0) + while (_disposeIndexM03D27di > 0) { - var disposableInstance = _disposablesM03D26di[--_disposeIndexM03D26di]; + var disposableInstance = _disposablesM03D27di[--_disposeIndexM03D27di]; try { disposableInstance.Dispose(); @@ -242,7 +243,7 @@ partial class Composition: global::System.IDisposable } } - _scopedM03D26di36_Dependency = null; + _scopedM03D27di36_Dependency = null; } } @@ -291,28 +292,28 @@ partial class Composition: global::System.IDisposable " FuncᐸSessionᐳ *-- Session : Session"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -325,7 +326,7 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService Resolve(Composition composition) { @@ -343,7 +344,7 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program Resolve(Composition composition) { diff --git a/readme/service-collection.md b/readme/service-collection.md index b1049beef..22a3ec5ce 100644 --- a/readme/service-collection.md +++ b/readme/service-collection.md @@ -47,8 +47,8 @@ service.Dependency.ShouldBe(dependency); ```mermaid classDiagram class Composition { - -IDependency RootM03D26di0001 - -IService RootM03D26di0002 + -IDependency _ + -IService _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) @@ -69,8 +69,8 @@ classDiagram <> } Service o-- "Singleton" Dependency : "Dependency Key" IDependency - Composition ..> Dependency : IDependency RootM03D26di0001 - Composition ..> Service : IService RootM03D26di0002 + Composition ..> Dependency : IDependency _ + Composition ..> Service : IService _ ``` @@ -81,76 +81,76 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } - public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency RootM03D26di0001 + public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency RootM03D27di0001 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return _rootM03D26di._singletonM03D26di36_Dependency; + return _rootM03D27di._singletonM03D27di36_Dependency; } } - public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService RootM03D26di0002 + public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService RootM03D27di0002 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Service(_rootM03D26di._singletonM03D26di36_Dependency); + return new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Service(_rootM03D27di._singletonM03D27di36_Dependency); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -162,10 +162,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -180,8 +180,8 @@ partial class Composition return "classDiagram\n" + " class Composition {\n" + - " -IDependency RootM03D26di0001\n" + - " -IService RootM03D26di0002\n" + + " -IDependency _\n" + + " -IService _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object Resolve(Type type)\n" + @@ -202,34 +202,34 @@ partial class Composition " <>\n" + " }\n" + " Service o-- \"Singleton\" Dependency : \"Dependency Key\" IDependency\n" + - " Composition ..> Dependency : IDependency RootM03D26di0001\n" + - " Composition ..> Service : IService RootM03D26di0002"; + " Composition ..> Dependency : IDependency _\n" + + " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - OnNewRoot(valResolverM03D26di_0000, "RootM03D26di0001", "Dependency Key", Pure.DI.Lifetime.Singleton); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - OnNewRoot(valResolverM03D26di_0001, "RootM03D26di0002", null, Pure.DI.Lifetime.Transient); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + OnNewRoot(valResolverM03D27di_0000, "RootM03D27di0001", "Dependency Key", Pure.DI.Lifetime.Singleton); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + OnNewRoot(valResolverM03D27di_0001, "RootM03D27di0002", null, Pure.DI.Lifetime.Transient); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -242,7 +242,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency Resolve(Composition composition) { @@ -254,17 +254,17 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency."); } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService Resolve(Composition composition) { - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService ResolveByTag(Composition composition, object tag) @@ -272,7 +272,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService."); } diff --git a/readme/service-provider-with-scope.md b/readme/service-provider-with-scope.md index 45d93fa6b..56717f011 100644 --- a/readme/service-provider-with-scope.md +++ b/readme/service-provider-with-scope.md @@ -73,8 +73,8 @@ dependency1.ShouldBe(dependency2); ```mermaid classDiagram class Composition { - -IDependency RootM03D26di0001 - -IService RootM03D26di0002 + -IDependency _ + -IService _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object GetService(Type type) @@ -96,8 +96,8 @@ classDiagram <> } Service o-- "Singleton" Dependency : IDependency - Composition ..> Dependency : IDependency RootM03D26di0001 - Composition ..> Service : IService RootM03D26di0002 + Composition ..> Dependency : IDependency _ + Composition ..> Service : IService _ ``` @@ -108,86 +108,86 @@ classDiagram ```c# partial class Composition: global::System.IDisposable { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private readonly global::System.IDisposable[] _disposablesM03D26di; - private int _disposeIndexM03D26di; - private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency _singletonM03D26di36_Dependency; - private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service _scopedM03D26di37_Service; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private readonly global::System.IDisposable[] _disposablesM03D27di; + private int _disposeIndexM03D27di; + private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency _singletonM03D27di36_Dependency; + private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service _scopedM03D27di37_Service; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); - _disposablesM03D26di = new global::System.IDisposable[1]; + _rootM03D27di = this; + _lockM03D27di = new object(); + _disposablesM03D27di = new global::System.IDisposable[1]; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; - _disposablesM03D26di = new global::System.IDisposable[1]; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; + _disposablesM03D27di = new global::System.IDisposable[1]; } - public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency RootM03D26di0001 + public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency RootM03D27di0001 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return _rootM03D26di._singletonM03D26di36_Dependency; + return _rootM03D27di._singletonM03D27di36_Dependency; } } - public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService RootM03D26di0002 + public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService RootM03D27di0002 { get { - if (ReferenceEquals(_scopedM03D26di37_Service, null)) + if (ReferenceEquals(_scopedM03D27di37_Service, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_scopedM03D26di37_Service, null)) + if (ReferenceEquals(_scopedM03D27di37_Service, null)) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } - _scopedM03D26di37_Service = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service(_rootM03D26di._singletonM03D26di36_Dependency); - _disposablesM03D26di[_disposeIndexM03D26di++] = _scopedM03D26di37_Service; + _scopedM03D27di37_Service = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service(_rootM03D27di._singletonM03D27di36_Dependency); + _disposablesM03D27di[_disposeIndexM03D27di++] = _scopedM03D27di37_Service; } } } - return _scopedM03D26di37_Service; + return _scopedM03D27di37_Service; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object GetService(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -199,10 +199,10 @@ partial class Composition: global::System.IDisposable public object GetRequiredKeyedService(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -215,11 +215,11 @@ partial class Composition: global::System.IDisposable public void Dispose() { - lock (_lockM03D26di) + lock (_lockM03D27di) { - while (_disposeIndexM03D26di > 0) + while (_disposeIndexM03D27di > 0) { - var disposableInstance = _disposablesM03D26di[--_disposeIndexM03D26di]; + var disposableInstance = _disposablesM03D27di[--_disposeIndexM03D27di]; try { disposableInstance.Dispose(); @@ -230,8 +230,8 @@ partial class Composition: global::System.IDisposable } } - _singletonM03D26di36_Dependency = null; - _scopedM03D26di37_Service = null; + _singletonM03D27di36_Dependency = null; + _scopedM03D27di37_Service = null; } } @@ -242,8 +242,8 @@ partial class Composition: global::System.IDisposable return "classDiagram\n" + " class Composition {\n" + - " -IDependency RootM03D26di0001\n" + - " -IService RootM03D26di0002\n" + + " -IDependency _\n" + + " -IService _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object GetService(Type type)\n" + @@ -265,32 +265,32 @@ partial class Composition: global::System.IDisposable " <>\n" + " }\n" + " Service o-- \"Singleton\" Dependency : IDependency\n" + - " Composition ..> Dependency : IDependency RootM03D26di0001\n" + - " Composition ..> Service : IService RootM03D26di0002"; + " Composition ..> Dependency : IDependency _\n" + + " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -303,11 +303,11 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency Resolve(Composition composition) { - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -315,17 +315,17 @@ partial class Composition: global::System.IDisposable switch (tag) { case null: - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency."); } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService Resolve(Composition composition) { - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService ResolveByTag(Composition composition, object tag) @@ -333,7 +333,7 @@ partial class Composition: global::System.IDisposable switch (tag) { case null: - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService."); } diff --git a/readme/service-provider.md b/readme/service-provider.md index 5a1d8a129..dff3436d2 100644 --- a/readme/service-provider.md +++ b/readme/service-provider.md @@ -45,8 +45,8 @@ service.Dependency.ShouldBe(dependency); ```mermaid classDiagram class Composition { - -IDependency RootM03D26di0001 - -IService RootM03D26di0002 + -IDependency _ + -IService _ + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object GetService(Type type) @@ -67,8 +67,8 @@ classDiagram <> } Service o-- "Singleton" Dependency : IDependency - Composition ..> Dependency : IDependency RootM03D26di0001 - Composition ..> Service : IService RootM03D26di0002 + Composition ..> Dependency : IDependency _ + Composition ..> Service : IService _ ``` @@ -79,76 +79,76 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } - public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency RootM03D26di0001 + public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency RootM03D27di0001 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return _rootM03D26di._singletonM03D26di36_Dependency; + return _rootM03D27di._singletonM03D27di36_Dependency; } } - public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService RootM03D26di0002 + public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService RootM03D27di0002 { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Service(_rootM03D26di._singletonM03D26di36_Dependency); + return new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Service(_rootM03D27di._singletonM03D27di36_Dependency); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object GetService(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -160,10 +160,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -178,8 +178,8 @@ partial class Composition return "classDiagram\n" + " class Composition {\n" + - " -IDependency RootM03D26di0001\n" + - " -IService RootM03D26di0002\n" + + " -IDependency _\n" + + " -IService _\n" + " + T ResolveᐸTᐳ()\n" + " + T ResolveᐸTᐳ(object? tag)\n" + " + object GetService(Type type)\n" + @@ -200,32 +200,32 @@ partial class Composition " <>\n" + " }\n" + " Service o-- \"Singleton\" Dependency : IDependency\n" + - " Composition ..> Dependency : IDependency RootM03D26di0001\n" + - " Composition ..> Service : IService RootM03D26di0002"; + " Composition ..> Dependency : IDependency _\n" + + " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -238,11 +238,11 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency Resolve(Composition composition) { - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -250,17 +250,17 @@ partial class Composition switch (tag) { case null: - return composition.RootM03D26di0001; + return composition.RootM03D27di0001; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency."); } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService Resolve(Composition composition) { - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService ResolveByTag(Composition composition, object tag) @@ -268,7 +268,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM03D26di0002; + return composition.RootM03D27di0002; } throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService."); } diff --git a/readme/simplified-binding.md b/readme/simplified-binding.md index 0b9722256..56eac80a6 100644 --- a/readme/simplified-binding.md +++ b/readme/simplified-binding.md @@ -26,6 +26,7 @@ DI.Setup("Composition") // .As(Lifetime.PerBlock) // .To() .Bind().As(Lifetime.PerBlock).To() + // Specifies to create a property "MyService" .Root("MyService"); @@ -87,24 +88,24 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Service MyService { get { - Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency perBlockM03D26di1_Dependency = new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency(); - return new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Service(perBlockM03D26di1_Dependency, perBlockM03D26di1_Dependency, perBlockM03D26di1_Dependency); + Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency perBlockM03D27di1_Dependency = new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency(); + return new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Service(perBlockM03D27di1_Dependency, perBlockM03D27di1_Dependency, perBlockM03D27di1_Dependency); } } diff --git a/readme/singleton.md b/readme/singleton.md index f1922d7ba..62366f13d 100644 --- a/readme/singleton.md +++ b/readme/singleton.md @@ -27,8 +27,8 @@ class Service( } DI.Setup(nameof(Composition)) - .Bind().As(Lifetime.Singleton).To() - .Bind().To().Root("Root"); + .Bind().As(Lifetime.Singleton).To() + .RootBind("Root").To(); var composition = new Composition(); var service1 = composition.Root; @@ -76,57 +76,57 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency _singletonM03D26di36_Dependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency _singletonM03D27di36_Dependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService Root { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di36_Dependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di36_Dependency, null)) { - _singletonM03D26di36_Dependency = new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency(); - _rootM03D26di._singletonM03D26di36_Dependency = _singletonM03D26di36_Dependency; + _singletonM03D27di36_Dependency = new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency(); + _rootM03D27di._singletonM03D27di36_Dependency = _singletonM03D27di36_Dependency; } } } - return new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Service(_singletonM03D26di36_Dependency, _rootM03D26di._singletonM03D26di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Service(_singletonM03D27di36_Dependency, _rootM03D27di._singletonM03D27di36_Dependency); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -138,10 +138,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -181,25 +181,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -212,7 +212,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService Resolve(Composition composition) { diff --git a/readme/span-and-readonlyspan.md b/readme/span-and-readonlyspan.md index cadd296ce..453902690 100644 --- a/readme/span-and-readonlyspan.md +++ b/readme/span-and-readonlyspan.md @@ -78,48 +78,48 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.SpanScenario.IService Root { get { - System.ReadOnlySpan transientM03D26di1_ReadOnlySpan = stackalloc Pure.DI.UsageTests.BCL.SpanScenario.Dependency[3] + System.ReadOnlySpan transientM03D27di1_ReadOnlySpan = stackalloc Pure.DI.UsageTests.BCL.SpanScenario.Dependency[3] { new Pure.DI.UsageTests.BCL.SpanScenario.Dependency(), new Pure.DI.UsageTests.BCL.SpanScenario.Dependency(), new Pure.DI.UsageTests.BCL.SpanScenario.Dependency() }; - return new Pure.DI.UsageTests.BCL.SpanScenario.Service(transientM03D26di1_ReadOnlySpan); + return new Pure.DI.UsageTests.BCL.SpanScenario.Service(transientM03D27di1_ReadOnlySpan); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -131,10 +131,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -173,25 +173,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.SpanScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.SpanScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -204,7 +204,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.SpanScenario.IService Resolve(Composition composition) { diff --git a/readme/tag-attribute.md b/readme/tag-attribute.md index 725062d7b..8f664d0f3 100644 --- a/readme/tag-attribute.md +++ b/readme/tag-attribute.md @@ -86,16 +86,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Basics.TagAttributeScenario.IService Root @@ -108,20 +108,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -133,10 +133,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -180,25 +180,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagAttributeScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagAttributeScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -211,7 +211,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TagAttributeScenario.IService Resolve(Composition composition) { diff --git a/readme/tag-type.md b/readme/tag-type.md index c15c8af18..0b71dd4a7 100644 --- a/readme/tag-type.md +++ b/readme/tag-type.md @@ -97,38 +97,38 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency _singletonM03D26di37_XyzDependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency _singletonM03D27di37_XyzDependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency XyzRoot { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - _singletonM03D26di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); - _rootM03D26di._singletonM03D26di37_XyzDependency = _singletonM03D26di37_XyzDependency; + _singletonM03D27di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); + _rootM03D27di._singletonM03D27di37_XyzDependency = _singletonM03D27di37_XyzDependency; } } } - return _rootM03D26di._singletonM03D26di37_XyzDependency; + return _rootM03D27di._singletonM03D27di37_XyzDependency; } } @@ -136,37 +136,37 @@ partial class Composition { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - _singletonM03D26di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); - _rootM03D26di._singletonM03D26di37_XyzDependency = _singletonM03D26di37_XyzDependency; + _singletonM03D27di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); + _rootM03D27di._singletonM03D27di37_XyzDependency = _singletonM03D27di37_XyzDependency; } } } - return new Pure.DI.UsageTests.Advanced.TagTypeScenario.Service(new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency(), _rootM03D26di._singletonM03D26di37_XyzDependency, new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency()); + return new Pure.DI.UsageTests.Advanced.TagTypeScenario.Service(new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency(), _rootM03D27di._singletonM03D27di37_XyzDependency, new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency()); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -178,10 +178,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -229,28 +229,28 @@ partial class Composition " Composition ..> XyzDependency : IDependency XyzRoot"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -263,7 +263,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency Resolve(Composition composition) { @@ -280,7 +280,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.TagTypeScenario.IService Resolve(Composition composition) { diff --git a/readme/tag-unique.md b/readme/tag-unique.md index fee41671b..d898a58dd 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -78,16 +78,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService Root @@ -95,32 +95,32 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM03D26di1_IEnumerable() + System.Collections.Generic.IEnumerable> LocalperBlockM03D27di1_IEnumerable() { yield return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.AbcDependency(); yield return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM03D26di1_IEnumerable = LocalperBlockM03D26di1_IEnumerable(); - return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.Service(perBlockM03D26di1_IEnumerable); + System.Collections.Generic.IEnumerable> perBlockM03D27di1_IEnumerable = LocalperBlockM03D27di1_IEnumerable(); + return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.Service(perBlockM03D27di1_IEnumerable); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -132,10 +132,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -181,25 +181,25 @@ partial class Composition " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di>.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di>.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -212,7 +212,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver> + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService Resolve(Composition composition) { diff --git a/readme/tags.md b/readme/tags.md index 2bb5b5ccf..3be668dfe 100644 --- a/readme/tags.md +++ b/readme/tags.md @@ -40,9 +40,13 @@ DI.Setup(nameof(Composition)) .Bind("Xyz") .As(Lifetime.Singleton) .To() - // "XyzRoot" is root name, "Xyz" is tag - .Root("XyzRoot", "Xyz") - .Bind().To().Root("Root"); + .Bind().To() + + // "XyzRoot" is root name, "Xyz" is tag + .Root("XyzRoot", "Xyz") + + // Specifies to create the composition root named "Root" + .Root("Root"); var composition = new Composition(); var service = composition.Root; @@ -101,38 +105,38 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; - private Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency _singletonM03D26di37_XyzDependency; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; + private Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency _singletonM03D27di37_XyzDependency; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Basics.TagsScenario.IDependency XyzRoot { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - _singletonM03D26di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); - _rootM03D26di._singletonM03D26di37_XyzDependency = _singletonM03D26di37_XyzDependency; + _singletonM03D27di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); + _rootM03D27di._singletonM03D27di37_XyzDependency = _singletonM03D27di37_XyzDependency; } } } - return _rootM03D26di._singletonM03D26di37_XyzDependency; + return _rootM03D27di._singletonM03D27di37_XyzDependency; } } @@ -140,37 +144,37 @@ partial class Composition { get { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - lock (_lockM03D26di) + lock (_lockM03D27di) { - if (ReferenceEquals(_rootM03D26di._singletonM03D26di37_XyzDependency, null)) + if (ReferenceEquals(_rootM03D27di._singletonM03D27di37_XyzDependency, null)) { - _singletonM03D26di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); - _rootM03D26di._singletonM03D26di37_XyzDependency = _singletonM03D26di37_XyzDependency; + _singletonM03D27di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); + _rootM03D27di._singletonM03D27di37_XyzDependency = _singletonM03D27di37_XyzDependency; } } } - return new Pure.DI.UsageTests.Basics.TagsScenario.Service(new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency(), _rootM03D26di._singletonM03D26di37_XyzDependency, new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency()); + return new Pure.DI.UsageTests.Basics.TagsScenario.Service(new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency(), _rootM03D27di._singletonM03D27di37_XyzDependency, new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency()); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -182,10 +186,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -233,28 +237,28 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - var valResolverM03D26di_0001 = new ResolverM03D26di_0001(); - ResolverM03D26di.Value = valResolverM03D26di_0001; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + var valResolverM03D27di_0001 = new ResolverM03D27di_0001(); + ResolverM03D27di.Value = valResolverM03D27di_0001; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IDependency), valResolverM03D26di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IService), valResolverM03D26di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IDependency), valResolverM03D27di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IService), valResolverM03D27di_0001) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -267,7 +271,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TagsScenario.IDependency Resolve(Composition composition) { @@ -285,7 +289,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0001: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TagsScenario.IService Resolve(Composition composition) { diff --git a/readme/task.md b/readme/task.md index 1c1aad242..e8ad85c75 100644 --- a/readme/task.md +++ b/readme/task.md @@ -107,49 +107,49 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.BCL.TaskScenario.IService GetRoot(System.Threading.CancellationToken cancellationToken) { - var perResolveM03D26di41_Func = default(System.Func); - System.Threading.Tasks.TaskScheduler transientM03D26di5_TaskScheduler = TaskScheduler.Current; - System.Threading.Tasks.TaskContinuationOptions transientM03D26di4_TaskContinuationOptions = global::System.Threading.Tasks.TaskContinuationOptions.None; - System.Threading.Tasks.TaskCreationOptions transientM03D26di3_TaskCreationOptions = global::System.Threading.Tasks.TaskCreationOptions.None; - System.Threading.Tasks.TaskFactory perBlockM03D26di2_TaskFactory; + var perResolveM03D27di41_Func = default(System.Func); + System.Threading.Tasks.TaskScheduler transientM03D27di5_TaskScheduler = TaskScheduler.Current; + System.Threading.Tasks.TaskContinuationOptions transientM03D27di4_TaskContinuationOptions = global::System.Threading.Tasks.TaskContinuationOptions.None; + System.Threading.Tasks.TaskCreationOptions transientM03D27di3_TaskCreationOptions = global::System.Threading.Tasks.TaskCreationOptions.None; + System.Threading.Tasks.TaskFactory perBlockM03D27di2_TaskFactory; { - var cancellationToken_M03D26di1 = cancellationToken; - var taskCreationOptions_M03D26di2 = transientM03D26di3_TaskCreationOptions; - var taskContinuationOptions_M03D26di3 = transientM03D26di4_TaskContinuationOptions; - var taskScheduler_M03D26di4 = transientM03D26di5_TaskScheduler; - perBlockM03D26di2_TaskFactory = new global::System.Threading.Tasks.TaskFactory(cancellationToken_M03D26di1, taskCreationOptions_M03D26di2, taskContinuationOptions_M03D26di3, taskScheduler_M03D26di4); + var cancellationToken_M03D27di1 = cancellationToken; + var taskCreationOptions_M03D27di2 = transientM03D27di3_TaskCreationOptions; + var taskContinuationOptions_M03D27di3 = transientM03D27di4_TaskContinuationOptions; + var taskScheduler_M03D27di4 = transientM03D27di5_TaskScheduler; + perBlockM03D27di2_TaskFactory = new global::System.Threading.Tasks.TaskFactory(cancellationToken_M03D27di1, taskCreationOptions_M03D27di2, taskContinuationOptions_M03D27di3, taskScheduler_M03D27di4); } - perResolveM03D26di41_Func = new global::System.Func( + perResolveM03D27di41_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M03D26di5 = new Pure.DI.UsageTests.BCL.TaskScenario.Dependency(); - return factory_M03D26di5; + var factory_M03D27di5 = new Pure.DI.UsageTests.BCL.TaskScenario.Dependency(); + return factory_M03D27di5; }); - System.Threading.Tasks.Task transientM03D26di1_Task; + System.Threading.Tasks.Task transientM03D27di1_Task; { - var factory_M03D26di6 = perResolveM03D26di41_Func; - var taskFactory_M03D26di7 = perBlockM03D26di2_TaskFactory; - transientM03D26di1_Task = taskFactory_M03D26di7.StartNew(factory_M03D26di6); + var factory_M03D27di6 = perResolveM03D27di41_Func; + var taskFactory_M03D27di7 = perBlockM03D27di2_TaskFactory; + transientM03D27di1_Task = taskFactory_M03D27di7.StartNew(factory_M03D27di6); } - return new Pure.DI.UsageTests.BCL.TaskScenario.Service(transientM03D26di1_Task); + return new Pure.DI.UsageTests.BCL.TaskScenario.Service(transientM03D27di1_Task); } public override string ToString() diff --git a/readme/threadsafe-hint.md b/readme/threadsafe-hint.md index f1c59c610..9196187e5 100644 --- a/readme/threadsafe-hint.md +++ b/readme/threadsafe-hint.md @@ -18,8 +18,8 @@ class Service(IDependency dependency) : IService; DI.Setup(nameof(Composition)) .Hint(ThreadSafe, "Off") - .Bind().To() - .Bind().To().Root("Root"); + .Bind().To() + .RootBind("Root").To(); var composition = new Composition(); var service = composition.Root; @@ -65,16 +65,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService Root @@ -87,20 +87,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -112,10 +112,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -154,25 +154,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -185,7 +185,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService Resolve(Composition composition) { diff --git a/readme/tostring-hint.md b/readme/tostring-hint.md index 23cf9c887..ca981f0fc 100644 --- a/readme/tostring-hint.md +++ b/readme/tostring-hint.md @@ -16,8 +16,8 @@ class Service(IDependency dependency) : IService; DI.Setup(nameof(Composition)) .Hint(Hint.ToString, "On") - .Bind().To() - .Bind().To().Root("MyService"); + .Bind().To() + .RootBind("MyService").To(); var composition = new Composition(); string classDiagram = composition.ToString(); @@ -63,16 +63,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Hints.ToStringHintScenario.IService MyService @@ -85,20 +85,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -110,10 +110,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -152,25 +152,25 @@ partial class Composition " Composition ..> Service : IService MyService"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ToStringHintScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ToStringHintScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -183,7 +183,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.ToStringHintScenario.IService Resolve(Composition composition) { diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index 0fdde2caf..3d6f08261 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -34,8 +34,10 @@ partial class Composition { private void Setup() => DI.Setup(nameof(Composition)) - .Bind().To() - .Bind().To() + .Bind().To() + .Bind().To() + + // Composition root .Root("Root"); } @@ -73,19 +75,22 @@ classDiagram + object Resolve(Type type, object? tag) } class Owned - class Service { - +Service(FuncᐸOwnedᐸIDependencyᐳᐳ dependencyFactory) - } Dependency --|> IDependency : class Dependency { +Dependency() } + Service --|> IService : + class Service { + +Service(FuncᐸOwnedᐸIDependencyᐳᐳ dependencyFactory) + } class FuncᐸOwnedᐸIDependencyᐳᐳ class OwnedᐸIDependencyᐳ class IDependency { <> } - Service o-- "PerResolve" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ + class IService { + <> + } Service o-- "PerResolve" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ Composition ..> Service : Service Root FuncᐸOwnedᐸIDependencyᐳᐳ o-- "PerBlock" OwnedᐸIDependencyᐳ : OwnedᐸIDependencyᐳ @@ -101,63 +106,63 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; - private readonly object _lockM03D26di; + private readonly Composition _rootM03D27di; + private readonly object _lockM03D27di; public Composition() { - _rootM03D26di = this; - _lockM03D26di = new object(); + _rootM03D27di = this; + _lockM03D27di = new object(); } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; - _lockM03D26di = _rootM03D26di._lockM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; + _lockM03D27di = _rootM03D27di._lockM03D27di; } public Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service Root { get { - var perResolveM03D26di43_Func = default(System.Func>); - perResolveM03D26di43_Func = new global::System.Func>( + var perResolveM03D27di41_Func = default(System.Func>); + perResolveM03D27di41_Func = new global::System.Func>( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var accumulatorM03D26di42 = new Pure.DI.Owned(); - Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency transientM03D26di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency(); - accumulatorM03D26di42.Add(transientM03D26di3_Dependency); - Pure.DI.Owned perBlockM03D26di1_Owned; + var accumulatorM03D27di40 = new Pure.DI.Owned(); + Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency transientM03D27di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency(); + accumulatorM03D27di40.Add(transientM03D27di3_Dependency); + Pure.DI.Owned perBlockM03D27di1_Owned; { - var owned_M03D26di2 = accumulatorM03D26di42; - var value_M03D26di3 = transientM03D26di3_Dependency; - perBlockM03D26di1_Owned = new Owned(value_M03D26di3, owned_M03D26di2); + var owned_M03D27di2 = accumulatorM03D27di40; + var value_M03D27di3 = transientM03D27di3_Dependency; + perBlockM03D27di1_Owned = new Owned(value_M03D27di3, owned_M03D27di2); } - accumulatorM03D26di42.Add(perBlockM03D26di1_Owned); - var factory_M03D26di1 = perBlockM03D26di1_Owned; - return factory_M03D26di1; + accumulatorM03D27di40.Add(perBlockM03D27di1_Owned); + var factory_M03D27di1 = perBlockM03D27di1_Owned; + return factory_M03D27di1; }); - return new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service(perResolveM03D26di43_Func); + return new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service(perResolveM03D27di41_Func); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -169,10 +174,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -194,19 +199,22 @@ partial class Composition " + object Resolve(Type type, object? tag)\n" + " }\n" + " class Owned\n" + - " class Service {\n" + - " +Service(FuncᐸOwnedᐸIDependencyᐳᐳ dependencyFactory)\n" + - " }\n" + " Dependency --|> IDependency : \n" + " class Dependency {\n" + " +Dependency()\n" + " }\n" + + " Service --|> IService : \n" + + " class Service {\n" + + " +Service(FuncᐸOwnedᐸIDependencyᐳᐳ dependencyFactory)\n" + + " }\n" + " class FuncᐸOwnedᐸIDependencyᐳᐳ\n" + " class OwnedᐸIDependencyᐳ\n" + " class IDependency {\n" + " <>\n" + " }\n" + - " Service o-- \"PerResolve\" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ\n" + + " class IService {\n" + + " <>\n" + + " }\n" + " Service o-- \"PerResolve\" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ\n" + " Composition ..> Service : Service Root\n" + " FuncᐸOwnedᐸIDependencyᐳᐳ o-- \"PerBlock\" OwnedᐸIDependencyᐳ : OwnedᐸIDependencyᐳ\n" + @@ -214,25 +222,25 @@ partial class Composition " OwnedᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -245,7 +253,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service Resolve(Composition composition) { diff --git a/readme/tracking-disposable-instances-per-a-composition-root.md b/readme/tracking-disposable-instances-per-a-composition-root.md index 4518140e3..8334ee9e0 100644 --- a/readme/tracking-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-disposable-instances-per-a-composition-root.md @@ -29,8 +29,11 @@ partial class Composition { private void Setup() => DI.Setup(nameof(Composition)) - .Bind().To() - .Bind().To() + .Bind().To() + .Bind().To() + + // A special composition root + // that allows to manage disposable dependencies .Root>("Root"); } @@ -96,44 +99,44 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.Owned Root { get { - var accumulatorM03D26di39 = new Pure.DI.Owned(); - Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency transientM03D26di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency(); - accumulatorM03D26di39.Add(transientM03D26di3_Dependency); - Pure.DI.Owned perBlockM03D26di0_Owned; + var accumulatorM03D27di39 = new Pure.DI.Owned(); + Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency transientM03D27di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency(); + accumulatorM03D27di39.Add(transientM03D27di3_Dependency); + Pure.DI.Owned perBlockM03D27di0_Owned; { - var owned_M03D26di1 = accumulatorM03D26di39; - var value_M03D26di2 = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Service(transientM03D26di3_Dependency); - perBlockM03D26di0_Owned = new Owned(value_M03D26di2, owned_M03D26di1); + var owned_M03D27di1 = accumulatorM03D27di39; + var value_M03D27di2 = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Service(transientM03D27di3_Dependency); + perBlockM03D27di0_Owned = new Owned(value_M03D27di2, owned_M03D27di1); } - accumulatorM03D26di39.Add(perBlockM03D26di0_Owned); - return perBlockM03D26di0_Owned; + accumulatorM03D27di39.Add(perBlockM03D27di0_Owned); + return perBlockM03D27di0_Owned; } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) @@ -179,9 +182,9 @@ partial class Composition } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { diff --git a/readme/transient.md b/readme/transient.md index e363f10ed..3a1032ce2 100644 --- a/readme/transient.md +++ b/readme/transient.md @@ -27,8 +27,8 @@ class Service( } DI.Setup(nameof(Composition)) - .Bind().As(Lifetime.Transient).To() - .Bind().To().Root("Root"); + .Bind().As(Lifetime.Transient).To() + .RootBind("Root").To(); var composition = new Composition(); var service1 = composition.Root; @@ -76,16 +76,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Lifetimes.TransientScenario.IService Root @@ -98,20 +98,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -123,10 +123,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -166,25 +166,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.TransientScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.TransientScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -197,7 +197,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.TransientScenario.IService Resolve(Composition composition) { diff --git a/readme/tuple.md b/readme/tuple.md index 3f93175b5..bbd60c209 100644 --- a/readme/tuple.md +++ b/readme/tuple.md @@ -74,43 +74,43 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.TupleScenario.IService Root { get { - Pure.DI.UsageTests.BCL.TupleScenario.Point transientM03D26di2_Point = new Point(7, 9); - return new Pure.DI.UsageTests.BCL.TupleScenario.Service((transientM03D26di2_Point, new Pure.DI.UsageTests.BCL.TupleScenario.Dependency())); + Pure.DI.UsageTests.BCL.TupleScenario.Point transientM03D27di2_Point = new Point(7, 9); + return new Pure.DI.UsageTests.BCL.TupleScenario.Service((transientM03D27di2_Point, new Pure.DI.UsageTests.BCL.TupleScenario.Dependency())); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -122,10 +122,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -170,25 +170,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.TupleScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.TupleScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -201,7 +201,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.TupleScenario.IService Resolve(Composition composition) { diff --git a/readme/type-attribute.md b/readme/type-attribute.md index 1d2911971..42d1a38a2 100644 --- a/readme/type-attribute.md +++ b/readme/type-attribute.md @@ -77,16 +77,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService Root @@ -99,20 +99,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -124,10 +124,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -166,25 +166,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -197,7 +197,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService Resolve(Composition composition) { diff --git a/readme/valuetask.md b/readme/valuetask.md index 3dbc4cb36..7c7d6a249 100644 --- a/readme/valuetask.md +++ b/readme/valuetask.md @@ -76,47 +76,47 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.ValueTaskScenario.IService Root { get { - System.Threading.Tasks.ValueTask transientM03D26di1_ValueTask; + System.Threading.Tasks.ValueTask transientM03D27di1_ValueTask; { - var value_M03D26di1 = new Pure.DI.UsageTests.BCL.ValueTaskScenario.Dependency(); - transientM03D26di1_ValueTask = new global::System.Threading.Tasks.ValueTask(value_M03D26di1); + var value_M03D27di1 = new Pure.DI.UsageTests.BCL.ValueTaskScenario.Dependency(); + transientM03D27di1_ValueTask = new global::System.Threading.Tasks.ValueTask(value_M03D27di1); } - return new Pure.DI.UsageTests.BCL.ValueTaskScenario.Service(transientM03D26di1_ValueTask); + return new Pure.DI.UsageTests.BCL.ValueTaskScenario.Service(transientM03D27di1_ValueTask); } } public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -128,10 +128,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -172,25 +172,25 @@ partial class Composition " ValueTaskᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ValueTaskScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ValueTaskScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -203,7 +203,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ValueTaskScenario.IService Resolve(Composition composition) { diff --git a/readme/weak-reference.md b/readme/weak-reference.md index 552867bb6..0c4e6c651 100644 --- a/readme/weak-reference.md +++ b/readme/weak-reference.md @@ -67,16 +67,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM03D26di; + private readonly Composition _rootM03D27di; public Composition() { - _rootM03D26di = this; + _rootM03D27di = this; } internal Composition(Composition baseComposition) { - _rootM03D26di = baseComposition._rootM03D26di; + _rootM03D27di = baseComposition._rootM03D27di; } public Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService Root @@ -89,20 +89,20 @@ partial class Composition public T Resolve() { - return ResolverM03D26di.Value.Resolve(this); + return ResolverM03D27di.Value.Resolve(this); } public T Resolve(object? tag) { - return ResolverM03D26di.Value.ResolveByTag(this, tag); + return ResolverM03D27di.Value.ResolveByTag(this, tag); } public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.Resolve(this); @@ -114,10 +114,10 @@ partial class Composition public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM03D26di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - var finish = index + _bucketSizeM03D26di; + var index = (int)(_bucketSizeM03D27di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + var finish = index + _bucketSizeM03D27di; do { - ref var pair = ref _bucketsM03D26di[index]; + ref var pair = ref _bucketsM03D27di[index]; if (ReferenceEquals(pair.Key, type)) { return pair.Value.ResolveByTag(this, tag); @@ -160,25 +160,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM03D26di; - private readonly static global::Pure.DI.Pair>[] _bucketsM03D26di; + private readonly static int _bucketSizeM03D27di; + private readonly static global::Pure.DI.Pair>[] _bucketsM03D27di; static Composition() { - var valResolverM03D26di_0000 = new ResolverM03D26di_0000(); - ResolverM03D26di.Value = valResolverM03D26di_0000; - _bucketsM03D26di = global::Pure.DI.Buckets>.Create( + var valResolverM03D27di_0000 = new ResolverM03D27di_0000(); + ResolverM03D27di.Value = valResolverM03D27di_0000; + _bucketsM03D27di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM03D26di, + out _bucketSizeM03D27di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService), valResolverM03D26di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService), valResolverM03D27di_0000) }); } - private sealed class ResolverM03D26di: global::Pure.DI.IResolver + private sealed class ResolverM03D27di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM03D26di(); + public static global::Pure.DI.IResolver Value = new ResolverM03D27di(); public T Resolve(Composition composite) { @@ -191,7 +191,7 @@ partial class Composition } } - private sealed class ResolverM03D26di_0000: global::Pure.DI.IResolver + private sealed class ResolverM03D27di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService Resolve(Composition composition) { diff --git a/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs b/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs index 9b77e75bc..17fae971d 100644 --- a/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs @@ -160,7 +160,8 @@ private string FormatRoot(Root root) rootArgsStr = $"({string.Join(", ", root.Args.Select(arg => $"{typeResolver.Resolve(arg.InstanceType)} {arg.VariableName}"))})"; } - return $"{FormatType(root.Injection.Type, DefaultFormatOptions)} {root.DisplayName}{typeArgsStr}{rootArgsStr}"; + var displayName = root.IsPublic ? root.DisplayName : "_"; + return $"{FormatType(root.Injection.Type, DefaultFormatOptions)} {displayName}{typeArgsStr}{rootArgsStr}"; } private static string FormatCardinality(Lifetime lifetime) =>