From 31610e70b44e1a0995b761bf1a4dfe46ab19f55e Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Sat, 27 Apr 2024 23:41:22 +0300 Subject: [PATCH] Update README.md --- build/ReadmeTarget.cs | 14 +- readme/ArrayDetails.md | 64 ++++----- readme/EnumDetails.md | 76 +++++----- readme/FuncDetails.md | 70 ++++----- readme/SingletonDetails.md | 76 +++++----- readme/TransientDetails.md | 64 ++++----- readme/a-few-partial-classes.md | 54 +++---- readme/accumulators.md | 98 ++++++------- readme/advanced-interception.md | 56 ++++---- readme/arguments.md | 68 ++++----- readme/array.md | 54 +++---- readme/async-disposable-scope.md | 128 ++++++++--------- readme/async-disposable-singleton.md | 108 +++++++------- readme/async-enumerable.md | 60 ++++---- readme/auto-bindings.md | 6 +- readme/auto-scoped.md | 100 ++++++------- readme/check-for-a-root.md | 70 ++++----- readme/complex-generics.md | 56 ++++---- readme/composition-root-kinds.md | 62 ++++---- readme/composition-roots-simplified.md | 58 ++++---- readme/composition-roots.md | 68 ++++----- readme/constructor-ordinal-attribute.md | 62 ++++---- readme/custom-attributes.md | 68 ++++----- readme/decorator.md | 54 +++---- readme/default-lifetime.md | 82 +++++------ readme/default-values.md | 54 +++---- readme/dependent-compositions.md | 116 +++++++-------- readme/disposable-singleton.md | 94 ++++++------ readme/enumerable-generics.md | 74 +++++----- readme/enumerable.md | 60 ++++---- readme/factory.md | 66 ++++----- readme/field-injection.md | 60 ++++---- readme/func-with-arguments.md | 82 +++++------ readme/func-with-tag.md | 70 ++++----- readme/func.md | 70 ++++----- ...eric-composition-roots-with-constraints.md | 18 +-- readme/generic-composition-roots.md | 14 +- readme/generics.md | 54 +++---- readme/injection.md | 62 ++++---- readme/injections-of-abstractions.md | 6 +- readme/instance-initialization.md | 70 ++++----- readme/interception.md | 56 ++++---- readme/keyed-service-provider.md | 102 ++++++------- readme/lazy.md | 76 +++++----- readme/manually-started-tasks.md | 36 ++--- readme/member-ordinal-attribute.md | 84 +++++------ readme/method-injection.md | 60 ++++---- readme/multi-contract-bindings.md | 54 +++---- readme/oncannotresolve-hint.md | 58 ++++---- readme/ondependencyinjection-hint.md | 56 ++++---- readme/onnewinstance-hint.md | 86 +++++------ readme/overriding-the-bcl-binding.md | 58 ++++---- readme/partial-class.md | 62 ++++---- readme/perblock.md | 80 +++++------ readme/perresolve.md | 94 ++++++------ readme/property-injection.md | 60 ++++---- readme/required-properties-or-fields.md | 62 ++++---- readme/resolve-hint.md | 6 +- readme/resolve-methods.md | 74 +++++----- readme/root-arguments.md | 6 +- readme/rootbind.md | 54 +++---- readme/scope.md | 114 +++++++-------- readme/service-collection.md | 108 +++++++------- readme/service-provider-with-scope.md | 136 +++++++++--------- readme/service-provider.md | 106 +++++++------- readme/simplified-binding.md | 10 +- readme/singleton.md | 74 +++++----- readme/span-and-readonlyspan.md | 58 ++++---- readme/tag-attribute.md | 54 +++---- readme/tag-type.md | 94 ++++++------ readme/tag-unique.md | 60 ++++---- readme/tags.md | 94 ++++++------ readme/task.md | 54 +++---- readme/threadsafe-hint.md | 54 +++---- readme/tostring-hint.md | 54 +++---- ...async-disposable-instances-in-delegates.md | 90 ++++++------ ...osable-instances-per-a-composition-root.md | 44 +++--- ...cking-disposable-instances-in-delegates.md | 90 ++++++------ ...osable-instances-per-a-composition-root.md | 44 +++--- readme/transient.md | 54 +++---- readme/tuple.md | 58 ++++---- readme/type-attribute.md | 54 +++---- readme/valuetask.md | 62 ++++---- readme/weak-reference.md | 56 ++++---- 84 files changed, 2749 insertions(+), 2743 deletions(-) diff --git a/build/ReadmeTarget.cs b/build/ReadmeTarget.cs index 880053674..74de94933 100644 --- a/build/ReadmeTarget.cs +++ b/build/ReadmeTarget.cs @@ -318,6 +318,7 @@ private static async Task AddClassDiagram(string logsDirectory, string exampleNa private static async Task AddExample(string logsDirectory, string exampleSearchPattern, TextWriter examplesWriter) { + var salt = $"M{DateTime.Now.Month:00}D{DateTime.Now.Day:00}di"; foreach (var generatedCodeFile in Directory.GetFiles(Path.Combine(logsDirectory, "Pure.DI", "Pure.DI.SourceGenerator"), exampleSearchPattern).OrderBy(i => i)) { var ns = string.Join('.', Path.GetFileName(generatedCodeFile).Split('.').Reverse().Skip(3).Reverse()) + "."; @@ -352,10 +353,15 @@ private static async Task AddExample(string logsDirectory, string exampleSearchP .Select(i => i .TrimEnd() .Replace("\t", " ") - .Replace("global::System.", "") - .Replace("Runtime.CompilerServices.", "") - .Replace("global::Pure.DI.", "") - .Replace(ns, ""))); + .Replace(ns, "") + .Replace("global::", "") + .Replace("System.Threading.Tasks.", "") + .Replace("System.Threading.", "") + .Replace("System.Runtime.CompilerServices.", "") + .Replace("System.Collections.Generic.", "") + .Replace("System.", "") + .Replace("Pure.DI.", "") + .Replace(salt, ""))); await examplesWriter.WriteLineAsync(generatedCode); await examplesWriter.WriteLineAsync("```"); await examplesWriter.WriteLineAsync(""); diff --git a/readme/ArrayDetails.md b/readme/ArrayDetails.md index eb294a4ed..f61e591c3 100644 --- a/readme/ArrayDetails.md +++ b/readme/ArrayDetails.md @@ -88,51 +88,51 @@ classDiagram ```c# partial class Array { - private readonly Array _rootM04D27di; + private readonly Array _root; public Array() { - _rootM04D27di = this; + _root = this; } internal Array(Array baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] - public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() + public partial Benchmarks.Model.CompositionRoot TestPureDIByCR() { - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) })), new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) }), new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) }), new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) }), 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 Benchmarks.Model.CompositionRoot(new Benchmarks.Model.Service1(new Benchmarks.Model.Service2Array(new Benchmarks.Model.IService3[4] { new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v2(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v4(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()) })), new Benchmarks.Model.Service2Array(new Benchmarks.Model.IService3[4] { new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v2(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v4(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()) }), new Benchmarks.Model.Service2Array(new Benchmarks.Model.IService3[4] { new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v2(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v4(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()) }), new Benchmarks.Model.Service2Array(new Benchmarks.Model.IService3[4] { new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v2(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3v4(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()) }), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -145,18 +145,18 @@ partial class Array [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -245,25 +245,25 @@ partial class Array " ArrayᐸIService3ᐳ *-- Service3v4 : 4 IService3"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Array() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D27di_0000) + new Pair>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Array composite) { @@ -276,21 +276,21 @@ partial class Array } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { - public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Array composition) + public Benchmarks.Model.CompositionRoot Resolve(Array composition) { return composition.TestPureDIByCR(); } - public Pure.DI.Benchmarks.Model.CompositionRoot ResolveByTag(Array composition, object tag) + public Benchmarks.Model.CompositionRoot ResolveByTag(Array composition, object tag) { switch (tag) { case null: return composition.TestPureDIByCR(); default: - throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot."); + throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Benchmarks.Model.CompositionRoot."); } } } diff --git a/readme/EnumDetails.md b/readme/EnumDetails.md index 3970b85d1..4b80179ec 100644 --- a/readme/EnumDetails.md +++ b/readme/EnumDetails.md @@ -88,60 +88,60 @@ classDiagram ```c# partial class Enum { - private readonly Enum _rootM04D27di; + private readonly Enum _root; public Enum() { - _rootM04D27di = this; + _root = this; } internal Enum(Enum baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] - public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() + public partial Benchmarks.Model.CompositionRoot TestPureDIByCR() { [MethodImpl((MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable LocalperBlockM04D27di10_IEnumerable() + IEnumerable LocalperBlock10_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()); + yield return new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); + yield return new Benchmarks.Model.Service3v2(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); + yield return new Benchmarks.Model.Service3v3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); + yield return new Benchmarks.Model.Service3v4(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); } - System.Collections.Generic.IEnumerable perBlockM04D27di10_IEnumerable = LocalperBlockM04D27di10_IEnumerable(); - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D27di10_IEnumerable)), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D27di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D27di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D27di10_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()); + IEnumerable perBlock10_IEnumerable = LocalperBlock10_IEnumerable(); + return new Benchmarks.Model.CompositionRoot(new Benchmarks.Model.Service1(new Benchmarks.Model.Service2Enum(perBlock10_IEnumerable)), new Benchmarks.Model.Service2Enum(perBlock10_IEnumerable), new Benchmarks.Model.Service2Enum(perBlock10_IEnumerable), new Benchmarks.Model.Service2Enum(perBlock10_IEnumerable), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -154,18 +154,18 @@ partial class Enum [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -254,25 +254,25 @@ partial class Enum " IEnumerableᐸIService3ᐳ *-- Service3v4 : 4 IService3"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Enum() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D27di_0000) + new Pair>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Enum composite) { @@ -285,21 +285,21 @@ partial class Enum } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { - public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Enum composition) + public Benchmarks.Model.CompositionRoot Resolve(Enum composition) { return composition.TestPureDIByCR(); } - public Pure.DI.Benchmarks.Model.CompositionRoot ResolveByTag(Enum composition, object tag) + public Benchmarks.Model.CompositionRoot ResolveByTag(Enum composition, object tag) { switch (tag) { case null: return composition.TestPureDIByCR(); default: - throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot."); + throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Benchmarks.Model.CompositionRoot."); } } } diff --git a/readme/FuncDetails.md b/readme/FuncDetails.md index 6b4f71690..6b76cd981 100644 --- a/readme/FuncDetails.md +++ b/readme/FuncDetails.md @@ -67,58 +67,58 @@ classDiagram ```c# partial class Func { - private readonly Func _rootM04D27di; + private readonly Func _root; public Func() { - _rootM04D27di = this; + _root = this; } internal Func(Func baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] - public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() + public partial Benchmarks.Model.CompositionRoot TestPureDIByCR() { - System.Func perBlockM04D27di10_Func = new Func( + Func perBlock10_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - var value_M04D27di1 = new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); - return value_M04D27di1; + var value_1 = new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); + return value_1; }); - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D27di10_Func)), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D27di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D27di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D27di10_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 Benchmarks.Model.CompositionRoot(new Benchmarks.Model.Service1(new Benchmarks.Model.Service2Func(perBlock10_Func)), new Benchmarks.Model.Service2Func(perBlock10_Func), new Benchmarks.Model.Service2Func(perBlock10_Func), new Benchmarks.Model.Service2Func(perBlock10_Func), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -131,18 +131,18 @@ partial class Func [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -210,25 +210,25 @@ partial class Func " FuncᐸIService3ᐳ *-- Service3 : IService3"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Func() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D27di_0000) + new Pair>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Func composite) { @@ -241,21 +241,21 @@ partial class Func } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { - public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Func composition) + public Benchmarks.Model.CompositionRoot Resolve(Func composition) { return composition.TestPureDIByCR(); } - public Pure.DI.Benchmarks.Model.CompositionRoot ResolveByTag(Func composition, object tag) + public Benchmarks.Model.CompositionRoot ResolveByTag(Func composition, object tag) { switch (tag) { case null: return composition.TestPureDIByCR(); default: - throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot."); + throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Benchmarks.Model.CompositionRoot."); } } } diff --git a/readme/SingletonDetails.md b/readme/SingletonDetails.md index 9587a8311..7335f50db 100644 --- a/readme/SingletonDetails.md +++ b/readme/SingletonDetails.md @@ -69,61 +69,61 @@ classDiagram ```c# partial class Singleton { - private readonly Singleton _rootM04D27di; - private Pure.DI.Benchmarks.Model.Service1 _scopedM04D27di37_Service1; - private Pure.DI.Benchmarks.Model.Service4 _scopedM04D27di40_Service4; + private readonly Singleton _root; + private Benchmarks.Model.Service1 _scoped37_Service1; + private Benchmarks.Model.Service4 _scoped40_Service4; public Singleton() { - _rootM04D27di = this; + _root = this; } internal Singleton(Singleton baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] - public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() + public partial Benchmarks.Model.CompositionRoot TestPureDIByCR() { - if (_scopedM04D27di40_Service4 == null) + if (_scoped40_Service4 == null) { - _scopedM04D27di40_Service4 = new Pure.DI.Benchmarks.Model.Service4(); + _scoped40_Service4 = new Benchmarks.Model.Service4(); } - if (_scopedM04D27di37_Service1 == null) + if (_scoped37_Service1 == null) { - _scopedM04D27di37_Service1 = new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4))); + _scoped37_Service1 = new Benchmarks.Model.Service1(new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4))); } - return new Pure.DI.Benchmarks.Model.CompositionRoot(_scopedM04D27di37_Service1, new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4)), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D27di40_Service4, _scopedM04D27di40_Service4), _scopedM04D27di40_Service4, _scopedM04D27di40_Service4); + return new Benchmarks.Model.CompositionRoot(_scoped37_Service1, new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4)), new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4)), new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4)), new Benchmarks.Model.Service3(_scoped40_Service4, _scoped40_Service4), _scoped40_Service4, _scoped40_Service4); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -136,18 +136,18 @@ partial class Singleton [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -217,25 +217,25 @@ partial class Singleton " Singleton ..> CompositionRoot : CompositionRoot TestPureDIByCR()"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Singleton() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D27di_0000) + new Pair>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Singleton composite) { @@ -248,21 +248,21 @@ partial class Singleton } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { - public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Singleton composition) + public Benchmarks.Model.CompositionRoot Resolve(Singleton composition) { return composition.TestPureDIByCR(); } - public Pure.DI.Benchmarks.Model.CompositionRoot ResolveByTag(Singleton composition, object tag) + public Benchmarks.Model.CompositionRoot ResolveByTag(Singleton composition, object tag) { switch (tag) { case null: return composition.TestPureDIByCR(); default: - throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot."); + throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Benchmarks.Model.CompositionRoot."); } } } diff --git a/readme/TransientDetails.md b/readme/TransientDetails.md index fd3c5cd44..bf6fa25e5 100644 --- a/readme/TransientDetails.md +++ b/readme/TransientDetails.md @@ -69,51 +69,51 @@ classDiagram ```c# partial class Transient { - private readonly Transient _rootM04D27di; + private readonly Transient _root; public Transient() { - _rootM04D27di = this; + _root = this; } internal Transient(Transient baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] - public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() + public partial Benchmarks.Model.CompositionRoot TestPureDIByCR() { - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()))), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4())), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4())), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4())), 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 Benchmarks.Model.CompositionRoot(new Benchmarks.Model.Service1(new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()))), new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4())), new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4())), new Benchmarks.Model.Service2(new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4())), new Benchmarks.Model.Service3(new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()), new Benchmarks.Model.Service4(), new Benchmarks.Model.Service4()); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -126,18 +126,18 @@ partial class Transient [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -207,25 +207,25 @@ partial class Transient " Transient ..> CompositionRoot : CompositionRoot TestPureDIByCR()"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Transient() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D27di_0000) + new Pair>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Transient composite) { @@ -238,21 +238,21 @@ partial class Transient } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { - public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Transient composition) + public Benchmarks.Model.CompositionRoot Resolve(Transient composition) { return composition.TestPureDIByCR(); } - public Pure.DI.Benchmarks.Model.CompositionRoot ResolveByTag(Transient composition, object tag) + public Benchmarks.Model.CompositionRoot ResolveByTag(Transient composition, object tag) { switch (tag) { case null: return composition.TestPureDIByCR(); default: - throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot."); + throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Benchmarks.Model.CompositionRoot."); } } } diff --git a/readme/a-few-partial-classes.md b/readme/a-few-partial-classes.md index 4f1863b80..e0d47c0e6 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 _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -103,30 +103,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -139,18 +139,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -189,25 +189,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -220,7 +220,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/accumulators.md b/readme/accumulators.md index 2c6b8f6ea..1a8bb3a90 100644 --- a/readme/accumulators.md +++ b/readme/accumulators.md @@ -90,20 +90,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private XyzDependency _singletonM04D27di38_XyzDependency; + private readonly Composition _root; + private readonly object _lock; + private XyzDependency _singleton38_XyzDependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public (IService service, MyAccumulator accumulator) Root @@ -111,64 +111,64 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var accumulatorM04D27di42 = new MyAccumulator(); - AbcDependency perBlockM04D27di4_AbcDependency = new AbcDependency(); - if (_rootM04D27di._singletonM04D27di38_XyzDependency == null) + var accumulator42 = new MyAccumulator(); + AbcDependency perBlock4_AbcDependency = new AbcDependency(); + if (_root._singleton38_XyzDependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di38_XyzDependency == null) + if (_root._singleton38_XyzDependency == null) { - XyzDependency _singletonM04D27di38_XyzDependencyTemp; - _singletonM04D27di38_XyzDependencyTemp = new XyzDependency(); - accumulatorM04D27di42.Add(_singletonM04D27di38_XyzDependencyTemp); - Threading.Thread.MemoryBarrier(); - _singletonM04D27di38_XyzDependency = _singletonM04D27di38_XyzDependencyTemp; - _rootM04D27di._singletonM04D27di38_XyzDependency = _singletonM04D27di38_XyzDependency; + XyzDependency _singleton38_XyzDependencyTemp; + _singleton38_XyzDependencyTemp = new XyzDependency(); + accumulator42.Add(_singleton38_XyzDependencyTemp); + Thread.MemoryBarrier(); + _singleton38_XyzDependency = _singleton38_XyzDependencyTemp; + _root._singleton38_XyzDependency = _singleton38_XyzDependency; } } } - AbcDependency transientM04D27di3_AbcDependency = new AbcDependency(); - lock (_lockM04D27di) + AbcDependency transient3_AbcDependency = new AbcDependency(); + lock (_lock) { - accumulatorM04D27di42.Add(transientM04D27di3_AbcDependency); + accumulator42.Add(transient3_AbcDependency); } - Service transientM04D27di1_Service = new Service(transientM04D27di3_AbcDependency, _rootM04D27di._singletonM04D27di38_XyzDependency, perBlockM04D27di4_AbcDependency); - lock (_lockM04D27di) + Service transient1_Service = new Service(transient3_AbcDependency, _root._singleton38_XyzDependency, perBlock4_AbcDependency); + lock (_lock) { - accumulatorM04D27di42.Add(transientM04D27di1_Service); + accumulator42.Add(transient1_Service); } - return (transientM04D27di1_Service, accumulatorM04D27di42); + return (transient1_Service, accumulator42); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -181,18 +181,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -243,25 +243,25 @@ partial class Composition " Composition ..> ValueTupleᐸIServiceˏMyAccumulatorᐳ : ValueTupleᐸIServiceˏMyAccumulatorᐳ Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di<(IService service, MyAccumulator accumulator)>.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver<(IService service, MyAccumulator accumulator)>.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof((IService service, MyAccumulator accumulator)), valResolverM04D27di_0000) + new Pair>(typeof((IService service, MyAccumulator accumulator)), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -274,7 +274,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver, IResolver + private sealed class Resolver_0000: IResolver, IResolver { public (IService service, MyAccumulator accumulator) Resolve(Composition composition) { diff --git a/readme/advanced-interception.md b/readme/advanced-interception.md index dbb367402..5dc93d647 100644 --- a/readme/advanced-interception.md +++ b/readme/advanced-interception.md @@ -147,16 +147,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -164,37 +164,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return OnDependencyInjection(new Service(OnDependencyInjection(new Dependency(), null, Pure.DI.Lifetime.Transient)), null, Pure.DI.Lifetime.Transient); + return OnDependencyInjection(new Service(OnDependencyInjection(new Dependency(), null, Lifetime.Transient)), null, Lifetime.Transient); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -207,18 +207,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -259,25 +259,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -290,7 +290,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/arguments.md b/readme/arguments.md index 777c69da0..4cbdf2e83 100644 --- a/readme/arguments.md +++ b/readme/arguments.md @@ -96,28 +96,28 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; - private readonly int _argM04D27di_id; - private readonly string _argM04D27di_serviceName; + private readonly int _arg_id; + private readonly string _arg_serviceName; public Composition(int id, string serviceName) { - _rootM04D27di = this; + _root = this; if (ReferenceEquals(serviceName, null)) { throw new ArgumentNullException("serviceName"); } - _argM04D27di_id = id; - _argM04D27di_serviceName = serviceName; + _arg_id = id; + _arg_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _argM04D27di_id = baseComposition._argM04D27di_id; - _argM04D27di_serviceName = baseComposition._argM04D27di_serviceName; + _root = baseComposition._root; + _arg_id = baseComposition._arg_id; + _arg_serviceName = baseComposition._arg_serviceName; } public IService Root @@ -125,37 +125,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return new Service(_argM04D27di_serviceName, new Dependency(_argM04D27di_id)); + return new Service(_arg_serviceName, new Dependency(_arg_id)); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -168,18 +168,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -222,25 +222,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -253,7 +253,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/array.md b/readme/array.md index c45f2da91..e313146ce 100644 --- a/readme/array.md +++ b/readme/array.md @@ -107,16 +107,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -131,30 +131,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -167,18 +167,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -224,25 +224,25 @@ partial class Composition " ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -255,7 +255,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/async-disposable-scope.md b/readme/async-disposable-scope.md index 68a02be83..493dbfe80 100644 --- a/readme/async-disposable-scope.md +++ b/readme/async-disposable-scope.md @@ -136,24 +136,24 @@ classDiagram ```c# partial class Composition: IDisposable, IAsyncDisposable { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private object[] _disposablesM04D27di; - private int _disposeIndexM04D27di; - private Dependency _scopedM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private object[] _disposables; + private int _disposeIndex; + private Dependency _scoped36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); - _disposablesM04D27di = new object[1]; + _root = this; + _lock = new object(); + _disposables = new object[1]; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; - _disposablesM04D27di = new object[1]; + _root = baseComposition._root; + _lock = _root._lock; + _disposables = new object[1]; } public IService SessionRoot @@ -161,18 +161,18 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl((MethodImplOptions)0x100)] get { - if (_scopedM04D27di36_Dependency == null) + if (_scoped36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_scopedM04D27di36_Dependency == null) + if (_scoped36_Dependency == null) { - _scopedM04D27di36_Dependency = new Dependency(); - _disposablesM04D27di[_disposeIndexM04D27di++] = _scopedM04D27di36_Dependency; + _scoped36_Dependency = new Dependency(); + _disposables[_disposeIndex++] = _scoped36_Dependency; } } } - return new Service(_scopedM04D27di36_Dependency); + return new Service(_scoped36_Dependency); } } @@ -181,46 +181,46 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di43_Func = default(System.Func); - perResolveM04D27di43_Func = new Func( + var perResolve43_Func = default(Func); + perResolve43_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - Composition transientM04D27di2_Composition = this; - var value_M04D27di1 = new Session(transientM04D27di2_Composition); - return value_M04D27di1; + Composition transient2_Composition = this; + var value_1 = new Session(transient2_Composition); + return value_1; }); - return new Program(perResolveM04D27di43_Func); + return new Program(perResolve43_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -233,18 +233,18 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -258,13 +258,13 @@ partial class Composition: IDisposable, IAsyncDisposable { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _scopedM04D27di36_Dependency = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _scoped36_Dependency = null; } while (disposeIndex-- > 0) @@ -291,17 +291,17 @@ partial class Composition: IDisposable, IAsyncDisposable partial void OnDisposeException(T disposableInstance, Exception exception) where T : IDisposable; - public async Threading.Tasks.ValueTask DisposeAsync() + public async ValueTask DisposeAsync() { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _scopedM04D27di36_Dependency = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _scoped36_Dependency = null; } while (disposeIndex-- > 0) @@ -372,28 +372,28 @@ partial class Composition: IDisposable, IAsyncDisposable " FuncᐸSessionᐳ *-- Session : Session"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(Program), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(Program), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -406,7 +406,7 @@ partial class Composition: IDisposable, IAsyncDisposable } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -425,7 +425,7 @@ partial class Composition: IDisposable, IAsyncDisposable } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public Program Resolve(Composition composition) { diff --git a/readme/async-disposable-singleton.md b/readme/async-disposable-singleton.md index b3551b7e6..73462beaa 100644 --- a/readme/async-disposable-singleton.md +++ b/readme/async-disposable-singleton.md @@ -89,23 +89,23 @@ classDiagram ```c# partial class Composition: IDisposable, IAsyncDisposable { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private object[] _disposablesM04D27di; - private int _disposeIndexM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private object[] _disposables; + private int _disposeIndex; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); - _disposablesM04D27di = new object[1]; + _root = this; + _lock = new object(); + _disposables = new object[1]; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -113,49 +113,49 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; - _rootM04D27di._disposablesM04D27di[_rootM04D27di._disposeIndexM04D27di++] = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; + _root._disposables[_root._disposeIndex++] = _singleton36_Dependency; } } } - return new Service(_rootM04D27di._singletonM04D27di36_Dependency); + return new Service(_root._singleton36_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -168,18 +168,18 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -193,13 +193,13 @@ partial class Composition: IDisposable, IAsyncDisposable { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _singletonM04D27di36_Dependency = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _singleton36_Dependency = null; } while (disposeIndex-- > 0) @@ -226,17 +226,17 @@ partial class Composition: IDisposable, IAsyncDisposable partial void OnDisposeException(T disposableInstance, Exception exception) where T : IDisposable; - public async Threading.Tasks.ValueTask DisposeAsync() + public async ValueTask DisposeAsync() { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _singletonM04D27di36_Dependency = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _singleton36_Dependency = null; } while (disposeIndex-- > 0) @@ -294,25 +294,25 @@ partial class Composition: IDisposable, IAsyncDisposable " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -325,7 +325,7 @@ partial class Composition: IDisposable, IAsyncDisposable } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/async-enumerable.md b/readme/async-enumerable.md index 839f34100..3995ca57c 100644 --- a/readme/async-enumerable.md +++ b/readme/async-enumerable.md @@ -90,16 +90,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -108,43 +108,43 @@ partial class Composition get { [MethodImpl((MethodImplOptions)0x200)] - async System.Collections.Generic.IAsyncEnumerable LocaltransientM04D27di1_IAsyncEnumerable() + async IAsyncEnumerable Localtransient1_IAsyncEnumerable() { yield return new AbcDependency(); yield return new XyzDependency(); } - System.Collections.Generic.IAsyncEnumerable transientM04D27di1_IAsyncEnumerable = LocaltransientM04D27di1_IAsyncEnumerable(); - return new Service(transientM04D27di1_IAsyncEnumerable); + IAsyncEnumerable transient1_IAsyncEnumerable = Localtransient1_IAsyncEnumerable(); + return new Service(transient1_IAsyncEnumerable); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -157,18 +157,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -214,25 +214,25 @@ partial class Composition " IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -245,7 +245,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/auto-bindings.md b/readme/auto-bindings.md index 2a236135c..865311fff 100644 --- a/readme/auto-bindings.md +++ b/readme/auto-bindings.md @@ -51,16 +51,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public Service MyService diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index c80461b1b..7d1256348 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -106,20 +106,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Dependency _scopedM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Dependency _scoped36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } private Service SessionRoot @@ -127,17 +127,17 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_scopedM04D27di36_Dependency == null) + if (_scoped36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_scopedM04D27di36_Dependency == null) + if (_scoped36_Dependency == null) { - _scopedM04D27di36_Dependency = new Dependency(); + _scoped36_Dependency = new Dependency(); } } } - return new Service(_scopedM04D27di36_Dependency); + return new Service(_scoped36_Dependency); } } @@ -146,53 +146,53 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di43_Func = default(System.Func); - perResolveM04D27di43_Func = new Func( + var perResolve43_Func = default(Func); + perResolve43_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - Composition transientM04D27di2_Composition = this; - IService transientM04D27di1_IService; + Composition transient2_Composition = this; + IService transient1_IService; { - var baseComposition_M04D27di2 = transientM04D27di2_Composition; + var baseComposition_2 = transient2_Composition; // Creates a session - var session_M04D27di3 = new Composition(baseComposition_M04D27di2); - transientM04D27di1_IService = session_M04D27di3.SessionRoot; + var session_3 = new Composition(baseComposition_2); + transient1_IService = session_3.SessionRoot; } - var value_M04D27di1 = transientM04D27di1_IService; - return value_M04D27di1; + var value_1 = transient1_IService; + return value_1; }); - return new Program(perResolveM04D27di43_Func); + return new Program(perResolve43_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -205,18 +205,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -262,28 +262,28 @@ partial class Composition " FuncᐸIServiceᐳ *-- IService : IService"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(Service), valResolverM04D27di_0000) - ,new Pair>(typeof(Program), valResolverM04D27di_0001) + new Pair>(typeof(Service), valResolver_0000) + ,new Pair>(typeof(Program), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -296,7 +296,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public Service Resolve(Composition composition) { @@ -315,7 +315,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public Program Resolve(Composition composition) { diff --git a/readme/check-for-a-root.md b/readme/check-for-a-root.md index 5aabde20a..28e7f1311 100644 --- a/readme/check-for-a-root.md +++ b/readme/check-for-a-root.md @@ -99,16 +99,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -123,7 +123,7 @@ partial class Composition } } - private IDependency RootM04D27di0001 + private IDependency Root0001 { [MethodImpl((MethodImplOptions)0x100)] get @@ -135,30 +135,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -171,18 +171,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -224,32 +224,32 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; private static partial void OnNewRoot(IResolver resolver, string name, object? tag, Lifetime lifetime); static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - OnNewRoot(valResolverM04D27di_0000, "Root", null, Pure.DI.Lifetime.Transient); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - OnNewRoot(valResolverM04D27di_0001, "RootM04D27di0001", "MyDep", Pure.DI.Lifetime.Transient); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + OnNewRoot(valResolver_0000, "Root", null, Lifetime.Transient); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + OnNewRoot(valResolver_0001, "Root0001", "MyDep", Lifetime.Transient); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(IDependency), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(IDependency), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -262,7 +262,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -281,7 +281,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IDependency Resolve(Composition composition) { @@ -293,7 +293,7 @@ partial class Composition switch (tag) { case "MyDep": - return composition.RootM04D27di0001; + return composition.Root0001; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } diff --git a/readme/complex-generics.md b/readme/complex-generics.md index dc7fe2a1b..142887ddd 100644 --- a/readme/complex-generics.md +++ b/readme/complex-generics.md @@ -110,16 +110,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public Program Root @@ -127,37 +127,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return new Program(new Service, System.Collections.Generic.Dictionary>(new Dependency(), new DependencyStruct())); + return new Program(new Service, Dictionary>(new Dependency(), new DependencyStruct())); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -170,18 +170,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -232,25 +232,25 @@ partial class Composition " ServiceᐸStringˏInt32ˏListᐸStringᐳˏDictionaryᐸStringˏInt32ᐳᐳ *-- DependencyStructᐸInt32ᐳ : \"value type\" IDependencyᐸInt32ᐳ"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di>.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver>.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Program), valResolverM04D27di_0000) + new Pair>(typeof(Program), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -263,7 +263,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver> + private sealed class Resolver_0000: IResolver> { public Program Resolve(Composition composition) { diff --git a/readme/composition-root-kinds.md b/readme/composition-root-kinds.md index fcfa0cdc7..a524aa7bc 100644 --- a/readme/composition-root-kinds.md +++ b/readme/composition-root-kinds.md @@ -90,16 +90,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] @@ -126,30 +126,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -162,18 +162,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -220,28 +220,28 @@ partial class Composition " Composition ..> Dependency : IDependency Dependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(IDependency), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(IDependency), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -254,7 +254,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -275,7 +275,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IDependency Resolve(Composition composition) { diff --git a/readme/composition-roots-simplified.md b/readme/composition-roots-simplified.md index 5f67c1771..44383f29d 100644 --- a/readme/composition-roots-simplified.md +++ b/readme/composition-roots-simplified.md @@ -83,16 +83,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService MyRoot @@ -104,7 +104,7 @@ partial class Composition } } - private IService RootM04D27di0002 + private IService Root0002 { [MethodImpl((MethodImplOptions)0x100)] get @@ -116,30 +116,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -152,18 +152,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -208,25 +208,25 @@ partial class Composition " Composition ..> OtherService : IService _"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -239,7 +239,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -251,7 +251,7 @@ partial class Composition switch (tag) { case "Other": - return composition.RootM04D27di0002; + return composition.Root0002; case null: return composition.MyRoot; default: diff --git a/readme/composition-roots.md b/readme/composition-roots.md index eea756ab2..af0404daf 100644 --- a/readme/composition-roots.md +++ b/readme/composition-roots.md @@ -109,16 +109,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService MyRoot @@ -139,7 +139,7 @@ partial class Composition } } - private IDependency RootM04D27di0003 + private IDependency Root0003 { [MethodImpl((MethodImplOptions)0x100)] get @@ -151,30 +151,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -187,18 +187,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -245,28 +245,28 @@ partial class Composition " Composition ..> Dependency : IDependency _"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(IDependency), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(IDependency), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -279,7 +279,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -300,11 +300,11 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IDependency Resolve(Composition composition) { - return composition.RootM04D27di0003; + return composition.Root0003; } public IDependency ResolveByTag(Composition composition, object tag) @@ -312,7 +312,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D27di0003; + return composition.Root0003; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } diff --git a/readme/constructor-ordinal-attribute.md b/readme/constructor-ordinal-attribute.md index 7bd668ace..19ac8ea1d 100644 --- a/readme/constructor-ordinal-attribute.md +++ b/readme/constructor-ordinal-attribute.md @@ -74,25 +74,25 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; - private readonly string _argM04D27di_serviceName; + private readonly string _arg_serviceName; public Composition(string serviceName) { - _rootM04D27di = this; + _root = this; if (ReferenceEquals(serviceName, null)) { throw new ArgumentNullException("serviceName"); } - _argM04D27di_serviceName = serviceName; + _arg_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _argM04D27di_serviceName = baseComposition._argM04D27di_serviceName; + _root = baseComposition._root; + _arg_serviceName = baseComposition._arg_serviceName; } public IService Root @@ -100,37 +100,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return new Service(_argM04D27di_serviceName); + return new Service(_arg_serviceName); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -143,18 +143,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -218,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/custom-attributes.md b/readme/custom-attributes.md index 5b77e8689..f72fb2baa 100644 --- a/readme/custom-attributes.md +++ b/readme/custom-attributes.md @@ -90,20 +90,20 @@ classDiagram ```c# partial class PersonComposition { - private readonly PersonComposition _rootM04D27di; + private readonly PersonComposition _root; - private readonly int _argM04D27di_personId; + private readonly int _arg_personId; public PersonComposition(int personId) { - _rootM04D27di = this; - _argM04D27di_personId = personId; + _root = this; + _arg_personId = personId; } internal PersonComposition(PersonComposition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _argM04D27di_personId = baseComposition._argM04D27di_personId; + _root = baseComposition._root; + _arg_personId = baseComposition._arg_personId; } public IPerson Person @@ -111,40 +111,40 @@ partial class PersonComposition [MethodImpl((MethodImplOptions)0x100)] get { - string transientM04D27di1_String = "Nik"; - Person transientM04D27di0_Person = new Person(transientM04D27di1_String); - transientM04D27di0_Person.Id = _argM04D27di_personId; - return transientM04D27di0_Person; + string transient1_String = "Nik"; + Person transient0_Person = new Person(transient1_String); + transient0_Person.Id = _arg_personId; + return transient0_Person; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -157,18 +157,18 @@ partial class PersonComposition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -204,25 +204,25 @@ partial class PersonComposition " PersonComposition ..> Person : IPerson Person"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static PersonComposition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IPerson), valResolverM04D27di_0000) + new Pair>(typeof(IPerson), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(PersonComposition composite) { @@ -235,7 +235,7 @@ partial class PersonComposition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IPerson Resolve(PersonComposition composition) { diff --git a/readme/decorator.md b/readme/decorator.md index cd59cbefd..57ada1815 100644 --- a/readme/decorator.md +++ b/readme/decorator.md @@ -64,16 +64,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -88,30 +88,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -124,18 +124,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -171,25 +171,25 @@ partial class Composition " Composition ..> GreetingService : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -202,7 +202,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/default-lifetime.md b/readme/default-lifetime.md index a3abcb9d8..c813efbe2 100644 --- a/readme/default-lifetime.md +++ b/readme/default-lifetime.md @@ -77,21 +77,21 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Service _singletonM04D27di37_Service; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Service _singleton37_Service; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -99,53 +99,53 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di37_Service == null) + if (_root._singleton37_Service == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di37_Service == null) + if (_root._singleton37_Service == null) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } - _singletonM04D27di37_Service = new Service(_singletonM04D27di36_Dependency, _rootM04D27di._singletonM04D27di36_Dependency); - _rootM04D27di._singletonM04D27di37_Service = _singletonM04D27di37_Service; + _singleton37_Service = new Service(_singleton36_Dependency, _root._singleton36_Dependency); + _root._singleton37_Service = _singleton37_Service; } } } - return _rootM04D27di._singletonM04D27di37_Service; + return _root._singleton37_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -158,18 +158,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -209,25 +209,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -240,7 +240,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/default-values.md b/readme/default-values.md index 94bb91b47..337bac0a2 100644 --- a/readme/default-values.md +++ b/readme/default-values.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -100,30 +100,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -136,18 +136,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -218,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/dependent-compositions.md b/readme/dependent-compositions.md index 06a02b504..2060e50b3 100644 --- a/readme/dependent-compositions.md +++ b/readme/dependent-compositions.md @@ -90,16 +90,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -114,30 +114,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -150,18 +150,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -200,25 +200,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -231,7 +231,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -260,16 +260,16 @@ partial class Composition ```c# partial class OtherComposition { - private readonly OtherComposition _rootM04D27di; + private readonly OtherComposition _root; public OtherComposition() { - _rootM04D27di = this; + _root = this; } internal OtherComposition(OtherComposition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -293,30 +293,30 @@ partial class OtherComposition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -329,18 +329,18 @@ partial class OtherComposition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -385,28 +385,28 @@ partial class OtherComposition " OtherComposition ..> Program : Program Program"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static OtherComposition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(Program), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(Program), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(OtherComposition composite) { @@ -419,7 +419,7 @@ partial class OtherComposition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(OtherComposition composition) { @@ -438,7 +438,7 @@ partial class OtherComposition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public Program Resolve(OtherComposition composition) { diff --git a/readme/disposable-singleton.md b/readme/disposable-singleton.md index 116415d26..6312c887e 100644 --- a/readme/disposable-singleton.md +++ b/readme/disposable-singleton.md @@ -82,23 +82,23 @@ classDiagram ```c# partial class Composition: IDisposable { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private object[] _disposablesM04D27di; - private int _disposeIndexM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private object[] _disposables; + private int _disposeIndex; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); - _disposablesM04D27di = new object[1]; + _root = this; + _lock = new object(); + _disposables = new object[1]; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -106,49 +106,49 @@ partial class Composition: IDisposable [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; - _rootM04D27di._disposablesM04D27di[_rootM04D27di._disposeIndexM04D27di++] = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; + _root._disposables[_root._disposeIndex++] = _singleton36_Dependency; } } } - return new Service(_rootM04D27di._singletonM04D27di36_Dependency); + return new Service(_root._singleton36_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -161,18 +161,18 @@ partial class Composition: IDisposable [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -186,13 +186,13 @@ partial class Composition: IDisposable { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _singletonM04D27di36_Dependency = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _singleton36_Dependency = null; } while (disposeIndex-- > 0) @@ -245,25 +245,25 @@ partial class Composition: IDisposable " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -276,7 +276,7 @@ partial class Composition: IDisposable } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/enumerable-generics.md b/readme/enumerable-generics.md index f64dae83f..a9e1cb28b 100644 --- a/readme/enumerable-generics.md +++ b/readme/enumerable-generics.md @@ -111,16 +111,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService IntRoot @@ -129,13 +129,13 @@ partial class Composition get { [MethodImpl((MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM04D27di1_IEnumerable() + IEnumerable> LocalperBlock1_IEnumerable() { yield return new AbcDependency(); yield return new XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM04D27di1_IEnumerable = LocalperBlockM04D27di1_IEnumerable(); - return new Service(perBlockM04D27di1_IEnumerable); + IEnumerable> perBlock1_IEnumerable = LocalperBlock1_IEnumerable(); + return new Service(perBlock1_IEnumerable); } } @@ -145,43 +145,43 @@ partial class Composition get { [MethodImpl((MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM04D27di1_IEnumerable() + IEnumerable> LocalperBlock1_IEnumerable() { yield return new AbcDependency(); yield return new XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM04D27di1_IEnumerable = LocalperBlockM04D27di1_IEnumerable(); - return new Service(perBlockM04D27di1_IEnumerable); + IEnumerable> perBlock1_IEnumerable = LocalperBlock1_IEnumerable(); + return new Service(perBlock1_IEnumerable); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -194,18 +194,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -275,28 +275,28 @@ partial class Composition " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : \"Xyz\" IDependencyᐸStringᐳ"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di>.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di>.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver>.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver>.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -309,7 +309,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver> + private sealed class Resolver_0000: IResolver> { public IService Resolve(Composition composition) { @@ -328,7 +328,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver> + private sealed class Resolver_0001: IResolver> { public IService Resolve(Composition composition) { diff --git a/readme/enumerable.md b/readme/enumerable.md index bac279853..601c39c74 100644 --- a/readme/enumerable.md +++ b/readme/enumerable.md @@ -82,16 +82,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -100,43 +100,43 @@ partial class Composition get { [MethodImpl((MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable LocalperBlockM04D27di1_IEnumerable() + IEnumerable LocalperBlock1_IEnumerable() { yield return new AbcDependency(); yield return new XyzDependency(); } - System.Collections.Generic.IEnumerable perBlockM04D27di1_IEnumerable = LocalperBlockM04D27di1_IEnumerable(); - return new Service(perBlockM04D27di1_IEnumerable); + IEnumerable perBlock1_IEnumerable = LocalperBlock1_IEnumerable(); + return new Service(perBlock1_IEnumerable); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -149,18 +149,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -206,25 +206,25 @@ partial class Composition " IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -237,7 +237,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/factory.md b/readme/factory.md index 938740454..efaef43a7 100644 --- a/readme/factory.md +++ b/readme/factory.md @@ -85,16 +85,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -102,44 +102,44 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - System.DateTimeOffset transientM04D27di3_DateTimeOffset = DateTimeOffset.Now; - Dependency transientM04D27di1_Dependency; + DateTimeOffset transient3_DateTimeOffset = DateTimeOffset.Now; + Dependency transient1_Dependency; { - var dependency_M04D27di1 = new Dependency(transientM04D27di3_DateTimeOffset); - dependency_M04D27di1.Initialize(); - transientM04D27di1_Dependency = dependency_M04D27di1; + var dependency_1 = new Dependency(transient3_DateTimeOffset); + dependency_1.Initialize(); + transient1_Dependency = dependency_1; } - return new Service(transientM04D27di1_Dependency); + return new Service(transient1_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -152,18 +152,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -200,25 +200,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -231,7 +231,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/field-injection.md b/readme/field-injection.md index 2f792ffc5..3c11e9ee0 100644 --- a/readme/field-injection.md +++ b/readme/field-injection.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -90,39 +90,39 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Service transientM04D27di0_Service = new Service(); - transientM04D27di0_Service.DependencyVal = new Dependency(); - return transientM04D27di0_Service; + Service transient0_Service = new Service(); + transient0_Service.DependencyVal = new Dependency(); + return transient0_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -135,18 +135,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -186,25 +186,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -217,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/func-with-arguments.md b/readme/func-with-arguments.md index 657ec9117..71c003471 100644 --- a/readme/func-with-arguments.md +++ b/readme/func-with-arguments.md @@ -111,20 +111,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Clock _singletonM04D27di36_Clock; + private readonly Composition _root; + private readonly object _lock; + private Clock _singleton36_Clock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -132,54 +132,54 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - System.Func transientM04D27di1_Func = dependencyId => + Func transient1_Func = dependencyId => { - int transientM04D27di3_Int32 = dependencyId; - if (_rootM04D27di._singletonM04D27di36_Clock == null) + int transient3_Int32 = dependencyId; + if (_root._singleton36_Clock == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Clock == null) + if (_root._singleton36_Clock == null) { - _singletonM04D27di36_Clock = new Clock(); - _rootM04D27di._singletonM04D27di36_Clock = _singletonM04D27di36_Clock; + _singleton36_Clock = new Clock(); + _root._singleton36_Clock = _singleton36_Clock; } } } - var dependency_M04D27di1 = new Dependency(_rootM04D27di._singletonM04D27di36_Clock, transientM04D27di3_Int32); - return dependency_M04D27di1; + var dependency_1 = new Dependency(_root._singleton36_Clock, transient3_Int32); + return dependency_1; }; - return new Service(transientM04D27di1_Func); + return new Service(transient1_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -192,18 +192,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -250,25 +250,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -281,7 +281,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/func-with-tag.md b/readme/func-with-tag.md index fcad5033c..23b0692bf 100644 --- a/readme/func-with-tag.md +++ b/readme/func-with-tag.md @@ -75,19 +75,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -95,45 +95,45 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di39_Func = default(System.Func); - perResolveM04D27di39_Func = new Func( + var perResolve39_Func = default(Func); + perResolve39_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - var value_M04D27di1 = new Dependency(); - return value_M04D27di1; + var value_1 = new Dependency(); + return value_1; }); - return new Service(perResolveM04D27di39_Func); + return new Service(perResolve39_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -146,18 +146,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -198,25 +198,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : \"my tag\" IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -229,7 +229,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/func.md b/readme/func.md index 36c064eda..49512aa45 100644 --- a/readme/func.md +++ b/readme/func.md @@ -78,19 +78,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -98,45 +98,45 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di39_Func = default(System.Func); - perResolveM04D27di39_Func = new Func( + var perResolve39_Func = default(Func); + perResolve39_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - var value_M04D27di1 = new Dependency(); - return value_M04D27di1; + var value_1 = new Dependency(); + return value_1; }); - return new Service(perResolveM04D27di39_Func); + return new Service(perResolve39_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -149,18 +149,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -201,25 +201,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -232,7 +232,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/generic-composition-roots-with-constraints.md b/readme/generic-composition-roots-with-constraints.md index 3db063fc3..2bbafbcd0 100644 --- a/readme/generic-composition-roots-with-constraints.md +++ b/readme/generic-composition-roots-with-constraints.md @@ -95,21 +95,21 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] public IService GetMyRoot() - where T: System.IDisposable + where T: IDisposable where T4: struct { return new Service(new Dependency()); @@ -117,14 +117,14 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public IService GetOtherService() - where T: System.IDisposable + where T: IDisposable { - OtherService transientM04D27di0_OtherService; + OtherService transient0_OtherService; { - var dependency_M04D27di1 = new Dependency(); - transientM04D27di0_OtherService = new OtherService(dependency_M04D27di1); + var dependency_1 = new Dependency(); + transient0_OtherService = new OtherService(dependency_1); } - return transientM04D27di0_OtherService; + return transient0_OtherService; } public override string ToString() diff --git a/readme/generic-composition-roots.md b/readme/generic-composition-roots.md index ccb2f37e4..aed3ddae0 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 _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] @@ -110,12 +110,12 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public IService GetOtherService() { - OtherService transientM04D27di0_OtherService; + OtherService transient0_OtherService; { - var dependency_M04D27di1 = new Dependency(); - transientM04D27di0_OtherService = new OtherService(dependency_M04D27di1); + var dependency_1 = new Dependency(); + transient0_OtherService = new OtherService(dependency_1); } - return transientM04D27di0_OtherService; + return transient0_OtherService; } public override string ToString() diff --git a/readme/generics.md b/readme/generics.md index c96d79ced..5d786d3fd 100644 --- a/readme/generics.md +++ b/readme/generics.md @@ -96,16 +96,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -120,30 +120,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -156,18 +156,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -214,25 +214,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -245,7 +245,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/injection.md b/readme/injection.md index dfb3d69c0..bd83a68ca 100644 --- a/readme/injection.md +++ b/readme/injection.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -90,42 +90,42 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Service transientM04D27di0_Service; + Service transient0_Service; { - var dependency_M04D27di1 = new Dependency(); - transientM04D27di0_Service = new Service(dependency_M04D27di1); + var dependency_1 = new Dependency(); + transient0_Service = new Service(dependency_1); } - return transientM04D27di0_Service; + return transient0_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -138,18 +138,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -186,25 +186,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -217,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/injections-of-abstractions.md b/readme/injections-of-abstractions.md index 75abf5844..7b8394310 100644 --- a/readme/injections-of-abstractions.md +++ b/readme/injections-of-abstractions.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public Program Root diff --git a/readme/instance-initialization.md b/readme/instance-initialization.md index a72d7e87b..e56df1ae6 100644 --- a/readme/instance-initialization.md +++ b/readme/instance-initialization.md @@ -89,25 +89,25 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; - private readonly string _argM04D27di_serviceName; + private readonly string _arg_serviceName; public Composition(string serviceName) { - _rootM04D27di = this; + _root = this; if (ReferenceEquals(serviceName, null)) { throw new ArgumentNullException("serviceName"); } - _argM04D27di_serviceName = serviceName; + _arg_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _argM04D27di_serviceName = baseComposition._argM04D27di_serviceName; + _root = baseComposition._root; + _arg_serviceName = baseComposition._arg_serviceName; } public IService Root @@ -115,43 +115,43 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Service transientM04D27di0_Service; + Service transient0_Service; { - var service_M04D27di1 = new Service(_argM04D27di_serviceName, new Dependency()); - service_M04D27di1.Initialize(); - transientM04D27di0_Service = service_M04D27di1; + var service_1 = new Service(_arg_serviceName, new Dependency()); + service_1.Initialize(); + transient0_Service = service_1; } - return transientM04D27di0_Service; + return transient0_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -164,18 +164,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -212,25 +212,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -243,7 +243,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/interception.md b/readme/interception.md index 538766c91..a9df49872 100644 --- a/readme/interception.md +++ b/readme/interception.md @@ -83,16 +83,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -100,37 +100,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return OnDependencyInjection(new Service(), null, Pure.DI.Lifetime.Transient); + return OnDependencyInjection(new Service(), null, Lifetime.Transient); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -143,18 +143,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -218,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/keyed-service-provider.md b/readme/keyed-service-provider.md index 7c2b19215..197bc926d 100644 --- a/readme/keyed-service-provider.md +++ b/readme/keyed-service-provider.md @@ -84,89 +84,89 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } - private IDependency RootM04D27di0001 + private IDependency Root0001 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return _rootM04D27di._singletonM04D27di36_Dependency; + return _root._singleton36_Dependency; } } - private IService RootM04D27di0002 + private IService Root0002 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return new Service(_rootM04D27di._singletonM04D27di36_Dependency); + return new Service(_root._singleton36_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object GetService(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -179,18 +179,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object GetRequiredKeyedService(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -231,28 +231,28 @@ partial class Composition " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IDependency), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IDependency), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -265,7 +265,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IDependency Resolve(Composition composition) { @@ -277,14 +277,14 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.RootM04D27di0001; + return composition.Root0001; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IService Resolve(Composition composition) { @@ -296,7 +296,7 @@ partial class Composition switch (tag) { case "Service Key": - return composition.RootM04D27di0002; + return composition.Root0002; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IService."); } diff --git a/readme/lazy.md b/readme/lazy.md index 0c7f7c504..d2aedc24f 100644 --- a/readme/lazy.md +++ b/readme/lazy.md @@ -71,19 +71,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -91,50 +91,50 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di40_Func = default(System.Func); - perResolveM04D27di40_Func = new Func( + var perResolve40_Func = default(Func); + perResolve40_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - var value_M04D27di1 = new Dependency(); - return value_M04D27di1; + var value_1 = new Dependency(); + return value_1; }); - System.Lazy transientM04D27di1_Lazy; + Lazy transient1_Lazy; { - var factory_M04D27di2 = perResolveM04D27di40_Func; - transientM04D27di1_Lazy = new Lazy(factory_M04D27di2, true); + var factory_2 = perResolve40_Func; + transient1_Lazy = new Lazy(factory_2, true); } - return new Service(transientM04D27di1_Lazy); + return new Service(transient1_Lazy); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -147,18 +147,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -201,25 +201,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -232,7 +232,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index 21877a2d7..68b32611a 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -111,39 +111,39 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } [MethodImpl((MethodImplOptions)0x100)] - public IService GetRoot(System.Threading.CancellationToken cancellationToken) + public IService GetRoot(CancellationToken cancellationToken) { - var perResolveM04D27di42_Func = default(System.Func); - perResolveM04D27di42_Func = new Func( + var perResolve42_Func = default(Func); + perResolve42_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - var value_M04D27di1 = new Dependency(); - return value_M04D27di1; + var value_1 = new Dependency(); + return value_1; }); - System.Threading.Tasks.Task transientM04D27di1_Task; + Task transient1_Task; { - var factory_M04D27di2 = perResolveM04D27di42_Func; - var cancellationToken_M04D27di3 = cancellationToken; - transientM04D27di1_Task = new Task(factory_M04D27di2, cancellationToken_M04D27di3); + var factory_2 = perResolve42_Func; + var cancellationToken_3 = cancellationToken; + transient1_Task = new Task(factory_2, cancellationToken_3); } - return new Service(transientM04D27di1_Task); + return new Service(transient1_Task); } public override string ToString() @@ -151,7 +151,7 @@ partial class Composition return "classDiagram\n" + " class Composition {\n" + - " +IService GetRoot(System.Threading.CancellationToken cancellationToken)\n" + + " +IService GetRoot(CancellationToken cancellationToken)\n" + " }\n" + " class TaskFactory\n" + " class CancellationToken\n" + @@ -176,7 +176,7 @@ partial class Composition " TaskFactory *-- TaskContinuationOptions : TaskContinuationOptions\n" + " TaskFactory *-- TaskScheduler : TaskScheduler\n" + " Service *-- TaskᐸIDependencyᐳ : TaskᐸIDependencyᐳ\n" + - " Composition ..> Service : IService GetRoot(System.Threading.CancellationToken cancellationToken)\n" + + " Composition ..> Service : IService GetRoot(CancellationToken cancellationToken)\n" + " TaskᐸIDependencyᐳ o-- \"PerResolve\" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ\n" + " TaskᐸIDependencyᐳ o-- CancellationToken : Argument \"cancellationToken\"\n" + " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; diff --git a/readme/member-ordinal-attribute.md b/readme/member-ordinal-attribute.md index fc378ee61..18f923ddd 100644 --- a/readme/member-ordinal-attribute.md +++ b/readme/member-ordinal-attribute.md @@ -100,31 +100,31 @@ classDiagram ```c# partial class PersonComposition { - private readonly PersonComposition _rootM04D27di; + private readonly PersonComposition _root; - private readonly int _argM04D27di_personId; - private readonly string _argM04D27di_personName; - private readonly System.DateTime _argM04D27di_personBirthday; + private readonly int _arg_personId; + private readonly string _arg_personName; + private readonly DateTime _arg_personBirthday; - public PersonComposition(int personId, string personName, System.DateTime personBirthday) + public PersonComposition(int personId, string personName, DateTime personBirthday) { - _rootM04D27di = this; + _root = this; if (ReferenceEquals(personName, null)) { throw new ArgumentNullException("personName"); } - _argM04D27di_personId = personId; - _argM04D27di_personName = personName; - _argM04D27di_personBirthday = personBirthday; + _arg_personId = personId; + _arg_personName = personName; + _arg_personBirthday = personBirthday; } internal PersonComposition(PersonComposition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _argM04D27di_personId = baseComposition._argM04D27di_personId; - _argM04D27di_personName = baseComposition._argM04D27di_personName; - _argM04D27di_personBirthday = baseComposition._argM04D27di_personBirthday; + _root = baseComposition._root; + _arg_personId = baseComposition._arg_personId; + _arg_personName = baseComposition._arg_personName; + _arg_personBirthday = baseComposition._arg_personBirthday; } public IPerson Person @@ -132,41 +132,41 @@ partial class PersonComposition [MethodImpl((MethodImplOptions)0x100)] get { - Person transientM04D27di0_Person = new Person(); - transientM04D27di0_Person.Id = _argM04D27di_personId; - transientM04D27di0_Person.FirstName = _argM04D27di_personName; - transientM04D27di0_Person.Birthday = _argM04D27di_personBirthday; - return transientM04D27di0_Person; + Person transient0_Person = new Person(); + transient0_Person.Id = _arg_personId; + transient0_Person.FirstName = _arg_personName; + transient0_Person.Birthday = _arg_personBirthday; + return transient0_Person; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -179,18 +179,18 @@ partial class PersonComposition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -230,25 +230,25 @@ partial class PersonComposition " PersonComposition ..> Person : IPerson Person"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static PersonComposition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IPerson), valResolverM04D27di_0000) + new Pair>(typeof(IPerson), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(PersonComposition composite) { @@ -261,7 +261,7 @@ partial class PersonComposition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IPerson Resolve(PersonComposition composition) { diff --git a/readme/method-injection.md b/readme/method-injection.md index 2f4dc3423..18480cbaa 100644 --- a/readme/method-injection.md +++ b/readme/method-injection.md @@ -74,16 +74,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -91,39 +91,39 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Service transientM04D27di0_Service = new Service(); - transientM04D27di0_Service.SetDependency(new Dependency()); - return transientM04D27di0_Service; + Service transient0_Service = new Service(); + transient0_Service.SetDependency(new Dependency()); + return transient0_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -136,18 +136,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -218,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/multi-contract-bindings.md b/readme/multi-contract-bindings.md index b6cfc4d76..787d84025 100644 --- a/readme/multi-contract-bindings.md +++ b/readme/multi-contract-bindings.md @@ -74,16 +74,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -98,30 +98,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -134,18 +134,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -189,25 +189,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -220,7 +220,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/oncannotresolve-hint.md b/readme/oncannotresolve-hint.md index b0819797a..37ea52182 100644 --- a/readme/oncannotresolve-hint.md +++ b/readme/oncannotresolve-hint.md @@ -96,16 +96,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -113,38 +113,38 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - string transientM04D27di2_String = OnCannotResolve(null, Pure.DI.Lifetime.Transient); - return new Service(new Dependency(transientM04D27di2_String)); + string transient2_String = OnCannotResolve(null, Lifetime.Transient); + return new Service(new Dependency(transient2_String)); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -157,18 +157,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -211,25 +211,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -242,7 +242,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/ondependencyinjection-hint.md b/readme/ondependencyinjection-hint.md index d94e94e10..0efd3d9f8 100644 --- a/readme/ondependencyinjection-hint.md +++ b/readme/ondependencyinjection-hint.md @@ -93,16 +93,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -110,37 +110,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return new Service(OnDependencyInjection(new Dependency(), null, Pure.DI.Lifetime.Transient)); + return new Service(OnDependencyInjection(new Dependency(), null, Lifetime.Transient)); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -153,18 +153,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -205,25 +205,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -236,7 +236,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/onnewinstance-hint.md b/readme/onnewinstance-hint.md index ae71bc85f..ad3ced60c 100644 --- a/readme/onnewinstance-hint.md +++ b/readme/onnewinstance-hint.md @@ -95,20 +95,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -116,54 +116,54 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - Dependency _singletonM04D27di36_DependencyTemp; - _singletonM04D27di36_DependencyTemp = new Dependency(); - OnNewInstance(ref _singletonM04D27di36_DependencyTemp, null, Pure.DI.Lifetime.Singleton); - Threading.Thread.MemoryBarrier(); - _singletonM04D27di36_Dependency = _singletonM04D27di36_DependencyTemp; - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + Dependency _singleton36_DependencyTemp; + _singleton36_DependencyTemp = new Dependency(); + OnNewInstance(ref _singleton36_DependencyTemp, null, Lifetime.Singleton); + Thread.MemoryBarrier(); + _singleton36_Dependency = _singleton36_DependencyTemp; + _root._singleton36_Dependency = _singleton36_Dependency; } } } - Service transientM04D27di0_Service = new Service(_rootM04D27di._singletonM04D27di36_Dependency); - OnNewInstance(ref transientM04D27di0_Service, null, Pure.DI.Lifetime.Transient); - return transientM04D27di0_Service; + Service transient0_Service = new Service(_root._singleton36_Dependency); + OnNewInstance(ref transient0_Service, null, Lifetime.Transient); + return transient0_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -176,18 +176,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -228,25 +228,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -259,7 +259,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/overriding-the-bcl-binding.md b/readme/overriding-the-bcl-binding.md index 7a885c300..8a33559ed 100644 --- a/readme/overriding-the-bcl-binding.md +++ b/readme/overriding-the-bcl-binding.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -90,43 +90,43 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - IDependency[] transientM04D27di1_ = new IDependency[] + IDependency[] transient1_ = new IDependency[] { new AbcDependency(), new XyzDependency(), new AbcDependency() }; - return new Service(transientM04D27di1_); + return new Service(transient1_); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -139,18 +139,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -183,25 +183,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -214,7 +214,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/partial-class.md b/readme/partial-class.md index 96db35861..a2236f0a7 100644 --- a/readme/partial-class.md +++ b/readme/partial-class.md @@ -104,16 +104,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } internal Service Root @@ -121,40 +121,40 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - long transientM04D27di5_Int64 = GenerateId(); - long transientM04D27di4_Int64 = GenerateId(); - string transientM04D27di1_String = $"{_serviceName}_{GenerateId()}"; - return new Service(transientM04D27di1_String, new Dependency(transientM04D27di5_Int64), new Dependency(transientM04D27di4_Int64)); + long transient5_Int64 = GenerateId(); + long transient4_Int64 = GenerateId(); + string transient1_String = $"{_serviceName}_{GenerateId()}"; + return new Service(transient1_String, new Dependency(transient5_Int64), new Dependency(transient4_Int64)); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -167,18 +167,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -218,25 +218,25 @@ partial class Composition " Composition ..> Service : Service Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Service), valResolverM04D27di_0000) + new Pair>(typeof(Service), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -249,7 +249,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public Service Resolve(Composition composition) { diff --git a/readme/perblock.md b/readme/perblock.md index 430d66348..ae0ce5e42 100644 --- a/readme/perblock.md +++ b/readme/perblock.md @@ -85,19 +85,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public Service Root @@ -105,52 +105,52 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di43_Func = default(System.Func<(IDependency dep3, IDependency dep4)>); - perResolveM04D27di43_Func = new Func<(IDependency dep3, IDependency dep4)>( + var perResolve43_Func = default(Func<(IDependency dep3, IDependency dep4)>); + perResolve43_Func = new Func<(IDependency dep3, IDependency dep4)>( [MethodImpl((MethodImplOptions)768)] () => { - Dependency perBlockM04D27di4_Dependency = new Dependency(); - var value_M04D27di1 = (perBlockM04D27di4_Dependency, perBlockM04D27di4_Dependency); - return value_M04D27di1; + Dependency perBlock4_Dependency = new Dependency(); + var value_1 = (perBlock4_Dependency, perBlock4_Dependency); + return value_1; }); - System.Lazy<(IDependency dep3, IDependency dep4)> transientM04D27di2_Lazy; + Lazy<(IDependency dep3, IDependency dep4)> transient2_Lazy; { - var factory_M04D27di2 = perResolveM04D27di43_Func; - transientM04D27di2_Lazy = new Lazy<(IDependency dep3, IDependency dep4)>(factory_M04D27di2, true); + var factory_2 = perResolve43_Func; + transient2_Lazy = new Lazy<(IDependency dep3, IDependency dep4)>(factory_2, true); } - Dependency perBlockM04D27di1_Dependency = new Dependency(); - return new Service(perBlockM04D27di1_Dependency, perBlockM04D27di1_Dependency, transientM04D27di2_Lazy); + Dependency perBlock1_Dependency = new Dependency(); + return new Service(perBlock1_Dependency, perBlock1_Dependency, transient2_Lazy); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -163,18 +163,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -220,25 +220,25 @@ partial class Composition " FuncᐸValueTupleᐸIDependencyˏIDependencyᐳᐳ *-- ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Service), valResolverM04D27di_0000) + new Pair>(typeof(Service), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -251,7 +251,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public Service Resolve(Composition composition) { diff --git a/readme/perresolve.md b/readme/perresolve.md index ac8f48125..a2206d017 100644 --- a/readme/perresolve.md +++ b/readme/perresolve.md @@ -85,19 +85,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public Service Root @@ -105,71 +105,71 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di36_Dependency = default(Dependency); - var perResolveM04D27di43_Func = default(System.Func<(IDependency dep3, IDependency dep4)>); - perResolveM04D27di43_Func = new Func<(IDependency dep3, IDependency dep4)>( + var perResolve36_Dependency = default(Dependency); + var perResolve43_Func = default(Func<(IDependency dep3, IDependency dep4)>); + perResolve43_Func = new Func<(IDependency dep3, IDependency dep4)>( [MethodImpl((MethodImplOptions)768)] () => { - if (perResolveM04D27di36_Dependency == null) + if (perResolve36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (perResolveM04D27di36_Dependency == null) + if (perResolve36_Dependency == null) { - perResolveM04D27di36_Dependency = new Dependency(); + perResolve36_Dependency = new Dependency(); } } } - var value_M04D27di1 = (perResolveM04D27di36_Dependency, perResolveM04D27di36_Dependency); - return value_M04D27di1; + var value_1 = (perResolve36_Dependency, perResolve36_Dependency); + return value_1; }); - System.Lazy<(IDependency dep3, IDependency dep4)> transientM04D27di1_Lazy; + Lazy<(IDependency dep3, IDependency dep4)> transient1_Lazy; { - var factory_M04D27di2 = perResolveM04D27di43_Func; - transientM04D27di1_Lazy = new Lazy<(IDependency dep3, IDependency dep4)>(factory_M04D27di2, true); + var factory_2 = perResolve43_Func; + transient1_Lazy = new Lazy<(IDependency dep3, IDependency dep4)>(factory_2, true); } - if (perResolveM04D27di36_Dependency == null) + if (perResolve36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (perResolveM04D27di36_Dependency == null) + if (perResolve36_Dependency == null) { - perResolveM04D27di36_Dependency = new Dependency(); + perResolve36_Dependency = new Dependency(); } } } - return new Service(perResolveM04D27di36_Dependency, perResolveM04D27di36_Dependency, transientM04D27di1_Lazy); + return new Service(perResolve36_Dependency, perResolve36_Dependency, transient1_Lazy); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -182,18 +182,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -239,25 +239,25 @@ partial class Composition " FuncᐸValueTupleᐸIDependencyˏIDependencyᐳᐳ *-- ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Service), valResolverM04D27di_0000) + new Pair>(typeof(Service), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -270,7 +270,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public Service Resolve(Composition composition) { diff --git a/readme/property-injection.md b/readme/property-injection.md index e8194f03a..ce1ad0c1d 100644 --- a/readme/property-injection.md +++ b/readme/property-injection.md @@ -71,16 +71,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -88,39 +88,39 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Service transientM04D27di0_Service = new Service(); - transientM04D27di0_Service.Dependency = new Dependency(); - return transientM04D27di0_Service; + Service transient0_Service = new Service(); + transient0_Service.Dependency = new Dependency(); + return transient0_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -133,18 +133,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -184,25 +184,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -215,7 +215,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/required-properties-or-fields.md b/readme/required-properties-or-fields.md index 47f1df61b..3e9e8a13b 100644 --- a/readme/required-properties-or-fields.md +++ b/readme/required-properties-or-fields.md @@ -81,25 +81,25 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; - private readonly string _argM04D27di_name; + private readonly string _arg_name; public Composition(string name) { - _rootM04D27di = this; + _root = this; if (ReferenceEquals(name, null)) { throw new ArgumentNullException("name"); } - _argM04D27di_name = name; + _arg_name = name; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _argM04D27di_name = baseComposition._argM04D27di_name; + _root = baseComposition._root; + _arg_name = baseComposition._arg_name; } public IService Root @@ -109,7 +109,7 @@ partial class Composition { return new Service() { - ServiceNameField = _argM04D27di_name, + ServiceNameField = _arg_name, Dependency = new Dependency() }; } @@ -118,30 +118,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -154,18 +154,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -208,25 +208,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -239,7 +239,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/resolve-hint.md b/readme/resolve-hint.md index 93cebac49..3d64b2146 100644 --- a/readme/resolve-hint.md +++ b/readme/resolve-hint.md @@ -64,16 +64,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IDependency DependencyRoot diff --git a/readme/resolve-methods.md b/readme/resolve-methods.md index 84fcdcad9..576755a4f 100644 --- a/readme/resolve-methods.md +++ b/readme/resolve-methods.md @@ -88,16 +88,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService OtherService @@ -109,7 +109,7 @@ partial class Composition } } - private IDependency RootM04D27di0001 + private IDependency Root0001 { [MethodImpl((MethodImplOptions)0x100)] get @@ -118,7 +118,7 @@ partial class Composition } } - private IService RootM04D27di0002 + private IService Root0002 { [MethodImpl((MethodImplOptions)0x100)] get @@ -130,30 +130,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -166,18 +166,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -224,28 +224,28 @@ partial class Composition " Composition ..> OtherService : IService OtherService"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(IDependency), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(IDependency), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -258,11 +258,11 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { - return composition.RootM04D27di0002; + return composition.Root0002; } public IService ResolveByTag(Composition composition, object tag) @@ -272,18 +272,18 @@ partial class Composition case "Other": return composition.OtherService; case null: - return composition.RootM04D27di0002; + return composition.Root0002; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IService."); } } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IDependency Resolve(Composition composition) { - return composition.RootM04D27di0001; + return composition.Root0001; } public IDependency ResolveByTag(Composition composition, object tag) @@ -291,7 +291,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D27di0001; + return composition.Root0001; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } diff --git a/readme/root-arguments.md b/readme/root-arguments.md index 8a8591de0..45aafb0d6 100644 --- a/readme/root-arguments.md +++ b/readme/root-arguments.md @@ -104,16 +104,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } [MethodImpl((MethodImplOptions)0x100)] diff --git a/readme/rootbind.md b/readme/rootbind.md index e61598b50..b408da91b 100644 --- a/readme/rootbind.md +++ b/readme/rootbind.md @@ -46,16 +46,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -70,30 +70,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -106,18 +106,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -148,25 +148,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -179,7 +179,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/scope.md b/readme/scope.md index fa4d1def4..cafeb3f6b 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -129,24 +129,24 @@ classDiagram ```c# partial class Composition: IDisposable { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private object[] _disposablesM04D27di; - private int _disposeIndexM04D27di; - private Dependency _scopedM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private object[] _disposables; + private int _disposeIndex; + private Dependency _scoped36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); - _disposablesM04D27di = new object[1]; + _root = this; + _lock = new object(); + _disposables = new object[1]; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; - _disposablesM04D27di = new object[1]; + _root = baseComposition._root; + _lock = _root._lock; + _disposables = new object[1]; } public IService SessionRoot @@ -154,18 +154,18 @@ partial class Composition: IDisposable [MethodImpl((MethodImplOptions)0x100)] get { - if (_scopedM04D27di36_Dependency == null) + if (_scoped36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_scopedM04D27di36_Dependency == null) + if (_scoped36_Dependency == null) { - _scopedM04D27di36_Dependency = new Dependency(); - _disposablesM04D27di[_disposeIndexM04D27di++] = _scopedM04D27di36_Dependency; + _scoped36_Dependency = new Dependency(); + _disposables[_disposeIndex++] = _scoped36_Dependency; } } } - return new Service(_scopedM04D27di36_Dependency); + return new Service(_scoped36_Dependency); } } @@ -174,46 +174,46 @@ partial class Composition: IDisposable [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di43_Func = default(System.Func); - perResolveM04D27di43_Func = new Func( + var perResolve43_Func = default(Func); + perResolve43_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - Composition transientM04D27di2_Composition = this; - var value_M04D27di1 = new Session(transientM04D27di2_Composition); - return value_M04D27di1; + Composition transient2_Composition = this; + var value_1 = new Session(transient2_Composition); + return value_1; }); - return new Program(perResolveM04D27di43_Func); + return new Program(perResolve43_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -226,18 +226,18 @@ partial class Composition: IDisposable [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -251,13 +251,13 @@ partial class Composition: IDisposable { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _scopedM04D27di36_Dependency = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _scoped36_Dependency = null; } while (disposeIndex-- > 0) @@ -323,28 +323,28 @@ partial class Composition: IDisposable " FuncᐸSessionᐳ *-- Session : Session"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IService), valResolverM04D27di_0000) - ,new Pair>(typeof(Program), valResolverM04D27di_0001) + new Pair>(typeof(IService), valResolver_0000) + ,new Pair>(typeof(Program), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -357,7 +357,7 @@ partial class Composition: IDisposable } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { @@ -376,7 +376,7 @@ partial class Composition: IDisposable } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public Program Resolve(Composition composition) { diff --git a/readme/service-collection.md b/readme/service-collection.md index feeeeb216..bd04dd73f 100644 --- a/readme/service-collection.md +++ b/readme/service-collection.md @@ -81,89 +81,89 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } - private IDependency RootM04D27di0001 + private IDependency Root0001 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return _rootM04D27di._singletonM04D27di36_Dependency; + return _root._singleton36_Dependency; } } - private IService RootM04D27di0002 + private IService Root0002 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return new Service(_rootM04D27di._singletonM04D27di36_Dependency); + return new Service(_root._singleton36_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -176,18 +176,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -228,30 +228,30 @@ partial class Composition " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - OnNewRoot(valResolverM04D27di_0000, "RootM04D27di0001", "Dependency Key", Pure.DI.Lifetime.Singleton); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - OnNewRoot(valResolverM04D27di_0001, "RootM04D27di0002", null, Pure.DI.Lifetime.Transient); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + OnNewRoot(valResolver_0000, "Root0001", "Dependency Key", Lifetime.Singleton); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + OnNewRoot(valResolver_0001, "Root0002", null, Lifetime.Transient); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IDependency), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IDependency), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -264,7 +264,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IDependency Resolve(Composition composition) { @@ -276,18 +276,18 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.RootM04D27di0001; + return composition.Root0001; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IService Resolve(Composition composition) { - return composition.RootM04D27di0002; + return composition.Root0002; } public IService ResolveByTag(Composition composition, object tag) @@ -295,7 +295,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D27di0002; + return composition.Root0002; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IService."); } diff --git a/readme/service-provider-with-scope.md b/readme/service-provider-with-scope.md index 62af325b3..dc5023625 100644 --- a/readme/service-provider-with-scope.md +++ b/readme/service-provider-with-scope.md @@ -110,99 +110,99 @@ classDiagram ```c# partial class Composition: IDisposable { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private object[] _disposablesM04D27di; - private int _disposeIndexM04D27di; - private Dependency _singletonM04D27di36_Dependency; - private Service _scopedM04D27di37_Service; + private readonly Composition _root; + private readonly object _lock; + private object[] _disposables; + private int _disposeIndex; + private Dependency _singleton36_Dependency; + private Service _scoped37_Service; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); - _disposablesM04D27di = new object[1]; + _root = this; + _lock = new object(); + _disposables = new object[1]; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; - _disposablesM04D27di = new object[1]; + _root = baseComposition._root; + _lock = _root._lock; + _disposables = new object[1]; } - private IDependency RootM04D27di0001 + private IDependency Root0001 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return _rootM04D27di._singletonM04D27di36_Dependency; + return _root._singleton36_Dependency; } } - private IService RootM04D27di0002 + private IService Root0002 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_scopedM04D27di37_Service == null) + if (_scoped37_Service == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_scopedM04D27di37_Service == null) + if (_scoped37_Service == null) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } - _scopedM04D27di37_Service = new Service(_rootM04D27di._singletonM04D27di36_Dependency); - _disposablesM04D27di[_disposeIndexM04D27di++] = _scopedM04D27di37_Service; + _scoped37_Service = new Service(_root._singleton36_Dependency); + _disposables[_disposeIndex++] = _scoped37_Service; } } } - return _scopedM04D27di37_Service; + return _scoped37_Service; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object GetService(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -215,18 +215,18 @@ partial class Composition: IDisposable [MethodImpl((MethodImplOptions)0x100)] public object GetRequiredKeyedService(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -240,14 +240,14 @@ partial class Composition: IDisposable { int disposeIndex; object[] disposables; - lock (_lockM04D27di) + lock (_lock) { - disposeIndex = _disposeIndexM04D27di; - _disposeIndexM04D27di = 0; - disposables = _disposablesM04D27di; - _disposablesM04D27di = new object[1]; - _singletonM04D27di36_Dependency = null; - _scopedM04D27di37_Service = null; + disposeIndex = _disposeIndex; + _disposeIndex = 0; + disposables = _disposables; + _disposables = new object[1]; + _singleton36_Dependency = null; + _scoped37_Service = null; } while (disposeIndex-- > 0) @@ -302,28 +302,28 @@ partial class Composition: IDisposable " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IDependency), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IDependency), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -336,11 +336,11 @@ partial class Composition: IDisposable } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IDependency Resolve(Composition composition) { - return composition.RootM04D27di0001; + return composition.Root0001; } public IDependency ResolveByTag(Composition composition, object tag) @@ -348,18 +348,18 @@ partial class Composition: IDisposable switch (tag) { case null: - return composition.RootM04D27di0001; + return composition.Root0001; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IService Resolve(Composition composition) { - return composition.RootM04D27di0002; + return composition.Root0002; } public IService ResolveByTag(Composition composition, object tag) @@ -367,7 +367,7 @@ partial class Composition: IDisposable switch (tag) { case null: - return composition.RootM04D27di0002; + return composition.Root0002; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IService."); } diff --git a/readme/service-provider.md b/readme/service-provider.md index df1e1c095..32ba8e89d 100644 --- a/readme/service-provider.md +++ b/readme/service-provider.md @@ -79,89 +79,89 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } - private IDependency RootM04D27di0001 + private IDependency Root0001 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return _rootM04D27di._singletonM04D27di36_Dependency; + return _root._singleton36_Dependency; } } - private IService RootM04D27di0002 + private IService Root0002 { [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return new Service(_rootM04D27di._singletonM04D27di36_Dependency); + return new Service(_root._singleton36_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object GetService(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -174,18 +174,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -226,28 +226,28 @@ partial class Composition " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IDependency), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IDependency), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -260,11 +260,11 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IDependency Resolve(Composition composition) { - return composition.RootM04D27di0001; + return composition.Root0001; } public IDependency ResolveByTag(Composition composition, object tag) @@ -272,18 +272,18 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D27di0001; + return composition.Root0001; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IDependency."); } } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IService Resolve(Composition composition) { - return composition.RootM04D27di0002; + return composition.Root0002; } public IService ResolveByTag(Composition composition, object tag) @@ -291,7 +291,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D27di0002; + return composition.Root0002; default: throw new InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type IService."); } diff --git a/readme/simplified-binding.md b/readme/simplified-binding.md index abee7e551..3f4dc685a 100644 --- a/readme/simplified-binding.md +++ b/readme/simplified-binding.md @@ -88,16 +88,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public Service MyService @@ -105,8 +105,8 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Dependency perBlockM04D27di1_Dependency = new Dependency(); - return new Service(perBlockM04D27di1_Dependency, perBlockM04D27di1_Dependency, perBlockM04D27di1_Dependency); + Dependency perBlock1_Dependency = new Dependency(); + return new Service(perBlock1_Dependency, perBlock1_Dependency, perBlock1_Dependency); } } diff --git a/readme/singleton.md b/readme/singleton.md index 100b33951..880a972cf 100644 --- a/readme/singleton.md +++ b/readme/singleton.md @@ -76,20 +76,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private Dependency _singletonM04D27di36_Dependency; + private readonly Composition _root; + private readonly object _lock; + private Dependency _singleton36_Dependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IService Root @@ -97,48 +97,48 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di36_Dependency == null) + if (_root._singleton36_Dependency == null) { - _singletonM04D27di36_Dependency = new Dependency(); - _rootM04D27di._singletonM04D27di36_Dependency = _singletonM04D27di36_Dependency; + _singleton36_Dependency = new Dependency(); + _root._singleton36_Dependency = _singleton36_Dependency; } } } - return new Service(_singletonM04D27di36_Dependency, _rootM04D27di._singletonM04D27di36_Dependency); + return new Service(_singleton36_Dependency, _root._singleton36_Dependency); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -151,18 +151,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -202,25 +202,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -233,7 +233,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/span-and-readonlyspan.md b/readme/span-and-readonlyspan.md index 40ccb450a..77763b268 100644 --- a/readme/span-and-readonlyspan.md +++ b/readme/span-and-readonlyspan.md @@ -81,16 +81,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -98,43 +98,43 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - System.ReadOnlySpan transientM04D27di1_ReadOnlySpan = stackalloc Dependency[3] + ReadOnlySpan transient1_ReadOnlySpan = stackalloc Dependency[3] { new Dependency(), new Dependency(), new Dependency() }; - return new Service(transientM04D27di1_ReadOnlySpan); + return new Service(transient1_ReadOnlySpan); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -147,18 +147,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -197,25 +197,25 @@ partial class Composition " ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'c' Dependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -228,7 +228,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/tag-attribute.md b/readme/tag-attribute.md index 00600b0c1..ffcb20d41 100644 --- a/readme/tag-attribute.md +++ b/readme/tag-attribute.md @@ -89,16 +89,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -113,30 +113,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -149,18 +149,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -204,25 +204,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -235,7 +235,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/tag-type.md b/readme/tag-type.md index 87025dec3..6164a4637 100644 --- a/readme/tag-type.md +++ b/readme/tag-type.md @@ -101,20 +101,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private XyzDependency _singletonM04D27di37_XyzDependency; + private readonly Composition _root; + private readonly object _lock; + private XyzDependency _singleton37_XyzDependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IDependency XyzRoot @@ -122,18 +122,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - _singletonM04D27di37_XyzDependency = new XyzDependency(); - _rootM04D27di._singletonM04D27di37_XyzDependency = _singletonM04D27di37_XyzDependency; + _singleton37_XyzDependency = new XyzDependency(); + _root._singleton37_XyzDependency = _singleton37_XyzDependency; } } } - return _rootM04D27di._singletonM04D27di37_XyzDependency; + return _root._singleton37_XyzDependency; } } @@ -142,48 +142,48 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - _singletonM04D27di37_XyzDependency = new XyzDependency(); - _rootM04D27di._singletonM04D27di37_XyzDependency = _singletonM04D27di37_XyzDependency; + _singleton37_XyzDependency = new XyzDependency(); + _root._singleton37_XyzDependency = _singleton37_XyzDependency; } } } - return new Service(new AbcDependency(), _rootM04D27di._singletonM04D27di37_XyzDependency, new AbcDependency()); + return new Service(new AbcDependency(), _root._singleton37_XyzDependency, new AbcDependency()); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -196,18 +196,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -255,28 +255,28 @@ partial class Composition " Composition ..> XyzDependency : IDependency XyzRoot"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IDependency), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IDependency), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -289,7 +289,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IDependency Resolve(Composition composition) { @@ -307,7 +307,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/tag-unique.md b/readme/tag-unique.md index 8cc759752..e59d10e8a 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -80,16 +80,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -98,43 +98,43 @@ partial class Composition get { [MethodImpl((MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM04D27di1_IEnumerable() + IEnumerable> LocalperBlock1_IEnumerable() { yield return new AbcDependency(); yield return new XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM04D27di1_IEnumerable = LocalperBlockM04D27di1_IEnumerable(); - return new Service(perBlockM04D27di1_IEnumerable); + IEnumerable> perBlock1_IEnumerable = LocalperBlock1_IEnumerable(); + return new Service(perBlock1_IEnumerable); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -147,18 +147,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -204,25 +204,25 @@ partial class Composition " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : Unique tag 2 IDependencyᐸStringᐳ"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di>.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver>.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -235,7 +235,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver> + private sealed class Resolver_0000: IResolver> { public IService Resolve(Composition composition) { diff --git a/readme/tags.md b/readme/tags.md index 1dbae50b4..6a98a2536 100644 --- a/readme/tags.md +++ b/readme/tags.md @@ -105,20 +105,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; - private XyzDependency _singletonM04D27di37_XyzDependency; + private readonly Composition _root; + private readonly object _lock; + private XyzDependency _singleton37_XyzDependency; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public IDependency XyzRoot @@ -126,18 +126,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - _singletonM04D27di37_XyzDependency = new XyzDependency(); - _rootM04D27di._singletonM04D27di37_XyzDependency = _singletonM04D27di37_XyzDependency; + _singleton37_XyzDependency = new XyzDependency(); + _root._singleton37_XyzDependency = _singleton37_XyzDependency; } } } - return _rootM04D27di._singletonM04D27di37_XyzDependency; + return _root._singleton37_XyzDependency; } } @@ -146,48 +146,48 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - lock (_lockM04D27di) + lock (_lock) { - if (_rootM04D27di._singletonM04D27di37_XyzDependency == null) + if (_root._singleton37_XyzDependency == null) { - _singletonM04D27di37_XyzDependency = new XyzDependency(); - _rootM04D27di._singletonM04D27di37_XyzDependency = _singletonM04D27di37_XyzDependency; + _singleton37_XyzDependency = new XyzDependency(); + _root._singleton37_XyzDependency = _singleton37_XyzDependency; } } } - return new Service(new AbcDependency(), _rootM04D27di._singletonM04D27di37_XyzDependency, new AbcDependency()); + return new Service(new AbcDependency(), _root._singleton37_XyzDependency, new AbcDependency()); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -200,18 +200,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -259,28 +259,28 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - var valResolverM04D27di_0001 = new ResolverM04D27di_0001(); - ResolverM04D27di.Value = valResolverM04D27di_0001; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + var valResolver_0001 = new Resolver_0001(); + Resolver.Value = valResolver_0001; + _buckets = Buckets>.Create( 4, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[2] { - new Pair>(typeof(IDependency), valResolverM04D27di_0000) - ,new Pair>(typeof(IService), valResolverM04D27di_0001) + new Pair>(typeof(IDependency), valResolver_0000) + ,new Pair>(typeof(IService), valResolver_0001) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -293,7 +293,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IDependency Resolve(Composition composition) { @@ -312,7 +312,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0001: IResolver + private sealed class Resolver_0001: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/task.md b/readme/task.md index 3525d7e34..1874de59a 100644 --- a/readme/task.md +++ b/readme/task.md @@ -110,50 +110,50 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } [MethodImpl((MethodImplOptions)0x100)] - public IService GetRoot(System.Threading.CancellationToken cancellationToken) + public IService GetRoot(CancellationToken cancellationToken) { - var perResolveM04D27di42_Func = default(System.Func); - System.Threading.Tasks.TaskScheduler transientM04D27di5_TaskScheduler = TaskScheduler.Current; - System.Threading.Tasks.TaskContinuationOptions transientM04D27di4_TaskContinuationOptions = Threading.Tasks.TaskContinuationOptions.None; - System.Threading.Tasks.TaskCreationOptions transientM04D27di3_TaskCreationOptions = Threading.Tasks.TaskCreationOptions.None; - System.Threading.Tasks.TaskFactory perBlockM04D27di2_TaskFactory; + var perResolve42_Func = default(Func); + TaskScheduler transient5_TaskScheduler = TaskScheduler.Current; + TaskContinuationOptions transient4_TaskContinuationOptions = TaskContinuationOptions.None; + TaskCreationOptions transient3_TaskCreationOptions = TaskCreationOptions.None; + TaskFactory perBlock2_TaskFactory; { - var cancellationToken_M04D27di1 = cancellationToken; - var taskCreationOptions_M04D27di2 = transientM04D27di3_TaskCreationOptions; - var taskContinuationOptions_M04D27di3 = transientM04D27di4_TaskContinuationOptions; - var taskScheduler_M04D27di4 = transientM04D27di5_TaskScheduler; - perBlockM04D27di2_TaskFactory = new Threading.Tasks.TaskFactory(cancellationToken_M04D27di1, taskCreationOptions_M04D27di2, taskContinuationOptions_M04D27di3, taskScheduler_M04D27di4); + var cancellationToken_1 = cancellationToken; + var taskCreationOptions_2 = transient3_TaskCreationOptions; + var taskContinuationOptions_3 = transient4_TaskContinuationOptions; + var taskScheduler_4 = transient5_TaskScheduler; + perBlock2_TaskFactory = new TaskFactory(cancellationToken_1, taskCreationOptions_2, taskContinuationOptions_3, taskScheduler_4); } - perResolveM04D27di42_Func = new Func( + perResolve42_Func = new Func( [MethodImpl((MethodImplOptions)768)] () => { - var value_M04D27di5 = new Dependency(); - return value_M04D27di5; + var value_5 = new Dependency(); + return value_5; }); - System.Threading.Tasks.Task transientM04D27di1_Task; + Task transient1_Task; { - var factory_M04D27di6 = perResolveM04D27di42_Func; - var taskFactory_M04D27di7 = perBlockM04D27di2_TaskFactory; - transientM04D27di1_Task = taskFactory_M04D27di7.StartNew(factory_M04D27di6); + var factory_6 = perResolve42_Func; + var taskFactory_7 = perBlock2_TaskFactory; + transient1_Task = taskFactory_7.StartNew(factory_6); } - return new Service(transientM04D27di1_Task); + return new Service(transient1_Task); } public override string ToString() @@ -161,7 +161,7 @@ partial class Composition return "classDiagram\n" + " class Composition {\n" + - " +IService GetRoot(System.Threading.CancellationToken cancellationToken)\n" + + " +IService GetRoot(CancellationToken cancellationToken)\n" + " }\n" + " class TaskCreationOptions\n" + " class TaskContinuationOptions\n" + @@ -190,7 +190,7 @@ partial class Composition " TaskFactory *-- TaskContinuationOptions : TaskContinuationOptions\n" + " TaskFactory *-- TaskScheduler : TaskScheduler\n" + " Service *-- TaskᐸIDependencyᐳ : TaskᐸIDependencyᐳ\n" + - " Composition ..> Service : IService GetRoot(System.Threading.CancellationToken cancellationToken)\n" + + " Composition ..> Service : IService GetRoot(CancellationToken cancellationToken)\n" + " TaskᐸIDependencyᐳ o-- \"PerResolve\" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ\n" + " TaskᐸIDependencyᐳ o-- \"PerBlock\" TaskFactoryᐸIDependencyᐳ : TaskFactoryᐸIDependencyᐳ\n" + " FuncᐸIDependencyᐳ *-- Dependency : IDependency\n" + diff --git a/readme/threadsafe-hint.md b/readme/threadsafe-hint.md index 279eb3fa8..5f6b37ca4 100644 --- a/readme/threadsafe-hint.md +++ b/readme/threadsafe-hint.md @@ -65,16 +65,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -89,30 +89,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -125,18 +125,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -175,25 +175,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -206,7 +206,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/tostring-hint.md b/readme/tostring-hint.md index a119f418c..65dd1c4bf 100644 --- a/readme/tostring-hint.md +++ b/readme/tostring-hint.md @@ -63,16 +63,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService MyService @@ -87,30 +87,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -123,18 +123,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -173,25 +173,25 @@ partial class Composition " Composition ..> Service : IService MyService"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -204,7 +204,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/tracking-async-disposable-instances-in-delegates.md b/readme/tracking-async-disposable-instances-in-delegates.md index 9b2ffc3a0..007470cca 100644 --- a/readme/tracking-async-disposable-instances-in-delegates.md +++ b/readme/tracking-async-disposable-instances-in-delegates.md @@ -117,19 +117,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public Service Root @@ -137,61 +137,61 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di39_Func = default(System.Func>); - perResolveM04D27di39_Func = new Func>( + var perResolve39_Func = default(Func>); + perResolve39_Func = new Func>( [MethodImpl((MethodImplOptions)768)] () => { - var accumulatorM04D27di38 = new Pure.DI.Owned(); - Dependency transientM04D27di3_Dependency = new Dependency(); - lock (_lockM04D27di) + var accumulator38 = new Owned(); + Dependency transient3_Dependency = new Dependency(); + lock (_lock) { - accumulatorM04D27di38.Add(transientM04D27di3_Dependency); + accumulator38.Add(transient3_Dependency); } - Pure.DI.Owned perBlockM04D27di1_Owned; + Owned perBlock1_Owned; { - var owned_M04D27di2 = accumulatorM04D27di38; - var value_M04D27di3 = transientM04D27di3_Dependency; - perBlockM04D27di1_Owned = new Owned(value_M04D27di3, owned_M04D27di2); + var owned_2 = accumulator38; + var value_3 = transient3_Dependency; + perBlock1_Owned = new Owned(value_3, owned_2); } - lock (_lockM04D27di) + lock (_lock) { - accumulatorM04D27di38.Add(perBlockM04D27di1_Owned); + accumulator38.Add(perBlock1_Owned); } - var value_M04D27di1 = perBlockM04D27di1_Owned; - return value_M04D27di1; + var value_1 = perBlock1_Owned; + return value_1; }); - return new Service(perResolveM04D27di39_Func); + return new Service(perResolve39_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -204,18 +204,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -264,25 +264,25 @@ partial class Composition " OwnedᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Service), valResolverM04D27di_0000) + new Pair>(typeof(Service), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -295,7 +295,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public Service Resolve(Composition composition) { diff --git a/readme/tracking-async-disposable-instances-per-a-composition-root.md b/readme/tracking-async-disposable-instances-per-a-composition-root.md index d0fa2e10f..32994c799 100644 --- a/readme/tracking-async-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-async-disposable-instances-per-a-composition-root.md @@ -107,56 +107,56 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } - public Pure.DI.Owned Root + public Owned Root { [MethodImpl((MethodImplOptions)0x100)] get { - var accumulatorM04D27di38 = new Pure.DI.Owned(); - Dependency transientM04D27di3_Dependency = new Dependency(); - lock (_lockM04D27di) + var accumulator38 = new Owned(); + Dependency transient3_Dependency = new Dependency(); + lock (_lock) { - accumulatorM04D27di38.Add(transientM04D27di3_Dependency); + accumulator38.Add(transient3_Dependency); } - Pure.DI.Owned perBlockM04D27di0_Owned; + Owned perBlock0_Owned; { - var owned_M04D27di1 = accumulatorM04D27di38; - var value_M04D27di2 = new Service(transientM04D27di3_Dependency); - perBlockM04D27di0_Owned = new Owned(value_M04D27di2, owned_M04D27di1); + var owned_1 = accumulator38; + var value_2 = new Service(transient3_Dependency); + perBlock0_Owned = new Owned(value_2, owned_1); } - lock (_lockM04D27di) + lock (_lock) { - accumulatorM04D27di38.Add(perBlockM04D27di0_Owned); + accumulator38.Add(perBlock0_Owned); } - return perBlockM04D27di0_Owned; + return perBlock0_Owned; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] @@ -207,9 +207,9 @@ partial class Composition " OwnedᐸIServiceᐳ *-- Service : IService"; } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index 197b22e1d..ef1f1a2c5 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -106,19 +106,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } public Service Root @@ -126,61 +126,61 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - var perResolveM04D27di39_Func = default(System.Func>); - perResolveM04D27di39_Func = new Func>( + var perResolve39_Func = default(Func>); + perResolve39_Func = new Func>( [MethodImpl((MethodImplOptions)768)] () => { - var accumulatorM04D27di38 = new Pure.DI.Owned(); - Dependency transientM04D27di3_Dependency = new Dependency(); - lock (_lockM04D27di) + var accumulator38 = new Owned(); + Dependency transient3_Dependency = new Dependency(); + lock (_lock) { - accumulatorM04D27di38.Add(transientM04D27di3_Dependency); + accumulator38.Add(transient3_Dependency); } - Pure.DI.Owned perBlockM04D27di1_Owned; + Owned perBlock1_Owned; { - var owned_M04D27di2 = accumulatorM04D27di38; - var value_M04D27di3 = transientM04D27di3_Dependency; - perBlockM04D27di1_Owned = new Owned(value_M04D27di3, owned_M04D27di2); + var owned_2 = accumulator38; + var value_3 = transient3_Dependency; + perBlock1_Owned = new Owned(value_3, owned_2); } - lock (_lockM04D27di) + lock (_lock) { - accumulatorM04D27di38.Add(perBlockM04D27di1_Owned); + accumulator38.Add(perBlock1_Owned); } - var value_M04D27di1 = perBlockM04D27di1_Owned; - return value_M04D27di1; + var value_1 = perBlock1_Owned; + return value_1; }); - return new Service(perResolveM04D27di39_Func); + return new Service(perResolve39_Func); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -193,18 +193,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -249,25 +249,25 @@ partial class Composition " OwnedᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(Service), valResolverM04D27di_0000) + new Pair>(typeof(Service), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -280,7 +280,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public 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 05f42bbeb..d93a48695 100644 --- a/readme/tracking-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-disposable-instances-per-a-composition-root.md @@ -99,56 +99,56 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; - private readonly object _lockM04D27di; + private readonly Composition _root; + private readonly object _lock; public Composition() { - _rootM04D27di = this; - _lockM04D27di = new object(); + _root = this; + _lock = new object(); } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; - _lockM04D27di = _rootM04D27di._lockM04D27di; + _root = baseComposition._root; + _lock = _root._lock; } - public Pure.DI.Owned Root + public Owned Root { [MethodImpl((MethodImplOptions)0x100)] get { - var accumulatorM04D27di38 = new Pure.DI.Owned(); - Dependency transientM04D27di3_Dependency = new Dependency(); - lock (_lockM04D27di) + var accumulator38 = new Owned(); + Dependency transient3_Dependency = new Dependency(); + lock (_lock) { - accumulatorM04D27di38.Add(transientM04D27di3_Dependency); + accumulator38.Add(transient3_Dependency); } - Pure.DI.Owned perBlockM04D27di0_Owned; + Owned perBlock0_Owned; { - var owned_M04D27di1 = accumulatorM04D27di38; - var value_M04D27di2 = new Service(transientM04D27di3_Dependency); - perBlockM04D27di0_Owned = new Owned(value_M04D27di2, owned_M04D27di1); + var owned_1 = accumulator38; + var value_2 = new Service(transient3_Dependency); + perBlock0_Owned = new Owned(value_2, owned_1); } - lock (_lockM04D27di) + lock (_lock) { - accumulatorM04D27di38.Add(perBlockM04D27di0_Owned); + accumulator38.Add(perBlock0_Owned); } - return perBlockM04D27di0_Owned; + return perBlock0_Owned; } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] @@ -195,9 +195,9 @@ partial class Composition " OwnedᐸIServiceᐳ *-- Service : IService"; } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { diff --git a/readme/transient.md b/readme/transient.md index 9a40067db..58dc91d16 100644 --- a/readme/transient.md +++ b/readme/transient.md @@ -76,16 +76,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -100,30 +100,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -136,18 +136,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -218,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/tuple.md b/readme/tuple.md index 065a56ab6..433189c6b 100644 --- a/readme/tuple.md +++ b/readme/tuple.md @@ -77,16 +77,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -94,38 +94,38 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - Point transientM04D27di2_Point = new Point(7, 9); - return new Service((transientM04D27di2_Point, new Dependency())); + Point transient2_Point = new Point(7, 9); + return new Service((transient2_Point, new Dependency())); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -138,18 +138,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -194,25 +194,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -225,7 +225,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/type-attribute.md b/readme/type-attribute.md index d86921e0e..3c1e7c766 100644 --- a/readme/type-attribute.md +++ b/readme/type-attribute.md @@ -80,16 +80,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -104,30 +104,30 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -140,18 +140,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -190,25 +190,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -221,7 +221,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/valuetask.md b/readme/valuetask.md index a16b1c8d8..ba7676d2a 100644 --- a/readme/valuetask.md +++ b/readme/valuetask.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -96,42 +96,42 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - System.Threading.Tasks.ValueTask transientM04D27di1_ValueTask; + ValueTask transient1_ValueTask; { - var value_M04D27di1 = new Dependency(); - transientM04D27di1_ValueTask = new Threading.Tasks.ValueTask(value_M04D27di1); + var value_1 = new Dependency(); + transient1_ValueTask = new ValueTask(value_1); } - return new Service(transientM04D27di1_ValueTask); + return new Service(transient1_ValueTask); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -144,18 +144,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -196,25 +196,25 @@ partial class Composition " ValueTaskᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -227,7 +227,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) { diff --git a/readme/weak-reference.md b/readme/weak-reference.md index 7be83f377..5b96e122c 100644 --- a/readme/weak-reference.md +++ b/readme/weak-reference.md @@ -70,16 +70,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D27di; + private readonly Composition _root; public Composition() { - _rootM04D27di = this; + _root = this; } internal Composition(Composition baseComposition) { - _rootM04D27di = baseComposition._rootM04D27di; + _root = baseComposition._root; } public IService Root @@ -87,37 +87,37 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] get { - return new Service(new System.WeakReference(new Dependency())); + return new Service(new WeakReference(new Dependency())); } } [MethodImpl((MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D27di.Value.Resolve(this); + return Resolver.Value.Resolve(this); } [MethodImpl((MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D27di.Value.ResolveByTag(this, tag); + return Resolver.Value.ResolveByTag(this, tag); } [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D27di(type, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.Resolve(this) : Resolve(type, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, int index) + private object Resolve(Type type, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -130,18 +130,18 @@ partial class Composition [MethodImpl((MethodImplOptions)0x100)] public object Resolve(Type type, object? tag) { - var index = (int)(_bucketSizeM04D27di * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D27di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D27di(type, tag, index); + var index = (int)(_bucketSize * ((uint)RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _buckets[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : Resolve(type, tag, index); } [MethodImpl((MethodImplOptions)0x8)] - private object ResolveM04D27di(Type type, object? tag, int index) + private object Resolve(Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D27di; + var finish = index + _bucketSize; while (++index < finish) { - ref var pair = ref _bucketsM04D27di[index]; + ref var pair = ref _buckets[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -184,25 +184,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D27di; - private readonly static Pair>[] _bucketsM04D27di; + private readonly static int _bucketSize; + private readonly static Pair>[] _buckets; static Composition() { - var valResolverM04D27di_0000 = new ResolverM04D27di_0000(); - ResolverM04D27di.Value = valResolverM04D27di_0000; - _bucketsM04D27di = Buckets>.Create( + var valResolver_0000 = new Resolver_0000(); + Resolver.Value = valResolver_0000; + _buckets = Buckets>.Create( 1, - out _bucketSizeM04D27di, + out _bucketSize, new Pair>[1] { - new Pair>(typeof(IService), valResolverM04D27di_0000) + new Pair>(typeof(IService), valResolver_0000) }); } - private sealed class ResolverM04D27di: IResolver + private sealed class Resolver: IResolver { - public static IResolver Value = new ResolverM04D27di(); + public static IResolver Value = new Resolver(); public T Resolve(Composition composite) { @@ -215,7 +215,7 @@ partial class Composition } } - private sealed class ResolverM04D27di_0000: IResolver + private sealed class Resolver_0000: IResolver { public IService Resolve(Composition composition) {