From 053fddc938b226a8b25ac3349b215b44203bad1f Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Thu, 28 Nov 2024 17:20:44 +0300 Subject: [PATCH] Update README.md --- README.md | 8 +++++ readme/ReadmeTemplate.md | 8 +++++ readme/SingletonDetails.md | 18 +++++------ readme/accumulators.md | 24 +++++++------- readme/async-disposable-scope.md | 16 +++++----- readme/async-disposable-singleton.md | 16 +++++----- readme/auto-scoped.md | 10 +++--- readme/bind-attribute-for-a-generic-type.md | 10 +++--- .../bind-attribute-with-lifetime-and-tag.md | 8 ++--- readme/bind-attribute.md | 10 +++--- readme/complex-generics.md | 14 ++++---- .../default-lifetime-for-a-type-and-a-tag.md | 18 +++++------ readme/default-lifetime-for-a-type.md | 10 +++--- readme/default-lifetime.md | 16 +++++----- readme/disposable-singleton.md | 14 ++++---- readme/exposed-generic-roots-with-args.md | 10 +++--- readme/exposed-generic-roots.md | 10 +++--- readme/exposed-roots-with-tags.md | 10 +++--- readme/exposed-roots.md | 10 +++--- readme/func-with-arguments.md | 10 +++--- readme/keyed-service-provider.md | 18 +++++------ readme/onnewinstance-hint.md | 16 +++++----- readme/perblock.md | 14 ++++---- readme/perresolve.md | 26 +++++++-------- readme/root-binding.md | 10 +++--- readme/scope.md | 14 ++++---- readme/service-collection.md | 18 +++++------ readme/service-provider-with-scope.md | 30 ++++++++--------- readme/service-provider.md | 18 +++++------ readme/singleton.md | 10 +++--- readme/tag-type.md | 18 +++++------ readme/tags.md | 18 +++++------ readme/threadsafe-hint.md | 8 ++--- ...async-disposable-instances-in-delegates.md | 12 +++---- ...osable-instances-per-a-composition-root.md | 8 ++--- ...cking-disposable-instances-in-delegates.md | 12 +++---- ...osable-instances-per-a-composition-root.md | 8 ++--- ...sable-instances-using-pre-built-classes.md | 32 +++++++++---------- ...able-instances-with-different-lifetimes.md | 32 +++++++++---------- 39 files changed, 294 insertions(+), 278 deletions(-) diff --git a/README.md b/README.md index ad40b065..c4d6554e 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,14 @@ DI.Setup(nameof(Composition)) > [!NOTE] > In fact, the `Bind().As(Singleton).To()` binding is unnecessary since _Pure.DI_ supports many .NET BCL types out of the box, including [Random](https://github.com/DevTeam/Pure.DI/blob/27a1ccd604b2fdd55f6bfec01c24c86428ddfdcb/src/Pure.DI.Core/Features/Default.g.cs#L289). It was added just for the example of using the _Singleton_ lifetime. +The Pure.DI source code generator works like this: + +```mermaid +flowchart TD + setups[DI setups analysis] --> types["`Types analysis + constructors/methods/properties/fields`"] --> deps[Creating a dependency graph] --> verification[Dependency graph verification] --> code[Code generation] +``` + The above code specifies the generation of a partial class named *__Composition__*, this name is defined in the `DI.Setup(nameof(Composition))` call. This class contains a *__Root__* property that returns a graph of objects with an object of type *__Program__* as the root. The type and name of the property is defined by calling `Root("Root")`. The code of the generated class looks as follows: ```c# diff --git a/readme/ReadmeTemplate.md b/readme/ReadmeTemplate.md index 61cdff14..5aab452d 100644 --- a/readme/ReadmeTemplate.md +++ b/readme/ReadmeTemplate.md @@ -62,6 +62,14 @@ DI.Setup(nameof(Composition)) > [!NOTE] > In fact, the `Bind().As(Singleton).To()` binding is unnecessary since _Pure.DI_ supports many .NET BCL types out of the box, including [Random](https://github.com/DevTeam/Pure.DI/blob/27a1ccd604b2fdd55f6bfec01c24c86428ddfdcb/src/Pure.DI.Core/Features/Default.g.cs#L289). It was added just for the example of using the _Singleton_ lifetime. +The Pure.DI source code generator works like this: + +```mermaid +flowchart TD + setups[DI setups analysis] --> types["`Types analysis + constructors/methods/properties/fields`"] --> deps[Creating a dependency graph] --> verification[Dependency graph verification] --> code[Code generation] +``` + The above code specifies the generation of a partial class named *__Composition__*, this name is defined in the `DI.Setup(nameof(Composition))` call. This class contains a *__Root__* property that returns a graph of objects with an object of type *__Program__* as the root. The type and name of the property is defined by calling `Root("Root")`. The code of the generated class looks as follows: ```c# diff --git a/readme/SingletonDetails.md b/readme/SingletonDetails.md index 32fd8351..7804c380 100644 --- a/readme/SingletonDetails.md +++ b/readme/SingletonDetails.md @@ -60,8 +60,8 @@ partial class Singleton { private readonly Singleton _root; - private Service1? _scopedService139; - private Service4? _scopedService442; + private Service1? _scopedService141; + private Service4? _scopedService444; [OrdinalAttribute(20)] public Singleton() @@ -77,22 +77,22 @@ partial class Singleton [MethodImpl(MethodImplOptions.AggressiveInlining)] public partial CompositionRoot TestPureDIByCR() { - if (_scopedService442 is null) + if (_scopedService444 is null) { - _scopedService442 = new Service4(); + _scopedService444 = new Service4(); } - if (_scopedService139 is null) + if (_scopedService141 is null) { - if (_scopedService442 is null) + if (_scopedService444 is null) { - _scopedService442 = new Service4(); + _scopedService444 = new Service4(); } - _scopedService139 = new Service1(new Service2(new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!))); + _scopedService141 = new Service1(new Service2(new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!))); } - return new CompositionRoot(_scopedService139!, new Service2(new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!)), new Service2(new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!)), new Service2(new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!), new Service3(_scopedService442!, _scopedService442!)), new Service3(_scopedService442!, _scopedService442!), _scopedService442!, _scopedService442!); + return new CompositionRoot(_scopedService141!, new Service2(new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!)), new Service2(new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!)), new Service2(new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!), new Service3(_scopedService444!, _scopedService444!)), new Service3(_scopedService444!, _scopedService444!), _scopedService444!, _scopedService444!); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/readme/accumulators.md b/readme/accumulators.md index 483220c1..ce3a9af6 100644 --- a/readme/accumulators.md +++ b/readme/accumulators.md @@ -49,7 +49,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private XyzDependency? _singletonXyzDependency43; + private XyzDependency? _singletonXyzDependency45; [OrdinalAttribute(20)] public Composition() @@ -69,19 +69,19 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator46 = new MyAccumulator(); + var accumulator48 = new MyAccumulator(); AbcDependency perBlockAbcDependency4 = new AbcDependency(); - if (_root._singletonXyzDependency43 is null) + if (_root._singletonXyzDependency45 is null) { using (_lock.EnterScope()) { - if (_root._singletonXyzDependency43 is null) + if (_root._singletonXyzDependency45 is null) { - XyzDependency _singletonXyzDependency43Temp; - _singletonXyzDependency43Temp = new XyzDependency(); - accumulator46.Add(_singletonXyzDependency43Temp); + XyzDependency _singletonXyzDependency45Temp; + _singletonXyzDependency45Temp = new XyzDependency(); + accumulator48.Add(_singletonXyzDependency45Temp); Thread.MemoryBarrier(); - _root._singletonXyzDependency43 = _singletonXyzDependency43Temp; + _root._singletonXyzDependency45 = _singletonXyzDependency45Temp; } } } @@ -89,14 +89,14 @@ partial class Composition AbcDependency transientAbcDependency3 = new AbcDependency(); using (_lock.EnterScope()) { - accumulator46.Add(transientAbcDependency3); + accumulator48.Add(transientAbcDependency3); } - Service transientService1 = new Service(transientAbcDependency3, _root._singletonXyzDependency43!, perBlockAbcDependency4); + Service transientService1 = new Service(transientAbcDependency3, _root._singletonXyzDependency45!, perBlockAbcDependency4); using (_lock.EnterScope()) { - accumulator46.Add(transientService1); + accumulator48.Add(transientService1); } - return (transientService1, accumulator46); + return (transientService1, accumulator48); } } diff --git a/readme/async-disposable-scope.md b/readme/async-disposable-scope.md index 4bf3a035..0e4154e6 100644 --- a/readme/async-disposable-scope.md +++ b/readme/async-disposable-scope.md @@ -93,7 +93,7 @@ partial class Composition: IDisposable, IAsyncDisposable private object[] _disposables; private int _disposeIndex; - private Dependency? _scopedDependency41; + private Dependency? _scopedDependency43; [OrdinalAttribute(20)] public Composition() @@ -115,19 +115,19 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scopedDependency41 is null) + if (_scopedDependency43 is null) { using (_lock.EnterScope()) { - if (_scopedDependency41 is null) + if (_scopedDependency43 is null) { - _scopedDependency41 = new Dependency(); - _disposables[_disposeIndex++] = _scopedDependency41; + _scopedDependency43 = new Dependency(); + _disposables[_disposeIndex++] = _scopedDependency43; } } } - return new Service(_scopedDependency41!); + return new Service(_scopedDependency43!); } } @@ -156,7 +156,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scopedDependency41 = null; + _scopedDependency43 = null; } while (disposeIndex-- > 0) @@ -194,7 +194,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scopedDependency41 = null; + _scopedDependency43 = null; } finally { diff --git a/readme/async-disposable-singleton.md b/readme/async-disposable-singleton.md index 9388bcc4..ad65f332 100644 --- a/readme/async-disposable-singleton.md +++ b/readme/async-disposable-singleton.md @@ -59,7 +59,7 @@ partial class Composition: IDisposable, IAsyncDisposable private object[] _disposables; private int _disposeIndex; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -81,19 +81,19 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); - _root._disposables[_root._disposeIndex++] = _root._singletonDependency41; + _root._singletonDependency43 = new Dependency(); + _root._disposables[_root._disposeIndex++] = _root._singletonDependency43; } } } - return new Service(_root._singletonDependency41!); + return new Service(_root._singletonDependency43!); } } @@ -107,7 +107,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singletonDependency41 = null; + _singletonDependency43 = null; } while (disposeIndex-- > 0) @@ -145,7 +145,7 @@ partial class Composition: IDisposable, IAsyncDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singletonDependency41 = null; + _singletonDependency43 = null; } finally { diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index bb997371..a573d349 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -75,7 +75,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _scopedDependency41; + private Dependency? _scopedDependency43; [OrdinalAttribute(20)] public Composition() @@ -116,18 +116,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scopedDependency41 is null) + if (_scopedDependency43 is null) { using (_lock.EnterScope()) { - if (_scopedDependency41 is null) + if (_scopedDependency43 is null) { - _scopedDependency41 = new Dependency(); + _scopedDependency43 = new Dependency(); } } } - return new Service(_scopedDependency41!); + return new Service(_scopedDependency43!); } } } diff --git a/readme/bind-attribute-for-a-generic-type.md b/readme/bind-attribute-for-a-generic-type.md index c9d2955c..cab8273d 100644 --- a/readme/bind-attribute-for-a-generic-type.md +++ b/readme/bind-attribute-for-a-generic-type.md @@ -52,7 +52,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Facade? _singletonFacade41; + private Facade? _singletonFacade43; [OrdinalAttribute(20)] public Composition() @@ -72,19 +72,19 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonFacade41 is null) + if (_root._singletonFacade43 is null) { using (_lock.EnterScope()) { - if (_root._singletonFacade41 is null) + if (_root._singletonFacade43 is null) { - _root._singletonFacade41 = new Facade(); + _root._singletonFacade43 = new Facade(); } } } IDependency transientIDependency1; - Facade localInstance_1182D12736 = _root._singletonFacade41!; + Facade localInstance_1182D12736 = _root._singletonFacade43!; transientIDependency1 = localInstance_1182D12736.GetDependency(); return new Service(transientIDependency1); } diff --git a/readme/bind-attribute-with-lifetime-and-tag.md b/readme/bind-attribute-with-lifetime-and-tag.md index 0964a764..41c80f81 100644 --- a/readme/bind-attribute-with-lifetime-and-tag.md +++ b/readme/bind-attribute-with-lifetime-and-tag.md @@ -53,7 +53,7 @@ partial class Composition private readonly Lock _lock; private IDependency? _singletonIDependency0; - private Facade? _singletonFacade41; + private Facade? _singletonFacade43; [OrdinalAttribute(20)] public Composition() @@ -79,12 +79,12 @@ partial class Composition { if (_root._singletonIDependency0 is null) { - if (_root._singletonFacade41 is null) + if (_root._singletonFacade43 is null) { - _root._singletonFacade41 = new Facade(); + _root._singletonFacade43 = new Facade(); } - Facade localInstance_1182D12738 = _root._singletonFacade41!; + Facade localInstance_1182D12738 = _root._singletonFacade43!; _root._singletonIDependency0 = localInstance_1182D12738.Dependency; } } diff --git a/readme/bind-attribute.md b/readme/bind-attribute.md index 7887cbf1..d2288934 100644 --- a/readme/bind-attribute.md +++ b/readme/bind-attribute.md @@ -56,7 +56,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Facade? _singletonFacade41; + private Facade? _singletonFacade43; [OrdinalAttribute(20)] public Composition() @@ -76,19 +76,19 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonFacade41 is null) + if (_root._singletonFacade43 is null) { using (_lock.EnterScope()) { - if (_root._singletonFacade41 is null) + if (_root._singletonFacade43 is null) { - _root._singletonFacade41 = new Facade(); + _root._singletonFacade43 = new Facade(); } } } IDependency transientIDependency1; - Facade localInstance_1182D12737 = _root._singletonFacade41!; + Facade localInstance_1182D12737 = _root._singletonFacade43!; transientIDependency1 = localInstance_1182D12737.Dependency; return new Service(transientIDependency1); } diff --git a/readme/complex-generics.md b/readme/complex-generics.md index 9e909ec4..ece7cd08 100644 --- a/readme/complex-generics.md +++ b/readme/complex-generics.md @@ -74,8 +74,8 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private DependencyStruct _singletonDependencyStruct49; - private bool _singletonDependencyStruct49Created; + private DependencyStruct _singletonDependencyStruct51; + private bool _singletonDependencyStruct51Created; [OrdinalAttribute(10)] public Composition() @@ -94,20 +94,20 @@ partial class Composition public Program GetRoot(T1 depArg) where T1: notnull { - if (!_root._singletonDependencyStruct49Created) + if (!_root._singletonDependencyStruct51Created) { using (_lock.EnterScope()) { - if (!_root._singletonDependencyStruct49Created) + if (!_root._singletonDependencyStruct51Created) { - _root._singletonDependencyStruct49 = new DependencyStruct(); + _root._singletonDependencyStruct51 = new DependencyStruct(); Thread.MemoryBarrier(); - _root._singletonDependencyStruct49Created = true; + _root._singletonDependencyStruct51Created = true; } } } - return new Program(new Service, Dictionary>(new Dependency(depArg), _root._singletonDependencyStruct49)); + return new Program(new Service, Dictionary>(new Dependency(depArg), _root._singletonDependencyStruct51)); } } ``` diff --git a/readme/default-lifetime-for-a-type-and-a-tag.md b/readme/default-lifetime-for-a-type-and-a-tag.md index 3e50c158..1038e287 100644 --- a/readme/default-lifetime-for-a-type-and-a-tag.md +++ b/readme/default-lifetime-for-a-type-and-a-tag.md @@ -53,8 +53,8 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; - private Dependency? _singletonDependency42; + private Dependency? _singletonDependency43; + private Dependency? _singletonDependency44; [OrdinalAttribute(20)] public Composition() @@ -74,29 +74,29 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency42 is null) + if (_root._singletonDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency42 is null) + if (_root._singletonDependency44 is null) { - _root._singletonDependency42 = new Dependency(); + _root._singletonDependency44 = new Dependency(); } } } - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!, _root._singletonDependency42!); + return new Service(_root._singletonDependency43!, _root._singletonDependency44!); } } } diff --git a/readme/default-lifetime-for-a-type.md b/readme/default-lifetime-for-a-type.md index f70d0055..d8c96fd4 100644 --- a/readme/default-lifetime-for-a-type.md +++ b/readme/default-lifetime-for-a-type.md @@ -52,7 +52,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -72,18 +72,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!, _root._singletonDependency41!); + return new Service(_root._singletonDependency43!, _root._singletonDependency43!); } } } diff --git a/readme/default-lifetime.md b/readme/default-lifetime.md index 73dc33e7..30e2e445 100644 --- a/readme/default-lifetime.md +++ b/readme/default-lifetime.md @@ -54,8 +54,8 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Service? _singletonService42; - private Dependency? _singletonDependency41; + private Service? _singletonService44; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -75,23 +75,23 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonService42 is null) + if (_root._singletonService44 is null) { using (_lock.EnterScope()) { - if (_root._singletonService42 is null) + if (_root._singletonService44 is null) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } - _root._singletonService42 = new Service(_root._singletonDependency41!, _root._singletonDependency41!); + _root._singletonService44 = new Service(_root._singletonDependency43!, _root._singletonDependency43!); } } } - return _root._singletonService42!; + return _root._singletonService44!; } } } diff --git a/readme/disposable-singleton.md b/readme/disposable-singleton.md index dfa9f5f7..2f553ca8 100644 --- a/readme/disposable-singleton.md +++ b/readme/disposable-singleton.md @@ -57,7 +57,7 @@ partial class Composition: IDisposable private object[] _disposables; private int _disposeIndex; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -79,19 +79,19 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); - _root._disposables[_root._disposeIndex++] = _root._singletonDependency41; + _root._singletonDependency43 = new Dependency(); + _root._disposables[_root._disposeIndex++] = _root._singletonDependency43; } } } - return new Service(_root._singletonDependency41!); + return new Service(_root._singletonDependency43!); } } @@ -105,7 +105,7 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singletonDependency41 = null; + _singletonDependency43 = null; } while (disposeIndex-- > 0) diff --git a/readme/exposed-generic-roots-with-args.md b/readme/exposed-generic-roots-with-args.md index ca3bba74..ac3d1969 100644 --- a/readme/exposed-generic-roots-with-args.md +++ b/readme/exposed-generic-roots-with-args.md @@ -43,7 +43,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Integration.CompositionWithGenericRootsAndArgsInOtherProject? _singletonCompositionWithGenericRootsAndArgsInOtherProject42; + private Integration.CompositionWithGenericRootsAndArgsInOtherProject? _singletonCompositionWithGenericRootsAndArgsInOtherProject44; [OrdinalAttribute(10)] public Composition() @@ -61,20 +61,20 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] public Program GetProgram(int id) { - if (_root._singletonCompositionWithGenericRootsAndArgsInOtherProject42 is null) + if (_root._singletonCompositionWithGenericRootsAndArgsInOtherProject44 is null) { using (_lock.EnterScope()) { - if (_root._singletonCompositionWithGenericRootsAndArgsInOtherProject42 is null) + if (_root._singletonCompositionWithGenericRootsAndArgsInOtherProject44 is null) { - _root._singletonCompositionWithGenericRootsAndArgsInOtherProject42 = new Integration.CompositionWithGenericRootsAndArgsInOtherProject(); + _root._singletonCompositionWithGenericRootsAndArgsInOtherProject44 = new Integration.CompositionWithGenericRootsAndArgsInOtherProject(); } } } Integration.IMyGenericService transientIMyGenericService1; int localId1 = id; - Integration.CompositionWithGenericRootsAndArgsInOtherProject localInstance_1182D1272 = _root._singletonCompositionWithGenericRootsAndArgsInOtherProject42!; + Integration.CompositionWithGenericRootsAndArgsInOtherProject localInstance_1182D1272 = _root._singletonCompositionWithGenericRootsAndArgsInOtherProject44!; transientIMyGenericService1 = localInstance_1182D1272.GetMyService(localId1); return new Program(transientIMyGenericService1); } diff --git a/readme/exposed-generic-roots.md b/readme/exposed-generic-roots.md index d7f5cb02..717e9ac0 100644 --- a/readme/exposed-generic-roots.md +++ b/readme/exposed-generic-roots.md @@ -44,7 +44,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Integration.CompositionWithGenericRootsInOtherProject? _singletonCompositionWithGenericRootsInOtherProject41; + private Integration.CompositionWithGenericRootsInOtherProject? _singletonCompositionWithGenericRootsInOtherProject43; [OrdinalAttribute(20)] public Composition() @@ -64,19 +64,19 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonCompositionWithGenericRootsInOtherProject41 is null) + if (_root._singletonCompositionWithGenericRootsInOtherProject43 is null) { using (_lock.EnterScope()) { - if (_root._singletonCompositionWithGenericRootsInOtherProject41 is null) + if (_root._singletonCompositionWithGenericRootsInOtherProject43 is null) { - _root._singletonCompositionWithGenericRootsInOtherProject41 = new Integration.CompositionWithGenericRootsInOtherProject(); + _root._singletonCompositionWithGenericRootsInOtherProject43 = new Integration.CompositionWithGenericRootsInOtherProject(); } } } Integration.IMyGenericService transientIMyGenericService1; - Integration.CompositionWithGenericRootsInOtherProject localInstance_1182D1270 = _root._singletonCompositionWithGenericRootsInOtherProject41!; + Integration.CompositionWithGenericRootsInOtherProject localInstance_1182D1270 = _root._singletonCompositionWithGenericRootsInOtherProject43!; transientIMyGenericService1 = localInstance_1182D1270.GetMyService(); return new Program(transientIMyGenericService1); } diff --git a/readme/exposed-roots-with-tags.md b/readme/exposed-roots-with-tags.md index 30bea69a..1bfae74a 100644 --- a/readme/exposed-roots-with-tags.md +++ b/readme/exposed-roots-with-tags.md @@ -39,7 +39,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Integration.CompositionWithTagsInOtherProject? _singletonCompositionWithTagsInOtherProject41; + private Integration.CompositionWithTagsInOtherProject? _singletonCompositionWithTagsInOtherProject43; [OrdinalAttribute(20)] public Composition() @@ -59,19 +59,19 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonCompositionWithTagsInOtherProject41 is null) + if (_root._singletonCompositionWithTagsInOtherProject43 is null) { using (_lock.EnterScope()) { - if (_root._singletonCompositionWithTagsInOtherProject41 is null) + if (_root._singletonCompositionWithTagsInOtherProject43 is null) { - _root._singletonCompositionWithTagsInOtherProject41 = new Integration.CompositionWithTagsInOtherProject(); + _root._singletonCompositionWithTagsInOtherProject43 = new Integration.CompositionWithTagsInOtherProject(); } } } Integration.IMyService transientIMyService1; - Integration.CompositionWithTagsInOtherProject localInstance_1182D1276 = _root._singletonCompositionWithTagsInOtherProject41!; + Integration.CompositionWithTagsInOtherProject localInstance_1182D1276 = _root._singletonCompositionWithTagsInOtherProject43!; transientIMyService1 = localInstance_1182D1276.MyService; return new Program(transientIMyService1); } diff --git a/readme/exposed-roots.md b/readme/exposed-roots.md index 6871591f..61da8bc4 100644 --- a/readme/exposed-roots.md +++ b/readme/exposed-roots.md @@ -42,7 +42,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Integration.CompositionInOtherProject? _singletonCompositionInOtherProject41; + private Integration.CompositionInOtherProject? _singletonCompositionInOtherProject43; [OrdinalAttribute(20)] public Composition() @@ -62,19 +62,19 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonCompositionInOtherProject41 is null) + if (_root._singletonCompositionInOtherProject43 is null) { using (_lock.EnterScope()) { - if (_root._singletonCompositionInOtherProject41 is null) + if (_root._singletonCompositionInOtherProject43 is null) { - _root._singletonCompositionInOtherProject41 = new Integration.CompositionInOtherProject(); + _root._singletonCompositionInOtherProject43 = new Integration.CompositionInOtherProject(); } } } Integration.IMyService transientIMyService1; - Integration.CompositionInOtherProject localInstance_1182D1273 = _root._singletonCompositionInOtherProject41!; + Integration.CompositionInOtherProject localInstance_1182D1273 = _root._singletonCompositionInOtherProject43!; transientIMyService1 = localInstance_1182D1273.MyService; return new Program(transientIMyService1); } diff --git a/readme/func-with-arguments.md b/readme/func-with-arguments.md index b8efc798..0bc0e7d6 100644 --- a/readme/func-with-arguments.md +++ b/readme/func-with-arguments.md @@ -90,7 +90,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Clock? _singletonClock41; + private Clock? _singletonClock43; [OrdinalAttribute(20)] public Composition() @@ -119,18 +119,18 @@ partial class Composition // and source code statements "subId" int transientInt324 = subId; int transientInt323 = dependencyId; - if (_root._singletonClock41 is null) + if (_root._singletonClock43 is null) { using (_lock.EnterScope()) { - if (_root._singletonClock41 is null) + if (_root._singletonClock43 is null) { - _root._singletonClock41 = new Clock(); + _root._singletonClock43 = new Clock(); } } } - Dependency localDependency46 = new Dependency(_root._singletonClock41!, transientInt323, transientInt324); + Dependency localDependency46 = new Dependency(_root._singletonClock43!, transientInt323, transientInt324); return localDependency46; }; return new Service(transientFunc1); diff --git a/readme/keyed-service-provider.md b/readme/keyed-service-provider.md index 37c781b8..a57fb692 100644 --- a/readme/keyed-service-provider.md +++ b/readme/keyed-service-provider.md @@ -53,7 +53,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -73,18 +73,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return _root._singletonDependency41!; + return _root._singletonDependency43!; } } @@ -93,18 +93,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!); + return new Service(_root._singletonDependency43!); } } diff --git a/readme/onnewinstance-hint.md b/readme/onnewinstance-hint.md index 2e1a1b3e..b11acab4 100644 --- a/readme/onnewinstance-hint.md +++ b/readme/onnewinstance-hint.md @@ -67,7 +67,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -87,22 +87,22 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - Dependency _singletonDependency41Temp; - _singletonDependency41Temp = new Dependency(); - OnNewInstance(ref _singletonDependency41Temp, null, Lifetime.Singleton); + Dependency _singletonDependency43Temp; + _singletonDependency43Temp = new Dependency(); + OnNewInstance(ref _singletonDependency43Temp, null, Lifetime.Singleton); Thread.MemoryBarrier(); - _root._singletonDependency41 = _singletonDependency41Temp; + _root._singletonDependency43 = _singletonDependency43Temp; } } } - Service transientService0 = new Service(_root._singletonDependency41!); + Service transientService0 = new Service(_root._singletonDependency43!); OnNewInstance(ref transientService0, null, Lifetime.Transient); return transientService0; } diff --git a/readme/perblock.md b/readme/perblock.md index faf8133e..e4e835d3 100644 --- a/readme/perblock.md +++ b/readme/perblock.md @@ -52,8 +52,8 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private (IDependency dep3, IDependency dep4) _singletonValueTuple42; - private bool _singletonValueTuple42Created; + private (IDependency dep3, IDependency dep4) _singletonValueTuple44; + private bool _singletonValueTuple44Created; [OrdinalAttribute(20)] public Composition() @@ -73,22 +73,22 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (!_root._singletonValueTuple42Created) + if (!_root._singletonValueTuple44Created) { using (_lock.EnterScope()) { - if (!_root._singletonValueTuple42Created) + if (!_root._singletonValueTuple44Created) { Dependency perBlockDependency2 = new Dependency(); - _root._singletonValueTuple42 = (perBlockDependency2, perBlockDependency2); + _root._singletonValueTuple44 = (perBlockDependency2, perBlockDependency2); Thread.MemoryBarrier(); - _root._singletonValueTuple42Created = true; + _root._singletonValueTuple44Created = true; } } } Dependency perBlockDependency1 = new Dependency(); - return new Service(perBlockDependency1, perBlockDependency1, _root._singletonValueTuple42); + return new Service(perBlockDependency1, perBlockDependency1, _root._singletonValueTuple44); } } } diff --git a/readme/perresolve.md b/readme/perresolve.md index a6763efc..03fd9ba0 100644 --- a/readme/perresolve.md +++ b/readme/perresolve.md @@ -52,8 +52,8 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private (IDependency dep3, IDependency dep4) _singletonValueTuple42; - private bool _singletonValueTuple42Created; + private (IDependency dep3, IDependency dep4) _singletonValueTuple44; + private bool _singletonValueTuple44Created; [OrdinalAttribute(20)] public Composition() @@ -73,37 +73,37 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perResolveDependency41 = default(Dependency); - if (!_root._singletonValueTuple42Created) + var perResolveDependency43 = default(Dependency); + if (!_root._singletonValueTuple44Created) { using (_lock.EnterScope()) { - if (!_root._singletonValueTuple42Created) + if (!_root._singletonValueTuple44Created) { - if (perResolveDependency41 is null) + if (perResolveDependency43 is null) { - perResolveDependency41 = new Dependency(); + perResolveDependency43 = new Dependency(); } - _root._singletonValueTuple42 = (perResolveDependency41!, perResolveDependency41!); + _root._singletonValueTuple44 = (perResolveDependency43!, perResolveDependency43!); Thread.MemoryBarrier(); - _root._singletonValueTuple42Created = true; + _root._singletonValueTuple44Created = true; } } } - if (perResolveDependency41 is null) + if (perResolveDependency43 is null) { using (_lock.EnterScope()) { - if (perResolveDependency41 is null) + if (perResolveDependency43 is null) { - perResolveDependency41 = new Dependency(); + perResolveDependency43 = new Dependency(); } } } - return new Service(perResolveDependency41!, perResolveDependency41!, _root._singletonValueTuple42); + return new Service(perResolveDependency43!, perResolveDependency43!, _root._singletonValueTuple44); } } } diff --git a/readme/root-binding.md b/readme/root-binding.md index e9b59341..d040b723 100644 --- a/readme/root-binding.md +++ b/readme/root-binding.md @@ -33,7 +33,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -53,18 +53,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!); + return new Service(_root._singletonDependency43!); } } } diff --git a/readme/scope.md b/readme/scope.md index 84990f47..40535789 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -91,7 +91,7 @@ partial class Composition: IDisposable private object[] _disposables; private int _disposeIndex; - private Dependency? _scopedDependency41; + private Dependency? _scopedDependency43; [OrdinalAttribute(20)] public Composition() @@ -113,19 +113,19 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scopedDependency41 is null) + if (_scopedDependency43 is null) { using (_lock.EnterScope()) { - if (_scopedDependency41 is null) + if (_scopedDependency43 is null) { - _scopedDependency41 = new Dependency(); - _disposables[_disposeIndex++] = _scopedDependency41; + _scopedDependency43 = new Dependency(); + _disposables[_disposeIndex++] = _scopedDependency43; } } } - return new Service(_scopedDependency41!); + return new Service(_scopedDependency43!); } } @@ -154,7 +154,7 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scopedDependency41 = null; + _scopedDependency43 = null; } while (disposeIndex-- > 0) diff --git a/readme/service-collection.md b/readme/service-collection.md index 4e893575..22297158 100644 --- a/readme/service-collection.md +++ b/readme/service-collection.md @@ -50,7 +50,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -70,18 +70,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return _root._singletonDependency41!; + return _root._singletonDependency43!; } } @@ -90,18 +90,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!); + return new Service(_root._singletonDependency43!); } } diff --git a/readme/service-provider-with-scope.md b/readme/service-provider-with-scope.md index 8785281a..5a011224 100644 --- a/readme/service-provider-with-scope.md +++ b/readme/service-provider-with-scope.md @@ -81,8 +81,8 @@ partial class Composition: IDisposable private object[] _disposables; private int _disposeIndex; - private Service? _scopedService42; - private Dependency? _singletonDependency41; + private Service? _scopedService44; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -104,18 +104,18 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return _root._singletonDependency41!; + return _root._singletonDependency43!; } } @@ -124,24 +124,24 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_scopedService42 is null) + if (_scopedService44 is null) { using (_lock.EnterScope()) { - if (_scopedService42 is null) + if (_scopedService44 is null) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } - _scopedService42 = new Service(_root._singletonDependency41!); - _disposables[_disposeIndex++] = _scopedService42; + _scopedService44 = new Service(_root._singletonDependency43!); + _disposables[_disposeIndex++] = _scopedService44; } } } - return _scopedService42!; + return _scopedService44!; } } @@ -215,8 +215,8 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _scopedService42 = null; - _singletonDependency41 = null; + _scopedService44 = null; + _singletonDependency43 = null; } while (disposeIndex-- > 0) diff --git a/readme/service-provider.md b/readme/service-provider.md index 617a5d98..76b633bc 100644 --- a/readme/service-provider.md +++ b/readme/service-provider.md @@ -48,7 +48,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -68,18 +68,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return _root._singletonDependency41!; + return _root._singletonDependency43!; } } @@ -88,18 +88,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!); + return new Service(_root._singletonDependency43!); } } diff --git a/readme/singleton.md b/readme/singleton.md index 68724ae3..3282bc0e 100644 --- a/readme/singleton.md +++ b/readme/singleton.md @@ -63,7 +63,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private Dependency? _singletonDependency41; + private Dependency? _singletonDependency43; [OrdinalAttribute(20)] public Composition() @@ -83,18 +83,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency41 is null) + if (_root._singletonDependency43 is null) { - _root._singletonDependency41 = new Dependency(); + _root._singletonDependency43 = new Dependency(); } } } - return new Service(_root._singletonDependency41!, _root._singletonDependency41!); + return new Service(_root._singletonDependency43!, _root._singletonDependency43!); } } } diff --git a/readme/tag-type.md b/readme/tag-type.md index 12cb2d33..52f00827 100644 --- a/readme/tag-type.md +++ b/readme/tag-type.md @@ -63,7 +63,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private XyzDependency? _singletonXyzDependency42; + private XyzDependency? _singletonXyzDependency44; [OrdinalAttribute(20)] public Composition() @@ -83,18 +83,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { - _root._singletonXyzDependency42 = new XyzDependency(); + _root._singletonXyzDependency44 = new XyzDependency(); } } } - return _root._singletonXyzDependency42!; + return _root._singletonXyzDependency44!; } } @@ -103,18 +103,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { - _root._singletonXyzDependency42 = new XyzDependency(); + _root._singletonXyzDependency44 = new XyzDependency(); } } } - return new Service(new AbcDependency(), _root._singletonXyzDependency42!, new AbcDependency()); + return new Service(new AbcDependency(), _root._singletonXyzDependency44!, new AbcDependency()); } } diff --git a/readme/tags.md b/readme/tags.md index 50ee2231..ee15c438 100644 --- a/readme/tags.md +++ b/readme/tags.md @@ -67,7 +67,7 @@ partial class Composition private readonly Composition _root; private readonly Lock _lock; - private XyzDependency? _singletonXyzDependency42; + private XyzDependency? _singletonXyzDependency44; [OrdinalAttribute(20)] public Composition() @@ -87,18 +87,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { - _root._singletonXyzDependency42 = new XyzDependency(); + _root._singletonXyzDependency44 = new XyzDependency(); } } } - return _root._singletonXyzDependency42!; + return _root._singletonXyzDependency44!; } } @@ -107,18 +107,18 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonXyzDependency42 is null) + if (_root._singletonXyzDependency44 is null) { - _root._singletonXyzDependency42 = new XyzDependency(); + _root._singletonXyzDependency44 = new XyzDependency(); } } } - return new Service(new AbcDependency(), _root._singletonXyzDependency42!, new AbcDependency()); + return new Service(new AbcDependency(), _root._singletonXyzDependency44!, new AbcDependency()); } } } diff --git a/readme/threadsafe-hint.md b/readme/threadsafe-hint.md index 20e5107c..4e61a8ef 100644 --- a/readme/threadsafe-hint.md +++ b/readme/threadsafe-hint.md @@ -36,7 +36,7 @@ partial class Composition { private readonly Composition _root; - private Service? _singletonService42; + private Service? _singletonService44; [OrdinalAttribute(20)] public Composition() @@ -54,17 +54,17 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - if (_root._singletonService42 is null) + if (_root._singletonService44 is null) { Func perBlockFunc0 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IDependency localValue78 = new Dependency(); return localValue78; }); - _root._singletonService42 = new Service(perBlockFunc0); + _root._singletonService44 = new Service(perBlockFunc0); } - return _root._singletonService42!; + return _root._singletonService44!; } } } diff --git a/readme/tracking-async-disposable-instances-in-delegates.md b/readme/tracking-async-disposable-instances-in-delegates.md index 9d4b303d..faddf9f8 100644 --- a/readme/tracking-async-disposable-instances-in-delegates.md +++ b/readme/tracking-async-disposable-instances-in-delegates.md @@ -96,23 +96,23 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator45 = new Owned(); + var accumulator47 = new Owned(); Func> perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var accumulator45 = new Owned(); + var accumulator47 = new Owned(); Dependency transientDependency4 = new Dependency(); using (_lock.EnterScope()) { - accumulator45.Add(transientDependency4); + accumulator47.Add(transientDependency4); } Owned perBlockOwned2; // Creates the owner of an instance - Owned localOwned8 = accumulator45; + Owned localOwned8 = accumulator47; IDependency localValue9 = transientDependency4; perBlockOwned2 = new Owned(localValue9, localOwned8); using (_lock.EnterScope()) { - accumulator45.Add(perBlockOwned2); + accumulator47.Add(perBlockOwned2); } Owned localValue7 = perBlockOwned2; return localValue7; @@ -120,7 +120,7 @@ partial class Composition Service transientService0 = new Service(perBlockFunc1); using (_lock.EnterScope()) { - accumulator45.Add(transientService0); + accumulator47.Add(transientService0); } return transientService0; } 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 815a692a..000df810 100644 --- a/readme/tracking-async-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-async-disposable-instances-per-a-composition-root.md @@ -89,20 +89,20 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator44 = new Owned(); + var accumulator46 = new Owned(); Dependency transientDependency3 = new Dependency(); using (_lock.EnterScope()) { - accumulator44.Add(transientDependency3); + accumulator46.Add(transientDependency3); } Owned perBlockOwned0; // Creates the owner of an instance - Owned localOwned10 = accumulator44; + Owned localOwned10 = accumulator46; IService localValue11 = new Service(transientDependency3); perBlockOwned0 = new Owned(localValue11, localOwned10); using (_lock.EnterScope()) { - accumulator44.Add(perBlockOwned0); + accumulator46.Add(perBlockOwned0); } return perBlockOwned0; } diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index b9974e28..6b6fcb42 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -89,23 +89,23 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator45 = new Owned(); + var accumulator47 = new Owned(); Func> perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var accumulator45 = new Owned(); + var accumulator47 = new Owned(); Dependency transientDependency4 = new Dependency(); using (_lock.EnterScope()) { - accumulator45.Add(transientDependency4); + accumulator47.Add(transientDependency4); } Owned perBlockOwned2; // Creates the owner of an instance - Owned localOwned13 = accumulator45; + Owned localOwned13 = accumulator47; IDependency localValue14 = transientDependency4; perBlockOwned2 = new Owned(localValue14, localOwned13); using (_lock.EnterScope()) { - accumulator45.Add(perBlockOwned2); + accumulator47.Add(perBlockOwned2); } Owned localValue12 = perBlockOwned2; return localValue12; @@ -113,7 +113,7 @@ partial class Composition Service transientService0 = new Service(perBlockFunc1); using (_lock.EnterScope()) { - accumulator45.Add(transientService0); + accumulator47.Add(transientService0); } return transientService0; } diff --git a/readme/tracking-disposable-instances-per-a-composition-root.md b/readme/tracking-disposable-instances-per-a-composition-root.md index e3c0e2a3..cbadefdd 100644 --- a/readme/tracking-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-disposable-instances-per-a-composition-root.md @@ -85,20 +85,20 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator44 = new Owned(); + var accumulator46 = new Owned(); Dependency transientDependency3 = new Dependency(); using (_lock.EnterScope()) { - accumulator44.Add(transientDependency3); + accumulator46.Add(transientDependency3); } Owned perBlockOwned0; // Creates the owner of an instance - Owned localOwned15 = accumulator44; + Owned localOwned15 = accumulator46; IService localValue16 = new Service(transientDependency3); perBlockOwned0 = new Owned(localValue16, localOwned15); using (_lock.EnterScope()) { - accumulator44.Add(perBlockOwned0); + accumulator46.Add(perBlockOwned0); } return perBlockOwned0; } diff --git a/readme/tracking-disposable-instances-using-pre-built-classes.md b/readme/tracking-disposable-instances-using-pre-built-classes.md index b5f194be..d003ff0d 100644 --- a/readme/tracking-disposable-instances-using-pre-built-classes.md +++ b/readme/tracking-disposable-instances-using-pre-built-classes.md @@ -107,7 +107,7 @@ partial class Composition: IDisposable private object[] _disposables; private int _disposeIndex; - private Dependency? _singletonDependency42; + private Dependency? _singletonDependency44; [OrdinalAttribute(20)] public Composition() @@ -129,50 +129,50 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator48 = new Abstractions.Own(); + var accumulator50 = new Abstractions.Own(); Func> perBlockFunc2 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var accumulator48 = new Abstractions.Own(); - if (_root._singletonDependency42 is null) + var accumulator50 = new Abstractions.Own(); + if (_root._singletonDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency42 is null) + if (_root._singletonDependency44 is null) { - _root._singletonDependency42 = new Dependency(); - _root._disposables[_root._disposeIndex++] = _root._singletonDependency42; + _root._singletonDependency44 = new Dependency(); + _root._disposables[_root._disposeIndex++] = _root._singletonDependency44; } } } Abstractions.Own perBlockOwn3; // Creates the owner of an instance - Abstractions.Own localOwn18 = accumulator48; - IDependency localValue19 = _root._singletonDependency42!; + Abstractions.Own localOwn18 = accumulator50; + IDependency localValue19 = _root._singletonDependency44!; perBlockOwn3 = new Abstractions.Own(localValue19, localOwn18); using (_lock.EnterScope()) { - accumulator48.Add(perBlockOwn3); + accumulator50.Add(perBlockOwn3); } Abstractions.Own localValue17 = perBlockOwn3; return localValue17; }); Func> perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var accumulator48 = new Abstractions.Own(); + var accumulator50 = new Abstractions.Own(); Dependency transientDependency7 = new Dependency(); using (_lock.EnterScope()) { - accumulator48.Add(transientDependency7); + accumulator50.Add(transientDependency7); } Abstractions.Own perBlockOwn5; // Creates the owner of an instance - Abstractions.Own localOwn21 = accumulator48; + Abstractions.Own localOwn21 = accumulator50; IDependency localValue22 = transientDependency7; perBlockOwn5 = new Abstractions.Own(localValue22, localOwn21); using (_lock.EnterScope()) { - accumulator48.Add(perBlockOwn5); + accumulator50.Add(perBlockOwn5); } Abstractions.Own localValue20 = perBlockOwn5; return localValue20; @@ -180,7 +180,7 @@ partial class Composition: IDisposable Service transientService0 = new Service(perBlockFunc1, perBlockFunc2); using (_lock.EnterScope()) { - accumulator48.Add(transientService0); + accumulator50.Add(transientService0); } return transientService0; } @@ -256,7 +256,7 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singletonDependency42 = null; + _singletonDependency44 = null; } while (disposeIndex-- > 0) diff --git a/readme/tracking-disposable-instances-with-different-lifetimes.md b/readme/tracking-disposable-instances-with-different-lifetimes.md index 66ccce52..3ea1d94b 100644 --- a/readme/tracking-disposable-instances-with-different-lifetimes.md +++ b/readme/tracking-disposable-instances-with-different-lifetimes.md @@ -97,7 +97,7 @@ partial class Composition: IDisposable private object[] _disposables; private int _disposeIndex; - private Dependency? _singletonDependency42; + private Dependency? _singletonDependency44; [OrdinalAttribute(20)] public Composition() @@ -119,50 +119,50 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var accumulator48 = new Owned(); + var accumulator50 = new Owned(); Func> perBlockFunc2 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var accumulator48 = new Owned(); - if (_root._singletonDependency42 is null) + var accumulator50 = new Owned(); + if (_root._singletonDependency44 is null) { using (_lock.EnterScope()) { - if (_root._singletonDependency42 is null) + if (_root._singletonDependency44 is null) { - _root._singletonDependency42 = new Dependency(); - _root._disposables[_root._disposeIndex++] = _root._singletonDependency42; + _root._singletonDependency44 = new Dependency(); + _root._disposables[_root._disposeIndex++] = _root._singletonDependency44; } } } Owned perBlockOwned3; // Creates the owner of an instance - Owned localOwned24 = accumulator48; - IDependency localValue25 = _root._singletonDependency42!; + Owned localOwned24 = accumulator50; + IDependency localValue25 = _root._singletonDependency44!; perBlockOwned3 = new Owned(localValue25, localOwned24); using (_lock.EnterScope()) { - accumulator48.Add(perBlockOwned3); + accumulator50.Add(perBlockOwned3); } Owned localValue23 = perBlockOwned3; return localValue23; }); Func> perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { - var accumulator48 = new Owned(); + var accumulator50 = new Owned(); Dependency transientDependency7 = new Dependency(); using (_lock.EnterScope()) { - accumulator48.Add(transientDependency7); + accumulator50.Add(transientDependency7); } Owned perBlockOwned5; // Creates the owner of an instance - Owned localOwned27 = accumulator48; + Owned localOwned27 = accumulator50; IDependency localValue28 = transientDependency7; perBlockOwned5 = new Owned(localValue28, localOwned27); using (_lock.EnterScope()) { - accumulator48.Add(perBlockOwned5); + accumulator50.Add(perBlockOwned5); } Owned localValue26 = perBlockOwned5; return localValue26; @@ -170,7 +170,7 @@ partial class Composition: IDisposable Service transientService0 = new Service(perBlockFunc1, perBlockFunc2); using (_lock.EnterScope()) { - accumulator48.Add(transientService0); + accumulator50.Add(transientService0); } return transientService0; } @@ -246,7 +246,7 @@ partial class Composition: IDisposable _disposeIndex = 0; disposables = _disposables; _disposables = new object[1]; - _singletonDependency42 = null; + _singletonDependency44 = null; } while (disposeIndex-- > 0)