diff --git a/build/ReadmeTarget.cs b/build/ReadmeTarget.cs index 69aae8a16..7f2991ad9 100644 --- a/build/ReadmeTarget.cs +++ b/build/ReadmeTarget.cs @@ -364,9 +364,8 @@ private static async Task AddExample(string logsDirectory, string exampleSearchP .Replace("Pure.DI.", "") .Replace(" Benchmarks.Model.", "") .Replace(salt, "") - .Replace("(MethodImplOptions)0x100", "MethodImplOptions.AggressiveInlining") .Replace("(MethodImplOptions)256", "MethodImplOptions.AggressiveInlining") - .Replace("(MethodImplOptions)0x8", "MethodImplOptions.NoInlining"))); + .Replace("(MethodImplOptions)8", "MethodImplOptions.NoInlining"))); await examplesWriter.WriteLineAsync(generatedCode); await examplesWriter.WriteLineAsync("```"); } diff --git a/readme/EnumDetails.md b/readme/EnumDetails.md index 8adee3ea0..963dad143 100644 --- a/readme/EnumDetails.md +++ b/readme/EnumDetails.md @@ -97,15 +97,16 @@ partial class Enum public partialCompositionRoot TestPureDIByCR() { [MethodImpl(MethodImplOptions.AggressiveInlining)] - IEnumerable EnumerationOf_perBlock10_IEnumerable() + IEnumerable EnumerationOf_perBlockIEnumerable10() { yield return newService3(newService4(), newService4()); yield return newService3v2(newService4(), newService4()); yield return newService3v3(newService4(), newService4()); yield return newService3v4(newService4(), newService4()); } - IEnumerable perBlock10_IEnumerable = EnumerationOf_perBlock10_IEnumerable(); - return newCompositionRoot(newService1(newService2Enum(perBlock10_IEnumerable)), newService2Enum(perBlock10_IEnumerable), newService2Enum(perBlock10_IEnumerable), newService2Enum(perBlock10_IEnumerable), newService3(newService4(), newService4()), newService4(), newService4()); + + IEnumerable perBlockIEnumerable10 = EnumerationOf_perBlockIEnumerable10(); + return newCompositionRoot(newService1(newService2Enum(perBlockIEnumerable10)), newService2Enum(perBlockIEnumerable10), newService2Enum(perBlockIEnumerable10), newService2Enum(perBlockIEnumerable10), newService3(newService4(), newService4()), newService4(), newService4()); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/readme/FuncDetails.md b/readme/FuncDetails.md index ddd6c9949..7b0b27503 100644 --- a/readme/FuncDetails.md +++ b/readme/FuncDetails.md @@ -78,14 +78,14 @@ partial class Func [MethodImpl(MethodImplOptions.AggressiveInlining)] public partialCompositionRoot TestPureDIByCR() { - Func perBlock10_Func = new Func( + Func perBlockFunc10 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var value_0 = newService3(newService4(), newService4()); - return value_0; + var localValue0 = newService3(newService4(), newService4()); + return localValue0; }); - return newCompositionRoot(newService1(newService2Func(perBlock10_Func)), newService2Func(perBlock10_Func), newService2Func(perBlock10_Func), newService2Func(perBlock10_Func), newService3(newService4(), newService4()), newService4(), newService4()); + return newCompositionRoot(newService1(newService2Func(perBlockFunc10)), newService2Func(perBlockFunc10), newService2Func(perBlockFunc10), newService2Func(perBlockFunc10), newService3(newService4(), newService4()), newService4(), newService4()); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/readme/SingletonDetails.md b/readme/SingletonDetails.md index 505e85ce0..01eac1ae2 100644 --- a/readme/SingletonDetails.md +++ b/readme/SingletonDetails.md @@ -62,8 +62,8 @@ The following partial class will be generated: partial class Singleton { private readonly Singleton _root; - privateService1? _scoped37_Service1; - privateService4? _scoped40_Service4; + privateService1? _scopedService137; + privateService4? _scopedService440; public Singleton() { @@ -78,15 +78,17 @@ partial class Singleton [MethodImpl(MethodImplOptions.AggressiveInlining)] public partialCompositionRoot TestPureDIByCR() { - if (_scoped40_Service4 == null) + if (_scopedService440 == null) { - _scoped40_Service4 = newService4(); + _scopedService440 = newService4(); } - if (_scoped37_Service1 == null) + + if (_scopedService137 == null) { - _scoped37_Service1 = newService1(newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!))); + _scopedService137 = newService1(newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!))); } - return newCompositionRoot(_scoped37_Service1!, newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)), newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)), newService2(newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!), newService3(_scoped40_Service4!, _scoped40_Service4!)), newService3(_scoped40_Service4!, _scoped40_Service4!), _scoped40_Service4!, _scoped40_Service4!); + + return newCompositionRoot(_scopedService137!, newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService3(_scopedService440!, _scopedService440!), _scopedService440!, _scopedService440!); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/readme/accumulators.md b/readme/accumulators.md index 4327f740c..4c4519bc5 100644 --- a/readme/accumulators.md +++ b/readme/accumulators.md @@ -48,7 +48,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private XyzDependency? _singleton38_XyzDependency; + private XyzDependency? _singletonXyzDependency38; public Composition() { @@ -68,32 +68,35 @@ partial class Composition get { var accumulator42 = new MyAccumulator(); - AbcDependency perBlock4_AbcDependency = new AbcDependency(); - if (_root._singleton38_XyzDependency == null) + AbcDependency perBlockAbcDependency4 = new AbcDependency(); + if (_root._singletonXyzDependency38 == null) { lock (_lock) { - if (_root._singleton38_XyzDependency == null) + if (_root._singletonXyzDependency38 == null) { - XyzDependency _singleton38_XyzDependencyTemp; - _singleton38_XyzDependencyTemp = new XyzDependency(); - accumulator42.Add(_singleton38_XyzDependencyTemp); + XyzDependency _singletonXyzDependency38Temp; + _singletonXyzDependency38Temp = new XyzDependency(); + accumulator42.Add(_singletonXyzDependency38Temp); Thread.MemoryBarrier(); - _root._singleton38_XyzDependency = _singleton38_XyzDependencyTemp; + _root._singletonXyzDependency38 = _singletonXyzDependency38Temp; } } } - AbcDependency transient3_AbcDependency = new AbcDependency(); + + AbcDependency transientAbcDependency3 = new AbcDependency(); lock (_lock) { - accumulator42.Add(transient3_AbcDependency); + accumulator42.Add(transientAbcDependency3); } - Service transient1_Service = new Service(transient3_AbcDependency, _root._singleton38_XyzDependency!, perBlock4_AbcDependency); + + Service transientService1 = new Service(transientAbcDependency3, _root._singletonXyzDependency38!, perBlockAbcDependency4); lock (_lock) { - accumulator42.Add(transient1_Service); + accumulator42.Add(transientService1); } - return (transient1_Service, accumulator42); + + return (transientService1, accumulator42); } } diff --git a/readme/async-disposable-scope.md b/readme/async-disposable-scope.md index a02a4be5d..10c7c9423 100644 --- a/readme/async-disposable-scope.md +++ b/readme/async-disposable-scope.md @@ -91,7 +91,7 @@ partial class Composition: IDisposable, IAsyncDisposable private readonly object _lock; private object[] _disposables; private int _disposeIndex; - private Dependency? _scoped36_Dependency; + private Dependency? _scopedDependency36; public Composition() { @@ -112,18 +112,19 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scoped36_Dependency == null) + if (_scopedDependency36 == null) { lock (_lock) { - if (_scoped36_Dependency == null) + if (_scopedDependency36 == null) { - _scoped36_Dependency = new Dependency(); - _disposables[_disposeIndex++] = _scoped36_Dependency; + _scopedDependency36 = new Dependency(); + _disposables[_disposeIndex++] = _scopedDependency36; } } } - return new Service(_scoped36_Dependency!); + + return new Service(_scopedDependency36!); } } @@ -132,16 +133,16 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve43_Func = default(Func); - perResolve43_Func = new Func( + var perResolveFunc43 = default(Func); + perResolveFunc43 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - Composition transient2_Composition = this; - var value_0 = new Session(transient2_Composition); - return value_0; + Composition transientComposition2 = this; + var localValue0 = new Session(transientComposition2); + return localValue0; }); - return new Program(perResolve43_Func!); + return new Program(perResolveFunc43!); } } @@ -155,7 +156,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scoped36_Dependency = null; + _scopedDependency36 = null; } while (disposeIndex-- > 0) @@ -192,7 +193,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scoped36_Dependency = null; + _scopedDependency36 = null; } while (disposeIndex-- > 0) diff --git a/readme/async-disposable-singleton.md b/readme/async-disposable-singleton.md index 4304cf4a1..09c622f0e 100644 --- a/readme/async-disposable-singleton.md +++ b/readme/async-disposable-singleton.md @@ -57,7 +57,7 @@ partial class Composition: IDisposable, IAsyncDisposable private readonly object _lock; private object[] _disposables; private int _disposeIndex; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -78,18 +78,19 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); - _root._disposables[_root._disposeIndex++] = _root._singleton36_Dependency; + _root._singletonDependency36 = new Dependency(); + _root._disposables[_root._disposeIndex++] = _root._singletonDependency36; } } } - return new Service(_root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!); } } @@ -103,7 +104,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singleton36_Dependency = null; + _singletonDependency36 = null; } while (disposeIndex-- > 0) @@ -140,7 +141,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singleton36_Dependency = null; + _singletonDependency36 = null; } while (disposeIndex-- > 0) diff --git a/readme/async-enumerable.md b/readme/async-enumerable.md index ebe653c90..b484bfb48 100644 --- a/readme/async-enumerable.md +++ b/readme/async-enumerable.md @@ -69,14 +69,15 @@ partial class Composition get { [MethodImpl(MethodImplOptions.AggressiveInlining)] - async IAsyncEnumerable EnumerationOf_transient1_IAsyncEnumerable() + async IAsyncEnumerable EnumerationOf_transientIAsyncEnumerable1() { yield return new AbcDependency(); yield return new XyzDependency(); await Task.CompletedTask; } - IAsyncEnumerable transient1_IAsyncEnumerable = EnumerationOf_transient1_IAsyncEnumerable(); - return new Service(transient1_IAsyncEnumerable); + + IAsyncEnumerable transientIAsyncEnumerable1 = EnumerationOf_transientIAsyncEnumerable1(); + return new Service(transientIAsyncEnumerable1); } } diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index 377650c8c..d042862c0 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -71,7 +71,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _scoped36_Dependency; + private Dependency? _scopedDependency36; public Composition() { @@ -90,17 +90,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scoped36_Dependency == null) + if (_scopedDependency36 == null) { lock (_lock) { - if (_scoped36_Dependency == null) + if (_scopedDependency36 == null) { - _scoped36_Dependency = new Dependency(); + _scopedDependency36 = new Dependency(); } } } - return new Service(_scoped36_Dependency!); + + return new Service(_scopedDependency36!); } } @@ -109,23 +110,24 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve43_Func = default(Func); - perResolve43_Func = new Func( + var perResolveFunc43 = default(Func); + perResolveFunc43 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - Composition transient2_Composition = this; - IService transient1_IService; + Composition transientComposition2 = this; + IService transientIService1; { - var baseComposition_1 = transient2_Composition; + var localBaseComposition1 = transientComposition2; // Creates a session - var session_2 = new Composition(baseComposition_1); - transient1_IService = session_2.SessionRoot; + var localSession2 = new Composition(localBaseComposition1); + transientIService1 = localSession2.SessionRoot; } - var value_0 = transient1_IService; - return value_0; + + var localValue0 = transientIService1; + return localValue0; }); - return new Program(perResolve43_Func!); + return new Program(perResolveFunc43!); } } } diff --git a/readme/check-for-a-root.md b/readme/check-for-a-root.md index 2c8e970cd..cb4c77f0f 100644 --- a/readme/check-for-a-root.md +++ b/readme/check-for-a-root.md @@ -88,7 +88,7 @@ partial class Composition } } - private IDependency Root0001 + private IDependency Root1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get @@ -168,7 +168,7 @@ partial class Composition OnNewRoot(valResolver_0000, "Root", null, Lifetime.Transient); Resolver.Value = valResolver_0000; var valResolver_0001 = new Resolver_0001(); - OnNewRoot(valResolver_0001, "Root0001", "MyDep", Lifetime.Transient); + OnNewRoot(valResolver_0001, "Root1", "MyDep", Lifetime.Transient); Resolver.Value = valResolver_0001; _buckets = Buckets>.Create( 4, @@ -230,7 +230,7 @@ partial class Composition switch (tag) { case "MyDep": - return composition.Root0001; + return composition.Root1; default: return base.ResolveByTag(composition, tag); diff --git a/readme/class-arguments.md b/readme/class-arguments.md index 2565485f8..80b0e06e4 100644 --- a/readme/class-arguments.md +++ b/readme/class-arguments.md @@ -71,24 +71,24 @@ partial class Composition { private readonly Composition _root; - private readonly int _arg_id; - private readonly string _arg_serviceName; - private readonly string _arg_dependencyName; + private readonly int _argId; + private readonly string _argServiceName; + private readonly string _argDependencyName; public Composition(int id, string serviceName, string dependencyName) { - _arg_id = id; - _arg_serviceName = serviceName ?? throw new ArgumentNullException(nameof(serviceName)); - _arg_dependencyName = dependencyName ?? throw new ArgumentNullException(nameof(dependencyName)); + _argId = id; + _argServiceName = serviceName ?? throw new ArgumentNullException(nameof(serviceName)); + _argDependencyName = dependencyName ?? throw new ArgumentNullException(nameof(dependencyName)); _root = this; } internal Composition(Composition parentScope) { _root = (parentScope ?? throw new ArgumentNullException(nameof(parentScope)))._root; - _arg_id = _root._arg_id; - _arg_serviceName = _root._arg_serviceName; - _arg_dependencyName = _root._arg_dependencyName; + _argId = _root._argId; + _argServiceName = _root._argServiceName; + _argDependencyName = _root._argDependencyName; } public IService Root @@ -96,7 +96,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - return new Service(_arg_serviceName, new Dependency(_arg_id, _arg_dependencyName)); + return new Service(_argServiceName, new Dependency(_argId, _argDependencyName)); } } } diff --git a/readme/composition-roots.md b/readme/composition-roots.md index 48f87158b..a308b5eba 100644 --- a/readme/composition-roots.md +++ b/readme/composition-roots.md @@ -101,7 +101,7 @@ partial class Composition } } - private IDependency Root0002 + private IDependency Root2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get @@ -234,7 +234,7 @@ partial class Composition { public override IDependency Resolve(Composition composition) { - return composition.Root0002; + return composition.Root2; } public override IDependency ResolveByTag(Composition composition, object tag) @@ -242,7 +242,7 @@ partial class Composition switch (tag) { case null: - return composition.Root0002; + return composition.Root2; default: return base.ResolveByTag(composition, tag); diff --git a/readme/constructor-ordinal-attribute.md b/readme/constructor-ordinal-attribute.md index 94cd66801..0f0d6d277 100644 --- a/readme/constructor-ordinal-attribute.md +++ b/readme/constructor-ordinal-attribute.md @@ -52,18 +52,18 @@ partial class Composition { private readonly Composition _root; - private readonly string _arg_serviceName; + private readonly string _argServiceName; public Composition(string serviceName) { - _arg_serviceName = serviceName ?? throw new ArgumentNullException(nameof(serviceName)); + _argServiceName = serviceName ?? throw new ArgumentNullException(nameof(serviceName)); _root = this; } internal Composition(Composition parentScope) { _root = (parentScope ?? throw new ArgumentNullException(nameof(parentScope)))._root; - _arg_serviceName = _root._arg_serviceName; + _argServiceName = _root._argServiceName; } public IService Root @@ -71,7 +71,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - return new Service(_arg_serviceName); + return new Service(_argServiceName); } } } diff --git a/readme/custom-attributes.md b/readme/custom-attributes.md index 5481f807a..94bdfd632 100644 --- a/readme/custom-attributes.md +++ b/readme/custom-attributes.md @@ -63,18 +63,18 @@ partial class PersonComposition { private readonly PersonComposition _root; - private readonly int _arg_personId; + private readonly int _argPersonId; public PersonComposition(int personId) { - _arg_personId = personId; + _argPersonId = personId; _root = this; } internal PersonComposition(PersonComposition parentScope) { _root = (parentScope ?? throw new ArgumentNullException(nameof(parentScope)))._root; - _arg_personId = _root._arg_personId; + _argPersonId = _root._argPersonId; } public IPerson Person @@ -82,10 +82,10 @@ partial class PersonComposition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - string transient1_String = "Nik"; - Person transient0_Person = new Person(transient1_String); - transient0_Person.Id = _arg_personId; - return transient0_Person; + string transientString1 = "Nik"; + Person transientPerson0 = new Person(transientString1); + transientPerson0.Id = _argPersonId; + return transientPerson0; } } } diff --git a/readme/default-lifetime.md b/readme/default-lifetime.md index 3640f2e7b..65feb1fa0 100644 --- a/readme/default-lifetime.md +++ b/readme/default-lifetime.md @@ -52,8 +52,8 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Service? _singleton37_Service; - private Dependency? _singleton36_Dependency; + private Service? _singletonService37; + private Dependency? _singletonDependency36; public Composition() { @@ -72,21 +72,23 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton37_Service == null) + if (_root._singletonService37 == null) { lock (_lock) { - if (_root._singleton37_Service == null) + if (_root._singletonService37 == null) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } - _root._singleton37_Service = new Service(_root._singleton36_Dependency!, _root._singleton36_Dependency!); + + _root._singletonService37 = new Service(_root._singletonDependency36!, _root._singletonDependency36!); } } } - return _root._singleton37_Service!; + + return _root._singletonService37!; } } } diff --git a/readme/disposable-singleton.md b/readme/disposable-singleton.md index 3e014e129..8d0ecf1d9 100644 --- a/readme/disposable-singleton.md +++ b/readme/disposable-singleton.md @@ -55,7 +55,7 @@ partial class Composition: IDisposable private readonly object _lock; private object[] _disposables; private int _disposeIndex; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -76,18 +76,19 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); - _root._disposables[_root._disposeIndex++] = _root._singleton36_Dependency; + _root._singletonDependency36 = new Dependency(); + _root._disposables[_root._disposeIndex++] = _root._singletonDependency36; } } } - return new Service(_root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!); } } @@ -101,7 +102,7 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singleton36_Dependency = null; + _singletonDependency36 = null; } while (disposeIndex-- > 0) diff --git a/readme/enumerable-generics.md b/readme/enumerable-generics.md index 2a7e8c2e0..68110a031 100644 --- a/readme/enumerable-generics.md +++ b/readme/enumerable-generics.md @@ -66,13 +66,14 @@ partial class Composition get { [MethodImpl(MethodImplOptions.AggressiveInlining)] - IEnumerable> EnumerationOf_perBlock1_IEnumerable() + IEnumerable> EnumerationOf_perBlockIEnumerable1() { yield return new AbcDependency(); yield return new XyzDependency(); } - IEnumerable> perBlock1_IEnumerable = EnumerationOf_perBlock1_IEnumerable(); - return new Service(perBlock1_IEnumerable); + + IEnumerable> perBlockIEnumerable1 = EnumerationOf_perBlockIEnumerable1(); + return new Service(perBlockIEnumerable1); } } @@ -82,13 +83,14 @@ partial class Composition get { [MethodImpl(MethodImplOptions.AggressiveInlining)] - IEnumerable> EnumerationOf_perBlock1_IEnumerable() + IEnumerable> EnumerationOf_perBlockIEnumerable1() { yield return new AbcDependency(); yield return new XyzDependency(); } - IEnumerable> perBlock1_IEnumerable = EnumerationOf_perBlock1_IEnumerable(); - return new Service(perBlock1_IEnumerable); + + IEnumerable> perBlockIEnumerable1 = EnumerationOf_perBlockIEnumerable1(); + return new Service(perBlockIEnumerable1); } } diff --git a/readme/enumerable.md b/readme/enumerable.md index da876cd27..77c60de46 100644 --- a/readme/enumerable.md +++ b/readme/enumerable.md @@ -61,13 +61,14 @@ partial class Composition get { [MethodImpl(MethodImplOptions.AggressiveInlining)] - IEnumerable EnumerationOf_perBlock1_IEnumerable() + IEnumerable EnumerationOf_perBlockIEnumerable1() { yield return new AbcDependency(); yield return new XyzDependency(); } - IEnumerable perBlock1_IEnumerable = EnumerationOf_perBlock1_IEnumerable(); - return new Service(perBlock1_IEnumerable); + + IEnumerable perBlockIEnumerable1 = EnumerationOf_perBlockIEnumerable1(); + return new Service(perBlockIEnumerable1); } } diff --git a/readme/factory.md b/readme/factory.md index ba297b8db..0fed26ad5 100644 --- a/readme/factory.md +++ b/readme/factory.md @@ -82,14 +82,15 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - DateTimeOffset transient3_DateTimeOffset = DateTimeOffset.Now; - Dependency transient1_Dependency; + DateTimeOffset transientDateTimeOffset3 = DateTimeOffset.Now; + Dependency transientDependency1; { - var dependency_0 = new Dependency(transient3_DateTimeOffset); - dependency_0.Initialize(); - transient1_Dependency = dependency_0; + var localDependency0 = new Dependency(transientDateTimeOffset3); + localDependency0.Initialize(); + transientDependency1 = localDependency0; } - return new Service(transient1_Dependency); + + return new Service(transientDependency1); } } } diff --git a/readme/field-injection.md b/readme/field-injection.md index 330dbc128..c46d217e9 100644 --- a/readme/field-injection.md +++ b/readme/field-injection.md @@ -60,9 +60,9 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Service transient0_Service = new Service(); - transient0_Service.DependencyVal = new Dependency(); - return transient0_Service; + Service transientService0 = new Service(); + transientService0.DependencyVal = new Dependency(); + return transientService0; } } } diff --git a/readme/func-with-arguments.md b/readme/func-with-arguments.md index 10ef056ba..5755e9fa6 100644 --- a/readme/func-with-arguments.md +++ b/readme/func-with-arguments.md @@ -73,7 +73,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Clock? _singleton36_Clock; + private Clock? _singletonClock36; public Composition() { @@ -92,23 +92,24 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Func transient1_Func = dependencyId => + Func transientFunc1 = dependencyId => { - int transient3_Int32 = dependencyId; - if (_root._singleton36_Clock == null) + int transientInt323 = dependencyId; + if (_root._singletonClock36 == null) { lock (_lock) { - if (_root._singleton36_Clock == null) + if (_root._singletonClock36 == null) { - _root._singleton36_Clock = new Clock(); + _root._singletonClock36 = new Clock(); } } } - var dependency_0 = new Dependency(_root._singleton36_Clock!, transient3_Int32); - return dependency_0; + + var localDependency0 = new Dependency(_root._singletonClock36!, transientInt323); + return localDependency0; }; - return new Service(transient1_Func); + return new Service(transientFunc1); } } diff --git a/readme/func-with-tag.md b/readme/func-with-tag.md index cf900226f..d5f2462d6 100644 --- a/readme/func-with-tag.md +++ b/readme/func-with-tag.md @@ -61,15 +61,15 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve39_Func = default(Func); - perResolve39_Func = new Func( + var perResolveFunc39 = default(Func); + perResolveFunc39 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var value_0 = new Dependency(); - return value_0; + var localValue0 = new Dependency(); + return localValue0; }); - return new Service(perResolve39_Func!); + return new Service(perResolveFunc39!); } } diff --git a/readme/func.md b/readme/func.md index 2e8ce2193..38ee9d29e 100644 --- a/readme/func.md +++ b/readme/func.md @@ -64,15 +64,15 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve39_Func = default(Func); - perResolve39_Func = new Func( + var perResolveFunc39 = default(Func); + perResolveFunc39 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var value_0 = new Dependency(); - return value_0; + var localValue0 = new Dependency(); + return localValue0; }); - return new Service(perResolve39_Func!); + return new Service(perResolveFunc39!); } } diff --git a/readme/generic-composition-roots-with-constraints.md b/readme/generic-composition-roots-with-constraints.md index a30dd7785..d80862255 100644 --- a/readme/generic-composition-roots-with-constraints.md +++ b/readme/generic-composition-roots-with-constraints.md @@ -83,12 +83,13 @@ partial class Composition public IService GetOtherService() where T: IDisposable { - OtherService transient0_OtherService; + OtherService transientOtherService0; { - var dependency_0 = new Dependency(); - transient0_OtherService = new OtherService(dependency_0); + var localDependency0 = new Dependency(); + transientOtherService0 = new OtherService(localDependency0); } - return transient0_OtherService; + + return transientOtherService0; } } ``` diff --git a/readme/generic-composition-roots.md b/readme/generic-composition-roots.md index 8ab937ee7..eef42d486 100644 --- a/readme/generic-composition-roots.md +++ b/readme/generic-composition-roots.md @@ -77,12 +77,13 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] public IService GetOtherService() { - OtherService transient0_OtherService; + OtherService transientOtherService0; { - var dependency_0 = new Dependency(); - transient0_OtherService = new OtherService(dependency_0); + var localDependency0 = new Dependency(); + transientOtherService0 = new OtherService(localDependency0); } - return transient0_OtherService; + + return transientOtherService0; } } ``` diff --git a/readme/keyed-service-provider.md b/readme/keyed-service-provider.md index 4d7dd63f0..2cbda0862 100644 --- a/readme/keyed-service-provider.md +++ b/readme/keyed-service-provider.md @@ -52,7 +52,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -66,41 +66,43 @@ partial class Composition _lock = _root._lock; } - private IDependency Root0001 + private IDependency Root1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return _root._singleton36_Dependency!; + + return _root._singletonDependency36!; } } - private IService Root0002 + private IService Root2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return new Service(_root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!); } } @@ -213,7 +215,7 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.Root0001; + return composition.Root1; default: return base.ResolveByTag(composition, tag); @@ -233,7 +235,7 @@ partial class Composition switch (tag) { case "Service Key": - return composition.Root0002; + return composition.Root2; default: return base.ResolveByTag(composition, tag); diff --git a/readme/lazy.md b/readme/lazy.md index 44d580e74..7dfc4050a 100644 --- a/readme/lazy.md +++ b/readme/lazy.md @@ -55,20 +55,21 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve40_Func = default(Func); - perResolve40_Func = new Func( + var perResolveFunc40 = default(Func); + perResolveFunc40 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var value_0 = new Dependency(); - return value_0; + var localValue0 = new Dependency(); + return localValue0; }); - Lazy transient1_Lazy; + Lazy transientLazy1; { - var factory_1 = perResolve40_Func!; - transient1_Lazy = new Lazy(factory_1, true); + var localFactory1 = perResolveFunc40!; + transientLazy1 = new Lazy(localFactory1, true); } - return new Service(transient1_Lazy); + + return new Service(transientLazy1); } } diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index 44f280b87..42091eecf 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -90,21 +90,22 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] public IService GetRoot(CancellationToken cancellationToken) { - var perResolve42_Func = default(Func); - perResolve42_Func = new Func( + var perResolveFunc42 = default(Func); + perResolveFunc42 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var value_0 = new Dependency(); - return value_0; + var localValue0 = new Dependency(); + return localValue0; }); - Task transient1_Task; + Task transientTask1; { - var factory_1 = perResolve42_Func!; - var cancellationToken_2 = cancellationToken; - transient1_Task = new Task(factory_1, cancellationToken_2); + var localFactory1 = perResolveFunc42!; + var localCancellationToken2 = cancellationToken; + transientTask1 = new Task(localFactory1, localCancellationToken2); } - return new Service(transient1_Task); + + return new Service(transientTask1); } } ``` diff --git a/readme/member-ordinal-attribute.md b/readme/member-ordinal-attribute.md index 51dcf26f2..5c60b9a70 100644 --- a/readme/member-ordinal-attribute.md +++ b/readme/member-ordinal-attribute.md @@ -72,24 +72,24 @@ partial class PersonComposition { private readonly PersonComposition _root; - private readonly int _arg_personId; - private readonly string _arg_personName; - private readonly DateTime _arg_personBirthday; + private readonly int _argPersonId; + private readonly string _argPersonName; + private readonly DateTime _argPersonBirthday; public PersonComposition(int personId, string personName, DateTime personBirthday) { - _arg_personId = personId; - _arg_personName = personName ?? throw new ArgumentNullException(nameof(personName)); - _arg_personBirthday = personBirthday; + _argPersonId = personId; + _argPersonName = personName ?? throw new ArgumentNullException(nameof(personName)); + _argPersonBirthday = personBirthday; _root = this; } internal PersonComposition(PersonComposition parentScope) { _root = (parentScope ?? throw new ArgumentNullException(nameof(parentScope)))._root; - _arg_personId = _root._arg_personId; - _arg_personName = _root._arg_personName; - _arg_personBirthday = _root._arg_personBirthday; + _argPersonId = _root._argPersonId; + _argPersonName = _root._argPersonName; + _argPersonBirthday = _root._argPersonBirthday; } public IPerson Person @@ -97,11 +97,11 @@ partial class PersonComposition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Person transient0_Person = new Person(); - transient0_Person.Id = _arg_personId; - transient0_Person.FirstName = _arg_personName; - transient0_Person.Birthday = _arg_personBirthday; - return transient0_Person; + Person transientPerson0 = new Person(); + transientPerson0.Id = _argPersonId; + transientPerson0.FirstName = _argPersonName; + transientPerson0.Birthday = _argPersonBirthday; + return transientPerson0; } } } diff --git a/readme/method-injection.md b/readme/method-injection.md index 4f3a29ffa..480782fdd 100644 --- a/readme/method-injection.md +++ b/readme/method-injection.md @@ -61,9 +61,9 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Service transient0_Service = new Service(); - transient0_Service.SetDependency(new Dependency()); - return transient0_Service; + Service transientService0 = new Service(); + transientService0.SetDependency(new Dependency()); + return transientService0; } } } diff --git a/readme/oncannotresolve-hint.md b/readme/oncannotresolve-hint.md index f30c65df5..df4949c1a 100644 --- a/readme/oncannotresolve-hint.md +++ b/readme/oncannotresolve-hint.md @@ -79,8 +79,8 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - string transient2_String = OnCannotResolve(null, Lifetime.Transient); - return new Service(new Dependency(transient2_String)); + string transientString2 = OnCannotResolve(null, Lifetime.Transient); + return new Service(new Dependency(transientString2)); } } diff --git a/readme/onnewinstance-hint.md b/readme/onnewinstance-hint.md index 3c580cd1a..7c8304e68 100644 --- a/readme/onnewinstance-hint.md +++ b/readme/onnewinstance-hint.md @@ -65,7 +65,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -84,23 +84,24 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - Dependency _singleton36_DependencyTemp; - _singleton36_DependencyTemp = new Dependency(); - OnNewInstance(ref _singleton36_DependencyTemp, null, Lifetime.Singleton); + Dependency _singletonDependency36Temp; + _singletonDependency36Temp = new Dependency(); + OnNewInstance(ref _singletonDependency36Temp, null, Lifetime.Singleton); Thread.MemoryBarrier(); - _root._singleton36_Dependency = _singleton36_DependencyTemp; + _root._singletonDependency36 = _singletonDependency36Temp; } } } - Service transient0_Service = new Service(_root._singleton36_Dependency!); - OnNewInstance(ref transient0_Service, null, Lifetime.Transient); - return transient0_Service; + + Service transientService0 = new Service(_root._singletonDependency36!); + OnNewInstance(ref transientService0, null, Lifetime.Transient); + return transientService0; } } diff --git a/readme/overriding-the-bcl-binding.md b/readme/overriding-the-bcl-binding.md index b6b58f520..8087e65d1 100644 --- a/readme/overriding-the-bcl-binding.md +++ b/readme/overriding-the-bcl-binding.md @@ -64,13 +64,13 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - IDependency[] transient1_ = new IDependency[] + IDependency[] transient1 = new IDependency[] { new AbcDependency(), new XyzDependency(), new AbcDependency() }; - return new Service(transient1_); + return new Service(transient1); } } diff --git a/readme/partial-class.md b/readme/partial-class.md index 4d277568f..b170c9ee7 100644 --- a/readme/partial-class.md +++ b/readme/partial-class.md @@ -88,10 +88,10 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - 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)); + long transientInt645 = GenerateId(); + long transientInt644 = GenerateId(); + string transientString1 = $"{_serviceName}_{GenerateId()}"; + return new Service(transientString1, new Dependency(transientInt645), new Dependency(transientInt644)); } } diff --git a/readme/perblock.md b/readme/perblock.md index 852810ceb..4a1b91bc6 100644 --- a/readme/perblock.md +++ b/readme/perblock.md @@ -51,8 +51,8 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private (IDependency dep3, IDependency dep4) _singleton37_ValueTuple; - private bool _singleton37_ValueTupleCreated; + private (IDependency dep3, IDependency dep4) _singletonValueTuple37; + private bool _singletonValueTuple37Created; public Composition() { @@ -71,21 +71,22 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (!_root._singleton37_ValueTupleCreated) + if (!_root._singletonValueTuple37Created) { lock (_lock) { - if (!_root._singleton37_ValueTupleCreated) + if (!_root._singletonValueTuple37Created) { - Dependency perBlock2_Dependency = new Dependency(); - _root._singleton37_ValueTuple = (perBlock2_Dependency, perBlock2_Dependency); + Dependency perBlockDependency2 = new Dependency(); + _root._singletonValueTuple37 = (perBlockDependency2, perBlockDependency2); Thread.MemoryBarrier(); - _root._singleton37_ValueTupleCreated = true; + _root._singletonValueTuple37Created = true; } } } - Dependency perBlock1_Dependency = new Dependency(); - return new Service(perBlock1_Dependency, perBlock1_Dependency, _root._singleton37_ValueTuple); + + Dependency perBlockDependency1 = new Dependency(); + return new Service(perBlockDependency1, perBlockDependency1, _root._singletonValueTuple37); } } } diff --git a/readme/perresolve.md b/readme/perresolve.md index 184d32508..b15dd510c 100644 --- a/readme/perresolve.md +++ b/readme/perresolve.md @@ -51,8 +51,8 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private (IDependency dep3, IDependency dep4) _singleton37_ValueTuple; - private bool _singleton37_ValueTupleCreated; + private (IDependency dep3, IDependency dep4) _singletonValueTuple37; + private bool _singletonValueTuple37Created; public Composition() { @@ -71,34 +71,37 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve36_Dependency = default(Dependency); - if (!_root._singleton37_ValueTupleCreated) + var perResolveDependency36 = default(Dependency); + if (!_root._singletonValueTuple37Created) { lock (_lock) { - if (!_root._singleton37_ValueTupleCreated) + if (!_root._singletonValueTuple37Created) { - if (perResolve36_Dependency == null) + if (perResolveDependency36 == null) { - perResolve36_Dependency = new Dependency(); + perResolveDependency36 = new Dependency(); } - _root._singleton37_ValueTuple = (perResolve36_Dependency!, perResolve36_Dependency!); + + _root._singletonValueTuple37 = (perResolveDependency36!, perResolveDependency36!); Thread.MemoryBarrier(); - _root._singleton37_ValueTupleCreated = true; + _root._singletonValueTuple37Created = true; } } } - if (perResolve36_Dependency == null) + + if (perResolveDependency36 == null) { lock (_lock) { - if (perResolve36_Dependency == null) + if (perResolveDependency36 == null) { - perResolve36_Dependency = new Dependency(); + perResolveDependency36 = new Dependency(); } } } - return new Service(perResolve36_Dependency!, perResolve36_Dependency!, _root._singleton37_ValueTuple); + + return new Service(perResolveDependency36!, perResolveDependency36!, _root._singletonValueTuple37); } } } diff --git a/readme/property-injection.md b/readme/property-injection.md index 28428acf2..68034947f 100644 --- a/readme/property-injection.md +++ b/readme/property-injection.md @@ -58,9 +58,9 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Service transient0_Service = new Service(); - transient0_Service.Dependency = new Dependency(); - return transient0_Service; + Service transientService0 = new Service(); + transientService0.Dependency = new Dependency(); + return transientService0; } } } diff --git a/readme/required-properties-or-fields.md b/readme/required-properties-or-fields.md index d8543d79b..35c32d40c 100644 --- a/readme/required-properties-or-fields.md +++ b/readme/required-properties-or-fields.md @@ -49,18 +49,18 @@ partial class Composition { private readonly Composition _root; - private readonly string _arg_name; + private readonly string _argName; public Composition(string name) { - _arg_name = name ?? throw new ArgumentNullException(nameof(name)); + _argName = name ?? throw new ArgumentNullException(nameof(name)); _root = this; } internal Composition(Composition parentScope) { _root = (parentScope ?? throw new ArgumentNullException(nameof(parentScope)))._root; - _arg_name = _root._arg_name; + _argName = _root._argName; } public IService Root @@ -70,7 +70,7 @@ partial class Composition { return new Service() { - ServiceNameField = _arg_name, + ServiceNameField = _argName, Dependency = new Dependency() }; } diff --git a/readme/resolve-methods.md b/readme/resolve-methods.md index 4226bc6b1..df26e1702 100644 --- a/readme/resolve-methods.md +++ b/readme/resolve-methods.md @@ -69,7 +69,7 @@ partial class Composition } } - private IDependency Root0001 + private IDependency Root1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get @@ -78,7 +78,7 @@ partial class Composition } } - private IService Root0002 + private IService Root2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get @@ -188,7 +188,7 @@ partial class Composition { public override IService Resolve(Composition composition) { - return composition.Root0002; + return composition.Root2; } public override IService ResolveByTag(Composition composition, object tag) @@ -199,7 +199,7 @@ partial class Composition return composition.OtherService; case null: - return composition.Root0002; + return composition.Root2; default: return base.ResolveByTag(composition, tag); @@ -211,7 +211,7 @@ partial class Composition { public override IDependency Resolve(Composition composition) { - return composition.Root0001; + return composition.Root1; } public override IDependency ResolveByTag(Composition composition, object tag) @@ -219,7 +219,7 @@ partial class Composition switch (tag) { case null: - return composition.Root0001; + return composition.Root1; default: return base.ResolveByTag(composition, tag); diff --git a/readme/root-binding.md b/readme/root-binding.md index dbf413aa9..44076d6fa 100644 --- a/readme/root-binding.md +++ b/readme/root-binding.md @@ -29,7 +29,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -48,17 +48,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return new Service(_root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!); } } } diff --git a/readme/scope.md b/readme/scope.md index 476443033..d5c3f9674 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -89,7 +89,7 @@ partial class Composition: IDisposable private readonly object _lock; private object[] _disposables; private int _disposeIndex; - private Dependency? _scoped36_Dependency; + private Dependency? _scopedDependency36; public Composition() { @@ -110,18 +110,19 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scoped36_Dependency == null) + if (_scopedDependency36 == null) { lock (_lock) { - if (_scoped36_Dependency == null) + if (_scopedDependency36 == null) { - _scoped36_Dependency = new Dependency(); - _disposables[_disposeIndex++] = _scoped36_Dependency; + _scopedDependency36 = new Dependency(); + _disposables[_disposeIndex++] = _scopedDependency36; } } } - return new Service(_scoped36_Dependency!); + + return new Service(_scopedDependency36!); } } @@ -130,16 +131,16 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve43_Func = default(Func); - perResolve43_Func = new Func( + var perResolveFunc43 = default(Func); + perResolveFunc43 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - Composition transient2_Composition = this; - var value_0 = new Session(transient2_Composition); - return value_0; + Composition transientComposition2 = this; + var localValue0 = new Session(transientComposition2); + return localValue0; }); - return new Program(perResolve43_Func!); + return new Program(perResolveFunc43!); } } @@ -153,7 +154,7 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scoped36_Dependency = null; + _scopedDependency36 = null; } while (disposeIndex-- > 0) diff --git a/readme/service-collection.md b/readme/service-collection.md index ef81998c5..6f468f912 100644 --- a/readme/service-collection.md +++ b/readme/service-collection.md @@ -49,7 +49,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -63,41 +63,43 @@ partial class Composition _lock = _root._lock; } - private IDependency Root0001 + private IDependency Root1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return _root._singleton36_Dependency!; + + return _root._singletonDependency36!; } } - private IService Root0002 + private IService Root2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return new Service(_root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!); } } @@ -167,10 +169,10 @@ partial class Composition static Composition() { var valResolver_0000 = new Resolver_0000(); - OnNewRoot(valResolver_0000, "Root0001", "Dependency Key", Lifetime.Singleton); + OnNewRoot(valResolver_0000, "Root1", "Dependency Key", Lifetime.Singleton); Resolver.Value = valResolver_0000; var valResolver_0001 = new Resolver_0001(); - OnNewRoot(valResolver_0001, "Root0002", null, Lifetime.Transient); + OnNewRoot(valResolver_0001, "Root2", null, Lifetime.Transient); Resolver.Value = valResolver_0001; _buckets = Buckets>.Create( 4, @@ -212,7 +214,7 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.Root0001; + return composition.Root1; default: return base.ResolveByTag(composition, tag); @@ -224,7 +226,7 @@ partial class Composition { public override IService Resolve(Composition composition) { - return composition.Root0002; + return composition.Root2; } public override IService ResolveByTag(Composition composition, object tag) @@ -232,7 +234,7 @@ partial class Composition switch (tag) { case null: - return composition.Root0002; + return composition.Root2; default: return base.ResolveByTag(composition, tag); diff --git a/readme/service-provider-with-scope.md b/readme/service-provider-with-scope.md index 8ccc11f7e..53543cb38 100644 --- a/readme/service-provider-with-scope.md +++ b/readme/service-provider-with-scope.md @@ -79,8 +79,8 @@ partial class Composition: IDisposable private readonly object _lock; private object[] _disposables; private int _disposeIndex; - private Dependency? _singleton36_Dependency; - private Service? _scoped37_Service; + private Dependency? _singletonDependency36; + private Service? _scopedService37; public Composition() { @@ -96,46 +96,49 @@ partial class Composition: IDisposable _disposables = new object[1]; } - private IDependency Root0001 + private IDependency Root1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return _root._singleton36_Dependency!; + + return _root._singletonDependency36!; } } - private IService Root0002 + private IService Root2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scoped37_Service == null) + if (_scopedService37 == null) { lock (_lock) { - if (_scoped37_Service == null) + if (_scopedService37 == null) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } - _scoped37_Service = new Service(_root._singleton36_Dependency!); - _disposables[_disposeIndex++] = _scoped37_Service; + + _scopedService37 = new Service(_root._singletonDependency36!); + _disposables[_disposeIndex++] = _scopedService37; } } } - return _scoped37_Service!; + + return _scopedService37!; } } @@ -209,8 +212,8 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singleton36_Dependency = null; - _scoped37_Service = null; + _singletonDependency36 = null; + _scopedService37 = null; } while (disposeIndex-- > 0) @@ -274,7 +277,7 @@ partial class Composition: IDisposable { public override IDependency Resolve(Composition composition) { - return composition.Root0001; + return composition.Root1; } public override IDependency ResolveByTag(Composition composition, object tag) @@ -282,7 +285,7 @@ partial class Composition: IDisposable switch (tag) { case null: - return composition.Root0001; + return composition.Root1; default: return base.ResolveByTag(composition, tag); @@ -294,7 +297,7 @@ partial class Composition: IDisposable { public override IService Resolve(Composition composition) { - return composition.Root0002; + return composition.Root2; } public override IService ResolveByTag(Composition composition, object tag) @@ -302,7 +305,7 @@ partial class Composition: IDisposable switch (tag) { case null: - return composition.Root0002; + return composition.Root2; default: return base.ResolveByTag(composition, tag); diff --git a/readme/service-provider.md b/readme/service-provider.md index 0c97afb2f..f5e70a67f 100644 --- a/readme/service-provider.md +++ b/readme/service-provider.md @@ -47,7 +47,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -61,41 +61,43 @@ partial class Composition _lock = _root._lock; } - private IDependency Root0001 + private IDependency Root1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return _root._singleton36_Dependency!; + + return _root._singletonDependency36!; } } - private IService Root0002 + private IService Root2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return new Service(_root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!); } } @@ -200,7 +202,7 @@ partial class Composition { public override IDependency Resolve(Composition composition) { - return composition.Root0001; + return composition.Root1; } public override IDependency ResolveByTag(Composition composition, object tag) @@ -208,7 +210,7 @@ partial class Composition switch (tag) { case null: - return composition.Root0001; + return composition.Root1; default: return base.ResolveByTag(composition, tag); @@ -220,7 +222,7 @@ partial class Composition { public override IService Resolve(Composition composition) { - return composition.Root0002; + return composition.Root2; } public override IService ResolveByTag(Composition composition, object tag) @@ -228,7 +230,7 @@ partial class Composition switch (tag) { case null: - return composition.Root0002; + return composition.Root2; default: return base.ResolveByTag(composition, tag); diff --git a/readme/simplified-binding.md b/readme/simplified-binding.md index 738f217db..e1ae8d925 100644 --- a/readme/simplified-binding.md +++ b/readme/simplified-binding.md @@ -79,8 +79,8 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Dependency perBlock1_Dependency = new Dependency(); - return new Service(perBlock1_Dependency, perBlock1_Dependency, perBlock1_Dependency); + Dependency perBlockDependency1 = new Dependency(); + return new Service(perBlockDependency1, perBlockDependency1, perBlockDependency1); } } } diff --git a/readme/singleton.md b/readme/singleton.md index 4611301c5..0f6a35da1 100644 --- a/readme/singleton.md +++ b/readme/singleton.md @@ -47,7 +47,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private Dependency? _singleton36_Dependency; + private Dependency? _singletonDependency36; public Composition() { @@ -66,17 +66,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { lock (_lock) { - if (_root._singleton36_Dependency == null) + if (_root._singletonDependency36 == null) { - _root._singleton36_Dependency = new Dependency(); + _root._singletonDependency36 = new Dependency(); } } } - return new Service(_root._singleton36_Dependency!, _root._singleton36_Dependency!); + + return new Service(_root._singletonDependency36!, _root._singletonDependency36!); } } } diff --git a/readme/span-and-readonlyspan.md b/readme/span-and-readonlyspan.md index 82e9bc8ea..0173b865b 100644 --- a/readme/span-and-readonlyspan.md +++ b/readme/span-and-readonlyspan.md @@ -66,13 +66,13 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ReadOnlySpan transient1_ReadOnlySpan = stackalloc Dependency[3] + ReadOnlySpan transientReadOnlySpan1 = stackalloc Dependency[3] { new Dependency(), new Dependency(), new Dependency() }; - return new Service(transient1_ReadOnlySpan); + return new Service(transientReadOnlySpan1); } } diff --git a/readme/tag-type.md b/readme/tag-type.md index 7644dae4b..cf0c27cfb 100644 --- a/readme/tag-type.md +++ b/readme/tag-type.md @@ -62,7 +62,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private XyzDependency? _singleton37_XyzDependency; + private XyzDependency? _singletonXyzDependency37; public Composition() { @@ -81,17 +81,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { lock (_lock) { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { - _root._singleton37_XyzDependency = new XyzDependency(); + _root._singletonXyzDependency37 = new XyzDependency(); } } } - return _root._singleton37_XyzDependency!; + + return _root._singletonXyzDependency37!; } } @@ -100,17 +101,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { lock (_lock) { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { - _root._singleton37_XyzDependency = new XyzDependency(); + _root._singletonXyzDependency37 = new XyzDependency(); } } } - return new Service(new AbcDependency(), _root._singleton37_XyzDependency!, new AbcDependency()); + + return new Service(new AbcDependency(), _root._singletonXyzDependency37!, new AbcDependency()); } } diff --git a/readme/tag-unique.md b/readme/tag-unique.md index 59d37c9db..ee241d9b8 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -59,13 +59,14 @@ partial class Composition get { [MethodImpl(MethodImplOptions.AggressiveInlining)] - IEnumerable> EnumerationOf_perBlock1_IEnumerable() + IEnumerable> EnumerationOf_perBlockIEnumerable1() { yield return new AbcDependency(); yield return new XyzDependency(); } - IEnumerable> perBlock1_IEnumerable = EnumerationOf_perBlock1_IEnumerable(); - return new Service(perBlock1_IEnumerable); + + IEnumerable> perBlockIEnumerable1 = EnumerationOf_perBlockIEnumerable1(); + return new Service(perBlockIEnumerable1); } } diff --git a/readme/tags.md b/readme/tags.md index c41567ade..5fbef1a07 100644 --- a/readme/tags.md +++ b/readme/tags.md @@ -66,7 +66,7 @@ partial class Composition { private readonly Composition _root; private readonly object _lock; - private XyzDependency? _singleton37_XyzDependency; + private XyzDependency? _singletonXyzDependency37; public Composition() { @@ -85,17 +85,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { lock (_lock) { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { - _root._singleton37_XyzDependency = new XyzDependency(); + _root._singletonXyzDependency37 = new XyzDependency(); } } } - return _root._singleton37_XyzDependency!; + + return _root._singletonXyzDependency37!; } } @@ -104,17 +105,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { lock (_lock) { - if (_root._singleton37_XyzDependency == null) + if (_root._singletonXyzDependency37 == null) { - _root._singleton37_XyzDependency = new XyzDependency(); + _root._singletonXyzDependency37 = new XyzDependency(); } } } - return new Service(new AbcDependency(), _root._singleton37_XyzDependency!, new AbcDependency()); + + return new Service(new AbcDependency(), _root._singletonXyzDependency37!, new AbcDependency()); } } } diff --git a/readme/task.md b/readme/task.md index a4b01edbf..51fcc8478 100644 --- a/readme/task.md +++ b/readme/task.md @@ -81,32 +81,34 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] public IService GetRoot(CancellationToken cancellationToken) { - var perResolve42_Func = default(Func); - TaskScheduler transient5_TaskScheduler = TaskScheduler.Current; - TaskContinuationOptions transient4_TaskContinuationOptions = TaskContinuationOptions.None; - TaskCreationOptions transient3_TaskCreationOptions = TaskCreationOptions.None; - TaskFactory perBlock2_TaskFactory; + var perResolveFunc42 = default(Func); + TaskScheduler transientTaskScheduler5 = TaskScheduler.Current; + TaskContinuationOptions transientTaskContinuationOptions4 = TaskContinuationOptions.None; + TaskCreationOptions transientTaskCreationOptions3 = TaskCreationOptions.None; + TaskFactory perBlockTaskFactory2; { - var cancellationToken_0 = cancellationToken; - var taskCreationOptions_1 = transient3_TaskCreationOptions; - var taskContinuationOptions_2 = transient4_TaskContinuationOptions; - var taskScheduler_3 = transient5_TaskScheduler; - perBlock2_TaskFactory = new TaskFactory(cancellationToken_0, taskCreationOptions_1, taskContinuationOptions_2, taskScheduler_3); + var localCancellationToken0 = cancellationToken; + var localTaskCreationOptions1 = transientTaskCreationOptions3; + var localTaskContinuationOptions2 = transientTaskContinuationOptions4; + var localTaskScheduler3 = transientTaskScheduler5; + perBlockTaskFactory2 = new TaskFactory(localCancellationToken0, localTaskCreationOptions1, localTaskContinuationOptions2, localTaskScheduler3); } - perResolve42_Func = new Func( + + perResolveFunc42 = new Func( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var value_4 = new Dependency(); - return value_4; + var localValue4 = new Dependency(); + return localValue4; }); - Task transient1_Task; + Task transientTask1; { - var factory_5 = perResolve42_Func!; - var taskFactory_6 = perBlock2_TaskFactory; - transient1_Task = taskFactory_6.StartNew(factory_5); + var localFactory5 = perResolveFunc42!; + var localTaskFactory6 = perBlockTaskFactory2; + transientTask1 = localTaskFactory6.StartNew(localFactory5); } - return new Service(transient1_Task); + + return new Service(transientTask1); } } ``` diff --git a/readme/tracking-async-disposable-instances-in-delegates.md b/readme/tracking-async-disposable-instances-in-delegates.md index bf937137d..7b2761cf2 100644 --- a/readme/tracking-async-disposable-instances-in-delegates.md +++ b/readme/tracking-async-disposable-instances-in-delegates.md @@ -95,31 +95,34 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve39_Func = default(Func>); - perResolve39_Func = new Func>( + var perResolveFunc39 = default(Func>); + perResolveFunc39 = new Func>( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { var accumulator38 = new Owned(); - Dependency transient3_Dependency = new Dependency(); + Dependency transientDependency3 = new Dependency(); lock (_lock) { - accumulator38.Add(transient3_Dependency); + accumulator38.Add(transientDependency3); } - Owned perBlock1_Owned; + + Owned perBlockOwned1; { - var owned_1 = accumulator38; - var value_2 = transient3_Dependency; - perBlock1_Owned = new Owned(value_2, owned_1); + var localOwned1 = accumulator38; + var localValue2 = transientDependency3; + perBlockOwned1 = new Owned(localValue2, localOwned1); } + lock (_lock) { - accumulator38.Add(perBlock1_Owned); + accumulator38.Add(perBlockOwned1); } - var value_0 = perBlock1_Owned; - return value_0; + + var localValue0 = perBlockOwned1; + return localValue0; }); - return new Service(perResolve39_Func!); + return new Service(perResolveFunc39!); } } 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 4c4b11543..3e38882a0 100644 --- a/readme/tracking-async-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-async-disposable-instances-per-a-composition-root.md @@ -89,22 +89,25 @@ partial class Composition get { var accumulator38 = new Owned(); - Dependency transient3_Dependency = new Dependency(); + Dependency transientDependency3 = new Dependency(); lock (_lock) { - accumulator38.Add(transient3_Dependency); + accumulator38.Add(transientDependency3); } - Owned perBlock0_Owned; + + Owned perBlockOwned0; { - var owned_0 = accumulator38; - var value_1 = new Service(transient3_Dependency); - perBlock0_Owned = new Owned(value_1, owned_0); + var localOwned0 = accumulator38; + var localValue1 = new Service(transientDependency3); + perBlockOwned0 = new Owned(localValue1, localOwned0); } + lock (_lock) { - accumulator38.Add(perBlock0_Owned); + accumulator38.Add(perBlockOwned0); } - return perBlock0_Owned; + + return perBlockOwned0; } } diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index 4a87e8c56..12e1c4209 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -88,31 +88,34 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolve39_Func = default(Func>); - perResolve39_Func = new Func>( + var perResolveFunc39 = default(Func>); + perResolveFunc39 = new Func>( [MethodImpl(MethodImplOptions.AggressiveInlining)] () => { var accumulator38 = new Owned(); - Dependency transient3_Dependency = new Dependency(); + Dependency transientDependency3 = new Dependency(); lock (_lock) { - accumulator38.Add(transient3_Dependency); + accumulator38.Add(transientDependency3); } - Owned perBlock1_Owned; + + Owned perBlockOwned1; { - var owned_1 = accumulator38; - var value_2 = transient3_Dependency; - perBlock1_Owned = new Owned(value_2, owned_1); + var localOwned1 = accumulator38; + var localValue2 = transientDependency3; + perBlockOwned1 = new Owned(localValue2, localOwned1); } + lock (_lock) { - accumulator38.Add(perBlock1_Owned); + accumulator38.Add(perBlockOwned1); } - var value_0 = perBlock1_Owned; - return value_0; + + var localValue0 = perBlockOwned1; + return localValue0; }); - return new Service(perResolve39_Func!); + return new Service(perResolveFunc39!); } } diff --git a/readme/tracking-disposable-instances-per-a-composition-root.md b/readme/tracking-disposable-instances-per-a-composition-root.md index 8ded15db4..32eb80c5b 100644 --- a/readme/tracking-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-disposable-instances-per-a-composition-root.md @@ -85,22 +85,25 @@ partial class Composition get { var accumulator38 = new Owned(); - Dependency transient3_Dependency = new Dependency(); + Dependency transientDependency3 = new Dependency(); lock (_lock) { - accumulator38.Add(transient3_Dependency); + accumulator38.Add(transientDependency3); } - Owned perBlock0_Owned; + + Owned perBlockOwned0; { - var owned_0 = accumulator38; - var value_1 = new Service(transient3_Dependency); - perBlock0_Owned = new Owned(value_1, owned_0); + var localOwned0 = accumulator38; + var localValue1 = new Service(transientDependency3); + perBlockOwned0 = new Owned(localValue1, localOwned0); } + lock (_lock) { - accumulator38.Add(perBlock0_Owned); + accumulator38.Add(perBlockOwned0); } - return perBlock0_Owned; + + return perBlockOwned0; } } diff --git a/readme/tuple.md b/readme/tuple.md index f9224a089..2d867bc1b 100644 --- a/readme/tuple.md +++ b/readme/tuple.md @@ -56,8 +56,8 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Point transient2_Point = new Point(7, 9); - return new Service((transient2_Point, new Dependency())); + Point transientPoint2 = new Point(7, 9); + return new Service((transientPoint2, new Dependency())); } } diff --git a/readme/valuetask.md b/readme/valuetask.md index 1d8fa1dfb..176a6c09f 100644 --- a/readme/valuetask.md +++ b/readme/valuetask.md @@ -62,12 +62,13 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ValueTask transient1_ValueTask; + ValueTask transientValueTask1; { - var value_0 = new Dependency(); - transient1_ValueTask = new ValueTask(value_0); + var localValue0 = new Dependency(); + transientValueTask1 = new ValueTask(localValue0); } - return new Service(transient1_ValueTask); + + return new Service(transientValueTask1); } } diff --git a/src/Pure.DI.Core/Core/Code/ApiMembersBuilder.cs b/src/Pure.DI.Core/Core/Code/ApiMembersBuilder.cs index c45f1ff42..5c8624b73 100644 --- a/src/Pure.DI.Core/Core/Code/ApiMembersBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/ApiMembersBuilder.cs @@ -26,7 +26,7 @@ public CompositionCode Build(CompositionCode composition) } buildTools.AddPureHeader(apiCode); - apiCode.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + apiCode.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); apiCode.AppendLine($"{hints.ResolveMethodModifiers} T {hints.ResolveMethodName}()"); apiCode.AppendLine("{"); using (apiCode.Indent()) @@ -49,7 +49,7 @@ public CompositionCode Build(CompositionCode composition) } buildTools.AddPureHeader(apiCode); - apiCode.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + apiCode.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); apiCode.AppendLine($"{hints.ResolveByTagMethodModifiers} T {hints.ResolveByTagMethodName}(object{nullable} tag)"); apiCode.AppendLine("{"); using (apiCode.Indent()) @@ -174,7 +174,7 @@ private void CreateObjectResolverMethod( LinesBuilder code) { buildTools.AddPureHeader(code); - code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); code.AppendLine($"{methodModifiers} object {methodName}({methodArgs})"); code.AppendLine("{"); using (code.Indent()) @@ -202,7 +202,7 @@ private static void CreateObjectConflictsResolverMethod( bool byTag, LinesBuilder code) { - code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x8)]"); + code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})8)]"); code.AppendLine($"private object Resolve{Names.Salt}({methodArgs}, int index)"); code.AppendLine("{"); using (code.Indent()) diff --git a/src/Pure.DI.Core/Core/Code/BlockCodeBuilder.cs b/src/Pure.DI.Core/Core/Code/BlockCodeBuilder.cs index 452141a0e..955da310e 100644 --- a/src/Pure.DI.Core/Core/Code/BlockCodeBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/BlockCodeBuilder.cs @@ -127,7 +127,7 @@ variable.Node.Lifetime is Lifetime.Singleton or Lifetime.Scoped var localMethodCode = ctx.LocalFunctionsCode; if (variable.Node.Binding.SemanticModel.Compilation.GetLanguageVersion() >= LanguageVersion.CSharp9) { - localMethodCode.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + localMethodCode.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); } localMethodCode.AppendLine($"void {localMethodName}()"); diff --git a/src/Pure.DI.Core/Core/Code/ConstructCodeBuilder.cs b/src/Pure.DI.Core/Core/Code/ConstructCodeBuilder.cs index cd5136f77..88908b53c 100644 --- a/src/Pure.DI.Core/Core/Code/ConstructCodeBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/ConstructCodeBuilder.cs @@ -53,7 +53,7 @@ private void BuildEnumerable(BuildContext ctx, in DpConstruct enumerable, string var localMethodName = $"{Names.EnumerateMethodNamePrefix}_{variable.VariableDeclarationName}".Replace("__", "_"); if (enumerable.Source.SemanticModel.Compilation.GetLanguageVersion() >= LanguageVersion.CSharp9) { - code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); } code.AppendLine($"{methodPrefix}{typeResolver.Resolve(variable.InstanceType)} {localMethodName}()"); diff --git a/src/Pure.DI.Core/Core/Code/FactoryRewriter.cs b/src/Pure.DI.Core/Core/Code/FactoryRewriter.cs index 93b12bd8d..54d8ed5a7 100644 --- a/src/Pure.DI.Core/Core/Code/FactoryRewriter.cs +++ b/src/Pure.DI.Core/Core/Code/FactoryRewriter.cs @@ -17,7 +17,7 @@ internal sealed class FactoryRewriter( SyntaxFactory.AttributeArgument( SyntaxFactory.CastExpression( SyntaxFactory.ParseTypeName(Names.MethodImplOptions), - SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(0x100))))))) + SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(256))))))) .WithTrailingTrivia(SyntaxTriviaList.Create(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, " "))); private static readonly IdentifierNameSyntax InjectionMarkerExpression = SyntaxFactory.IdentifierName(Names.InjectionMarker); diff --git a/src/Pure.DI.Core/Core/Code/LocalVariableRenamingRewriter.cs b/src/Pure.DI.Core/Core/Code/LocalVariableRenamingRewriter.cs index b2551da32..8c7276d85 100644 --- a/src/Pure.DI.Core/Core/Code/LocalVariableRenamingRewriter.cs +++ b/src/Pure.DI.Core/Core/Code/LocalVariableRenamingRewriter.cs @@ -36,7 +36,7 @@ private string GetUniqueName(string name) { if (!_identifierNames.TryGetValue(name, out var newName)) { - newName = $"{name}_{Names.Salt}{idGenerator.Generate()}"; + newName = $"{Names.LocalVariablePrefix}{name.ToTitleCase()}{Names.Salt}{idGenerator.Generate()}"; _identifierNames.Add(name, newName); } diff --git a/src/Pure.DI.Core/Core/Code/RootMethodsBuilder.cs b/src/Pure.DI.Core/Core/Code/RootMethodsBuilder.cs index b82894ffd..2b88f95e1 100644 --- a/src/Pure.DI.Core/Core/Code/RootMethodsBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/RootMethodsBuilder.cs @@ -86,7 +86,7 @@ private void BuildRoot(CompositionCode composition, Root root) name.Append(rootArgsStr); if (root.IsMethod) { - code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); } code.AppendLine(name.ToString()); @@ -145,7 +145,7 @@ private void BuildRoot(CompositionCode composition, Root root) if (!root.IsMethod) { buildTools.AddPureHeader(code); - code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})0x100)]"); + code.AppendLine($"[{Names.MethodImplAttribute}(({Names.MethodImplOptions})256)]"); code.AppendLine("get"); code.AppendLine("{"); indentToken = code.Indent(); @@ -158,7 +158,7 @@ private void BuildRoot(CompositionCode composition, Root root) var codeText = string.Join(Environment.NewLine, root.Lines); var syntaxTree = CSharpSyntaxTree.ParseText(codeText); codeText = syntaxTree.GetRoot().NormalizeWhitespace().ToString(); - var lines = codeText.Split(NewLineSeparators, StringSplitOptions.RemoveEmptyEntries); + var lines = codeText.Split(NewLineSeparators, StringSplitOptions.None); foreach (var line in lines) { code.AppendLine(line); diff --git a/src/Pure.DI.Core/Core/Names.cs b/src/Pure.DI.Core/Core/Names.cs index 7073c6b51..39c31f836 100644 --- a/src/Pure.DI.Core/Core/Names.cs +++ b/src/Pure.DI.Core/Core/Names.cs @@ -67,41 +67,50 @@ internal static class Names private const string SingletonVariablePrefix = "_singleton"; private const string ScopedVariablePrefix = "_scoped"; private const string ArgVariablePrefix = "_arg"; + public const string LocalVariablePrefix = "local"; public static string GetVariableName(this DependencyNode Node, int PerLifetimeId) { - var baseName = Node.Type.Name; + var baseName = Node.Type.Name.ToTitleCase(); switch (Node) { case { Lifetime: Lifetime.Singleton }: { var binding = Node.Binding; - return $"{SingletonVariablePrefix}{Salt}{binding.Id}_{baseName}"; + return $"{SingletonVariablePrefix}{baseName}{Salt}{binding.Id}"; } case { Lifetime: Lifetime.Scoped }: { var binding = Node.Binding; - return $"{ScopedVariablePrefix}{Salt}{binding.Id}_{baseName}"; + return $"{ScopedVariablePrefix}{baseName}{Salt}{binding.Id}"; } case { Lifetime: Lifetime.PerResolve }: - return $"{PerResolveVariablePrefix}{Salt}{PerLifetimeId}_{baseName}"; + return $"{PerResolveVariablePrefix}{baseName}{Salt}{PerLifetimeId}"; case { Arg: { Source.Kind: ArgKind.Class } arg }: - return $"{ArgVariablePrefix}{Salt}_{arg.Source.ArgName}"; + return $"{ArgVariablePrefix}{ToTitleCase(arg.Source.ArgName)}{Salt}"; case { Arg: { Source.Kind: ArgKind.Root } arg }: return arg.Source.ArgName; case { Lifetime: Lifetime.PerBlock }: - return $"{PerBlockVariablePrefix}{Salt}{PerLifetimeId}_{baseName}"; + return $"{PerBlockVariablePrefix}{baseName}{Salt}{PerLifetimeId}"; default: - return $"{TransientVariablePrefix}{Salt}{PerLifetimeId}_{baseName}"; + return $"{TransientVariablePrefix}{baseName}{Salt}{PerLifetimeId}"; } } public static string GetPropertyName(this Root root) => - root.IsPublic ? root.Name : $"Root{Salt}{root.Index:0000}"; + root.IsPublic ? root.Name : $"Root{Salt}{root.Index}"; + + public static string ToTitleCase(this string title) + { + return new string(title + .Where(i => i != '@') + .Select((ch, index) => index == 0 ? char.ToUpper(ch) : ch) + .ToArray()); + } } \ No newline at end of file diff --git a/src/Pure.DI.MS/any/Pure.DI/MS/ServiceProviderFactory.g.cs b/src/Pure.DI.MS/any/Pure.DI/MS/ServiceProviderFactory.g.cs index cd14c8420..c50f242e7 100644 --- a/src/Pure.DI.MS/any/Pure.DI/MS/ServiceProviderFactory.g.cs +++ b/src/Pure.DI.MS/any/Pure.DI/MS/ServiceProviderFactory.g.cs @@ -75,14 +75,14 @@ private static void HintsSetup() => #if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET [global::System.Diagnostics.Contracts.Pure] #endif - [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)256)] protected static IServiceCollection CreateServiceCollection(TComposition composition) { return ServiceCollectionFactory.CreateServiceCollection(composition); } /// - [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)256)] public IServiceCollection CreateBuilder(IServiceCollection services) { // Registers composition roots as services in the service collection. @@ -110,7 +110,7 @@ public IServiceProvider CreateServiceProvider(IServiceCollection services) /// Dependency resolution lifetime. /// Dependency resolution type. /// Resolved dependency instance. - [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)256)] protected T OnCannotResolve(object? tag, Lifetime lifetime) { return (T)(_serviceProvider ?? throw new InvalidOperationException("Not ready yet."))(typeof(T), tag) @@ -126,7 +126,7 @@ protected T OnCannotResolve(object? tag, Lifetime lifetime) /// The lifetime of the composition root. /// The contract type of the composition root. /// The implementation type of the composition root. - [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)256)] protected static void OnNewRoot( IResolver resolver, string name, object tag, Lifetime lifetime)