From 03d548a4bb4c2309f746a9f68092765fa9d1539e Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Sat, 30 Nov 2024 13:51:08 +0300 Subject: [PATCH] Improved class diagrams --- README.md | 7 +- docs/README.md | 9 +- readme/ArrayDetails.md | 99 +++++++++++-------- readme/EnumDetails.md | 99 +++++++++++-------- readme/FuncDetails.md | 81 ++++++++------- readme/SingletonDetails.md | 75 ++++++++------ readme/TransientDetails.md | 75 ++++++++------ readme/a-few-partial-classes.md | 41 ++++---- readme/accumulators.md | 61 +++++++----- readme/advanced-interception.md | 39 +++++--- readme/array.md | 57 ++++++----- readme/async-disposable-scope.md | 65 +++++++----- readme/async-disposable-singleton.md | 50 ++++++---- readme/async-enumerable.md | 57 ++++++----- readme/async-root.md | 70 ++++++++----- readme/auto-bindings.md | 21 ++-- readme/auto-scoped.md | 44 ++++++--- readme/bind-attribute-for-a-generic-type.md | 37 ++++--- .../bind-attribute-with-lifetime-and-tag.md | 37 ++++--- readme/bind-attribute.md | 37 ++++--- .../build-up-of-an-existing-generic-object.md | 57 ++++++----- readme/build-up-of-an-existing-object.md | 57 ++++++----- readme/check-for-a-root.md | 45 +++++---- readme/class-arguments.md | 48 +++++---- readme/complex-generics.md | 59 ++++++----- readme/composition-root-kinds.md | 53 +++++----- readme/composition-roots.md | 53 +++++----- readme/constructor-ordinal-attribute.md | 30 ++++-- readme/custom-attributes.md | 69 ++++++++----- readme/custom-generic-argument-attribute.md | 57 ++++++----- readme/custom-generic-argument.md | 57 ++++++----- readme/custom-universal-attribute.md | 69 ++++++++----- readme/decorator.md | 33 ++++--- .../default-lifetime-for-a-type-and-a-tag.md | 39 +++++--- readme/default-lifetime-for-a-type.md | 39 +++++--- readme/default-lifetime.md | 39 +++++--- readme/default-values.md | 41 ++++---- readme/dependent-compositions.md | 47 +++++---- readme/disposable-singleton.md | 44 ++++++--- readme/enumerable-generics.md | 95 ++++++++++-------- readme/enumerable.md | 57 ++++++----- readme/factory.md | 47 ++++++--- readme/field-injection.md | 41 ++++---- readme/func-with-arguments.md | 63 +++++++----- readme/func-with-tag.md | 47 +++++---- readme/func.md | 47 +++++---- ...sync-composition-roots-with-constraints.md | 90 +++++++++++------ ...eric-composition-roots-with-constraints.md | 50 ++++++---- readme/generic-composition-roots.md | 44 +++++---- readme/generic-root-arguments.md | 34 ++++--- readme/generics.md | 51 +++++----- readme/inject-attribute.md | 43 +++++--- readme/injections-of-abstractions.md | 41 +++++--- readme/interception.md | 25 +++-- readme/keyed-service-provider.md | 43 ++++---- readme/lazy.md | 52 ++++++---- readme/manually-started-tasks.md | 56 +++++++---- readme/member-ordinal-attribute.md | 46 ++++++--- readme/method-injection.md | 41 ++++---- readme/oncannotresolve-hint.md | 44 +++++---- readme/ondependencyinjection-hint.md | 39 +++++--- readme/onnewinstance-hint.md | 39 +++++--- readme/overriding-the-bcl-binding.md | 31 ++++-- readme/partial-class.md | 40 +++++--- readme/perblock.md | 38 ++++--- readme/perresolve.md | 38 ++++--- readme/property-injection.md | 41 ++++---- readme/required-properties-or-fields.md | 48 +++++---- readme/resolve-hint.md | 41 ++++---- readme/resolve-methods.md | 51 +++++----- readme/root-arguments.md | 48 +++++---- readme/root-binding.md | 39 +++++--- readme/scope.md | 59 ++++++----- readme/service-collection.md | 43 ++++---- readme/service-provider-with-scope.md | 48 +++++---- readme/service-provider.md | 43 ++++---- readme/simplified-binding.md | 53 +++++----- readme/simplified-factory.md | 42 +++++--- readme/singleton.md | 39 +++++--- readme/span-and-readonlyspan.md | 44 ++++++--- readme/tag-attribute.md | 45 +++++---- readme/tag-on-a-constructor-argument.md | 51 +++++----- readme/tag-on-a-member.md | 41 ++++---- readme/tag-on-a-method-argument.md | 41 ++++---- .../tag-on-injection-site-with-wildcards.md | 53 +++++----- readme/tag-on-injection-site.md | 53 +++++----- readme/tag-type.md | 55 ++++++----- readme/tag-unique.md | 57 ++++++----- readme/tags.md | 47 +++++---- readme/task.md | 71 ++++++++----- readme/threadsafe-hint.md | 45 +++++---- readme/tostring-hint.md | 39 +++++--- ...async-disposable-instances-in-delegates.md | 48 ++++++--- ...osable-instances-per-a-composition-root.md | 61 +++++++----- ...cking-disposable-instances-in-delegates.md | 48 ++++++--- ...osable-instances-per-a-composition-root.md | 53 ++++++---- ...sable-instances-using-pre-built-classes.md | 55 +++++++---- ...able-instances-with-different-lifetimes.md | 55 +++++++---- readme/transient.md | 39 +++++--- readme/tuple.md | 56 ++++++----- readme/type-attribute.md | 39 +++++--- readme/valuetask.md | 47 +++++---- readme/weak-reference.md | 49 +++++---- .../Core/Code/ClassDiagramBuilder.cs | 4 +- 104 files changed, 3092 insertions(+), 1978 deletions(-) diff --git a/README.md b/README.md index daf474cb..792313f5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,12 @@ _Supports .NET starting with .NET Framework 2.0, released 2005-10-27, and all ne ## Usage requirements - .NET SDK [6.0.4](https://dotnet.microsoft.com/download/dotnet/6.0) or later is installed -- Using [C# 8](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-80) or later version + +At the same time, projects can be developed for older versions of .NET, starting with .NET Framework 2.0 released on 2005-10-27. + +- [C# 8](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-80) or later + +This requirement only needs to be met for projects that reference the _Pure.DI_ source code generator, other projects can use any version of C#. ## Key features diff --git a/docs/README.md b/docs/README.md index 7666cb44..45b12715 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,11 +3,12 @@ _Supports .NET starting with .NET Framework 2.0, released 2005-10-27, and all ne ## Usage requirements - .NET SDK [6.0.4](https://dotnet.microsoft.com/download/dotnet/6.0) or later is installed -> [!NOTE] -> At the same time, projects can be developed for older versions of .NET, starting with .NET Framework 2.0 released on 2005-10-27. + +At the same time, projects can be developed for older versions of .NET, starting with .NET Framework 2.0 released on 2005-10-27. + - [C# 8](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-80) or later -> [!NOTE] -> This requirement only needs to be met for projects that reference the _Pure.DI_ source code generator, other projects can use any version of C#. + +This requirement only needs to be met for projects that reference the _Pure.DI_ source code generator, other projects can use any version of C#. ## Key features diff --git a/readme/ArrayDetails.md b/readme/ArrayDetails.md index 6fff728f..5bae41be 100644 --- a/readme/ArrayDetails.md +++ b/readme/ArrayDetails.md @@ -4,56 +4,19 @@ Creating an object graph of 27 transient objects, including 4 transient array ob ### Class diagram ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Array { - <> - +CompositionRoot TestPureDIByCR() - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service1 --|> IService1 - class Service1 { - +Service1(IService2 service2) - } Service2Array --|> IService2 - class Service2Array { - +Service2Array(ArrayᐸIService3ᐳ services) - } Service3 --|> IService3 - class Service3 { - +Service3(IService4 service41, IService4 service42) - } Service4 --|> IService4 - class Service4 { - +Service4() - } - class ArrayᐸIService3ᐳ Service3v2 --|> IService3 : 2 - class Service3v2 { - +Service3v2(IService4 service41, IService4 service42) - } Service3v3 --|> IService3 : 3 - class Service3v3 { - +Service3v3(IService4 service41, IService4 service42) - } Service3v4 --|> IService3 : 4 - class Service3v4 { - +Service3v4(IService4 service41, IService4 service42) - } - class IService1 { - <> - } - class IService2 { - <> - } - class IService3 { - <> - } - class IService4 { - <> - } Array ..> CompositionRoot : CompositionRoot TestPureDIByCR() CompositionRoot *-- Service1 : IService1 CompositionRoot *-- "3 " Service2Array : IService2 @@ -69,6 +32,58 @@ classDiagram Service3v2 *-- "2 " Service4 : IService4 Service3v3 *-- "2 " Service4 : IService4 Service3v4 *-- "2 " Service4 : IService4 + namespace Pure.DI.Benchmarks.Benchmarks { + class Array { + <> + +CompositionRoot TestPureDIByCR() + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + } + namespace Pure.DI.Benchmarks.Model { + class CompositionRoot { + } + class IService1 { + <> + } + class IService2 { + <> + } + class IService3 { + <> + } + class IService4 { + <> + } + class Service1 { + +Service1(IService2 service2) + } + class Service2Array { + +Service2Array(ArrayᐸIService3ᐳ services) + } + class Service3 { + +Service3(IService4 service41, IService4 service42) + } + class Service3v2 { + +Service3v2(IService4 service41, IService4 service42) + } + class Service3v3 { + +Service3v3(IService4 service41, IService4 service42) + } + class Service3v4 { + +Service3v4(IService4 service41, IService4 service42) + } + class Service4 { + +Service4() + } + } + namespace System { + class ArrayᐸIService3ᐳ { + <> + } + } ``` ### Generated code diff --git a/readme/EnumDetails.md b/readme/EnumDetails.md index de0e9064..356e87f9 100644 --- a/readme/EnumDetails.md +++ b/readme/EnumDetails.md @@ -4,56 +4,19 @@ Creating an object graph of 12 transient objects, including 1 transient enumerab ### Class diagram ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Enum { - <> - +CompositionRoot TestPureDIByCR() - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service1 --|> IService1 - class Service1 { - +Service1(IService2 service2) - } Service2Enum --|> IService2 - class Service2Enum { - +Service2Enum(IEnumerableᐸIService3ᐳ services) - } Service3 --|> IService3 - class Service3 { - +Service3(IService4 service41, IService4 service42) - } Service4 --|> IService4 - class Service4 { - +Service4() - } - class IEnumerableᐸIService3ᐳ Service3v2 --|> IService3 : 2 - class Service3v2 { - +Service3v2(IService4 service41, IService4 service42) - } Service3v3 --|> IService3 : 3 - class Service3v3 { - +Service3v3(IService4 service41, IService4 service42) - } Service3v4 --|> IService3 : 4 - class Service3v4 { - +Service3v4(IService4 service41, IService4 service42) - } - class IService1 { - <> - } - class IService2 { - <> - } - class IService3 { - <> - } - class IService4 { - <> - } Enum ..> CompositionRoot : CompositionRoot TestPureDIByCR() CompositionRoot *-- Service1 : IService1 CompositionRoot *-- "3 " Service2Enum : IService2 @@ -69,6 +32,58 @@ classDiagram Service3v2 *-- "2 " Service4 : IService4 Service3v3 *-- "2 " Service4 : IService4 Service3v4 *-- "2 " Service4 : IService4 + namespace Pure.DI.Benchmarks.Benchmarks { + class Enum { + <> + +CompositionRoot TestPureDIByCR() + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + } + namespace Pure.DI.Benchmarks.Model { + class CompositionRoot { + } + class IService1 { + <> + } + class IService2 { + <> + } + class IService3 { + <> + } + class IService4 { + <> + } + class Service1 { + +Service1(IService2 service2) + } + class Service2Enum { + +Service2Enum(IEnumerableᐸIService3ᐳ services) + } + class Service3 { + +Service3(IService4 service41, IService4 service42) + } + class Service3v2 { + +Service3v2(IService4 service41, IService4 service42) + } + class Service3v3 { + +Service3v3(IService4 service41, IService4 service42) + } + class Service3v4 { + +Service3v4(IService4 service41, IService4 service42) + } + class Service4 { + +Service4() + } + } + namespace System.Collections.Generic { + class IEnumerableᐸIService3ᐳ { + <> + } + } ``` ### Generated code diff --git a/readme/FuncDetails.md b/readme/FuncDetails.md index cd405952..081c10e0 100644 --- a/readme/FuncDetails.md +++ b/readme/FuncDetails.md @@ -4,44 +4,16 @@ Creating an object graph of 7 transition objects plus 1 `Func` with additiona ### Class diagram ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Func { - <> - +CompositionRoot TestPureDIByCR() - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service1 --|> IService1 - class Service1 { - +Service1(IService2 service2) - } Service2Func --|> IService2 - class Service2Func { - +Service2Func(FuncᐸIService3ᐳ service3Factory) - } Service3 --|> IService3 - class Service3 { - +Service3(IService4 service41, IService4 service42) - } Service4 --|> IService4 - class Service4 { - +Service4() - } - class FuncᐸIService3ᐳ - class IService1 { - <> - } - class IService2 { - <> - } - class IService3 { - <> - } - class IService4 { - <> - } Func ..> CompositionRoot : CompositionRoot TestPureDIByCR() CompositionRoot *-- Service1 : IService1 CompositionRoot *-- "3 " Service2Func : IService2 @@ -51,6 +23,49 @@ classDiagram Service2Func o-- "PerBlock" FuncᐸIService3ᐳ : FuncᐸIService3ᐳ Service3 *-- "2 " Service4 : IService4 FuncᐸIService3ᐳ *-- Service3 : IService3 + namespace Pure.DI.Benchmarks.Benchmarks { + class Func { + <> + +CompositionRoot TestPureDIByCR() + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + } + namespace Pure.DI.Benchmarks.Model { + class CompositionRoot { + } + class IService1 { + <> + } + class IService2 { + <> + } + class IService3 { + <> + } + class IService4 { + <> + } + class Service1 { + +Service1(IService2 service2) + } + class Service2Func { + +Service2Func(FuncᐸIService3ᐳ service3Factory) + } + class Service3 { + +Service3(IService4 service41, IService4 service42) + } + class Service4 { + +Service4() + } + } + namespace System { + class FuncᐸIService3ᐳ { + <> + } + } ``` ### Generated code diff --git a/readme/SingletonDetails.md b/readme/SingletonDetails.md index 248e379b..3d1bc01a 100644 --- a/readme/SingletonDetails.md +++ b/readme/SingletonDetails.md @@ -4,43 +4,16 @@ Creating an object graph of 20 transition objects plus 1 singleton with an addit ### Class diagram ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Singleton { - <> - +CompositionRoot TestPureDIByCR() - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service1 --|> IService1 - class Service1 { - +Service1(IService2 service2) - } Service2 --|> IService2 - class Service2 { - +Service2(IService3 service31, IService3 service32, IService3 service33, IService3 service34, IService3 service35) - } Service3 --|> IService3 - class Service3 { - +Service3(IService4 service41, IService4 service42) - } Service4 --|> IService4 - class Service4 { - +Service4() - } - class IService1 { - <> - } - class IService2 { - <> - } - class IService3 { - <> - } - class IService4 { - <> - } Singleton ..> CompositionRoot : CompositionRoot TestPureDIByCR() CompositionRoot o-- "Scoped" Service1 : IService1 CompositionRoot *-- "3 " Service2 : IService2 @@ -49,6 +22,44 @@ classDiagram Service1 *-- Service2 : IService2 Service2 *-- "5 " Service3 : IService3 Service3 o-- "2 Scoped instances" Service4 : IService4 + namespace Pure.DI.Benchmarks.Benchmarks { + class Singleton { + <> + +CompositionRoot TestPureDIByCR() + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + } + namespace Pure.DI.Benchmarks.Model { + class CompositionRoot { + } + class IService1 { + <> + } + class IService2 { + <> + } + class IService3 { + <> + } + class IService4 { + <> + } + class Service1 { + +Service1(IService2 service2) + } + class Service2 { + +Service2(IService3 service31, IService3 service32, IService3 service33, IService3 service34, IService3 service35) + } + class Service3 { + +Service3(IService4 service41, IService4 service42) + } + class Service4 { + +Service4() + } + } ``` ### Generated code diff --git a/readme/TransientDetails.md b/readme/TransientDetails.md index c16258bb..310f7487 100644 --- a/readme/TransientDetails.md +++ b/readme/TransientDetails.md @@ -4,43 +4,16 @@ Creating an object graph of 22 transient objects. ### Class diagram ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Transient { - <> - +CompositionRoot TestPureDIByCR() - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service1 --|> IService1 - class Service1 { - +Service1(IService2 service2) - } Service2 --|> IService2 - class Service2 { - +Service2(IService3 service31, IService3 service32, IService3 service33, IService3 service34, IService3 service35) - } Service3 --|> IService3 - class Service3 { - +Service3(IService4 service41, IService4 service42) - } Service4 --|> IService4 - class Service4 { - +Service4() - } - class IService1 { - <> - } - class IService2 { - <> - } - class IService3 { - <> - } - class IService4 { - <> - } Transient ..> CompositionRoot : CompositionRoot TestPureDIByCR() CompositionRoot *-- Service1 : IService1 CompositionRoot *-- "3 " Service2 : IService2 @@ -49,6 +22,44 @@ classDiagram Service1 *-- Service2 : IService2 Service2 *-- "5 " Service3 : IService3 Service3 *-- "2 " Service4 : IService4 + namespace Pure.DI.Benchmarks.Benchmarks { + class Transient { + <> + +CompositionRoot TestPureDIByCR() + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + } + namespace Pure.DI.Benchmarks.Model { + class CompositionRoot { + } + class IService1 { + <> + } + class IService2 { + <> + } + class IService3 { + <> + } + class IService4 { + <> + } + class Service1 { + +Service1(IService2 service2) + } + class Service2 { + +Service2(IService3 service31, IService3 service32, IService3 service33, IService3 service34, IService3 service35) + } + class Service3 { + +Service3(IService4 service41, IService4 service42) + } + class Service4 { + +Service4() + } + } ``` ### Generated code diff --git a/readme/a-few-partial-classes.md b/readme/a-few-partial-classes.md index ba7106cf..07fb494a 100644 --- a/readme/a-few-partial-classes.md +++ b/readme/a-few-partial-classes.md @@ -188,30 +188,37 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService Root + Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service *-- Dependency : IDependency ``` diff --git a/readme/accumulators.md b/readme/accumulators.md index ce3a9af6..9125f3d2 100644 --- a/readme/accumulators.md +++ b/readme/accumulators.md @@ -228,39 +228,52 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +ValueTupleᐸIServiceˏMyAccumulatorᐳ Root - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2, IDependency dependency3) - } - class MyAccumulator AbcDependency --|> IDependency : typeof(Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency) - class AbcDependency { - +AbcDependency() - } XyzDependency --|> IDependency : typeof(Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency) - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> ValueTupleᐸIServiceˏMyAccumulatorᐳ : ValueTupleᐸIServiceˏMyAccumulatorᐳ Root ValueTupleᐸIServiceˏMyAccumulatorᐳ *-- Service : IService ValueTupleᐸIServiceˏMyAccumulatorᐳ *-- MyAccumulator : MyAccumulator Service *-- AbcDependency : typeof(Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency) IDependency Service o-- "Singleton" XyzDependency : typeof(Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency) IDependency Service o-- "PerBlock" AbcDependency : IDependency + namespace Pure.DI.UsageTests.Advanced.AccumulatorScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +ValueTupleᐸIServiceˏMyAccumulatorᐳ Root + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + class IDependency { + <> + } + class IService { + <> + } + class MyAccumulator { + } + class Service { + +Service(IDependency dependency1, IDependency dependency2, IDependency dependency3) + } + class XyzDependency { + +XyzDependency() + } + } + namespace System { + class ValueTupleᐸIServiceˏMyAccumulatorᐳ { + <> + } + } ``` diff --git a/readme/advanced-interception.md b/readme/advanced-interception.md index 4f6d38ff..bf8140d9 100644 --- a/readme/advanced-interception.md +++ b/readme/advanced-interception.md @@ -150,26 +150,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/array.md b/readme/array.md index 425f9557..e5d38d22 100644 --- a/readme/array.md +++ b/readme/array.md @@ -209,37 +209,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + AbcDependency --|> IDependency + XyzDependency --|> IDependency : 2 + Composition ..> Service : IService Root + Service *-- ArrayᐸIDependencyᐳ : ArrayᐸIDependencyᐳ + ArrayᐸIDependencyᐳ *-- AbcDependency : IDependency + ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency + namespace Pure.DI.UsageTests.BCL.ArrayScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(ArrayᐸIDependencyᐳ dependencies) + } + class XyzDependency { + +XyzDependency() + } } - Service --|> IService - class Service { - +Service(ArrayᐸIDependencyᐳ dependencies) - } - class ArrayᐸIDependencyᐳ - AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - XyzDependency --|> IDependency : 2 - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> + namespace System { + class ArrayᐸIDependencyᐳ { + <> + } } - Composition ..> Service : IService Root - Service *-- ArrayᐸIDependencyᐳ : ArrayᐸIDependencyᐳ - ArrayᐸIDependencyᐳ *-- AbcDependency : IDependency - ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency ``` diff --git a/readme/async-disposable-scope.md b/readme/async-disposable-scope.md index 0e4154e6..ef7c4abd 100644 --- a/readme/async-disposable-scope.md +++ b/readme/async-disposable-scope.md @@ -226,42 +226,57 @@ partial class Composition: IDisposable, IAsyncDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Program ProgramRoot - +IService SessionRoot - } Composition --|> IDisposable Composition --|> IAsyncDisposable Service --|> IService - class Service { - +Service(IDependency dependency) - } - class FuncᐸSessionᐳ Dependency --|> IDependency Dependency --|> IAsyncDisposable - class Dependency { - +Dependency() - } - class Session { - +Session(Composition composition) - } - class Composition - class IService { - <> - } - class IDependency { - <> - } - class IAsyncDisposable { - <> - } Composition ..> Program : Program ProgramRoot Composition ..> Service : IService SessionRoot Program o-- "PerBlock" FuncᐸSessionᐳ : FuncᐸSessionᐳ Service o-- "Scoped" Dependency : IDependency FuncᐸSessionᐳ *-- Session : Session Session *-- Composition : Composition + namespace Pure.DI.UsageTests.Lifetimes.AsyncDisposableScopeScenario { + class Composition { + <> + +Program ProgramRoot + +IService SessionRoot + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Program { + } + class Service { + +Service(IDependency dependency) + } + class Session { + +Session(Composition composition) + } + } + namespace System { + class FuncᐸSessionᐳ { + <> + } + class IAsyncDisposable { + <> + } + class IDisposable { + <> + } + } ``` diff --git a/readme/async-disposable-singleton.md b/readme/async-disposable-singleton.md index ad65f332..afb805c4 100644 --- a/readme/async-disposable-singleton.md +++ b/readme/async-disposable-singleton.md @@ -177,32 +177,44 @@ partial class Composition: IDisposable, IAsyncDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Composition --|> IDisposable Composition --|> IAsyncDisposable Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency Dependency --|> IAsyncDisposable - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - class IAsyncDisposable { - <> - } Composition ..> Service : IService Root Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.AsyncDisposableSingletonScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } + namespace System { + class IAsyncDisposable { + <> + } + class IDisposable { + <> + } + } ``` diff --git a/readme/async-enumerable.md b/readme/async-enumerable.md index 8cda93d2..b5a313fd 100644 --- a/readme/async-enumerable.md +++ b/readme/async-enumerable.md @@ -201,37 +201,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + AbcDependency --|> IDependency + XyzDependency --|> IDependency : 2 + Composition ..> Service : IService Root + Service *-- IAsyncEnumerableᐸIDependencyᐳ : IAsyncEnumerableᐸIDependencyᐳ + IAsyncEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency + IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency + namespace Pure.DI.UsageTests.BCL.AsyncEnumerableScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IAsyncEnumerableᐸIDependencyᐳ dependencies) + } + class XyzDependency { + +XyzDependency() + } } - Service --|> IService - class Service { - +Service(IAsyncEnumerableᐸIDependencyᐳ dependencies) - } - class IAsyncEnumerableᐸIDependencyᐳ - AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - XyzDependency --|> IDependency : 2 - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> + namespace System.Collections.Generic { + class IAsyncEnumerableᐸIDependencyᐳ { + <> + } } - Composition ..> Service : IService Root - Service *-- IAsyncEnumerableᐸIDependencyᐳ : IAsyncEnumerableᐸIDependencyᐳ - IAsyncEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency - IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency ``` diff --git a/readme/async-root.md b/readme/async-root.md index 38edc3c7..6ada86f6 100644 --- a/readme/async-root.md +++ b/readme/async-root.md @@ -79,31 +79,14 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +TaskᐸIServiceᐳ GetMyServiceAsync(System.Threading.CancellationToken cancellationToken) - } - class FuncᐸIServiceᐳ - class TaskFactoryᐸIServiceᐳ Service --|> IService - class Service { - +Service(IDependency dependency) - } - class CancellationToken - class TaskCreationOptions - class TaskContinuationOptions - class TaskScheduler Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> TaskᐸIServiceᐳ : TaskᐸIServiceᐳ GetMyServiceAsync(System.Threading.CancellationToken cancellationToken) TaskᐸIServiceᐳ o-- "PerBlock" FuncᐸIServiceᐳ : FuncᐸIServiceᐳ TaskᐸIServiceᐳ o-- "PerBlock" TaskFactoryᐸIServiceᐳ : TaskFactoryᐸIServiceᐳ @@ -113,5 +96,48 @@ classDiagram TaskFactoryᐸIServiceᐳ *-- TaskContinuationOptions : TaskContinuationOptions TaskFactoryᐸIServiceᐳ *-- TaskScheduler : TaskScheduler Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.AsyncRootScenario { + class Composition { + <> + +TaskᐸIServiceᐳ GetMyServiceAsync(System.Threading.CancellationToken cancellationToken) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } + namespace System { + class FuncᐸIServiceᐳ { + <> + } + } + namespace System.Threading { + class CancellationToken { + <> + } + } + namespace System.Threading.Tasks { + class TaskContinuationOptions { + <> + } + class TaskCreationOptions { + <> + } + class TaskFactoryᐸIServiceᐳ { + } + class TaskScheduler { + <> + } + class TaskᐸIServiceᐳ { + } + } ``` diff --git a/readme/auto-bindings.md b/readme/auto-bindings.md index f8abb657..a33f71f6 100644 --- a/readme/auto-bindings.md +++ b/readme/auto-bindings.md @@ -58,15 +58,24 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Composition ..> Service : Service MyService + Service *-- Dependency : Dependency + namespace Pure.DI.UsageTests.Basics.AutoBindingsScenario { + class Composition { <> +Service MyService + } + class Dependency { + +Dependency() + } + class Service { + } } - class Dependency { - +Dependency() - } - Composition ..> Service : Service MyService - Service *-- Dependency : Dependency ``` diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index a573d349..bc5cf8e7 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -136,27 +136,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Program ProgramRoot - +Service SessionRoot - } - class FuncᐸIServiceᐳ Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService - class Composition - class IDependency { - <> - } Composition ..> Program : Program ProgramRoot Composition ..> Service : Service SessionRoot Program o-- "PerBlock" FuncᐸIServiceᐳ : FuncᐸIServiceᐳ Service o-- "Scoped" Dependency : IDependency FuncᐸIServiceᐳ *-- IService : IService IService *-- Composition : Composition + namespace Pure.DI.UsageTests.Lifetimes.AutoScopedScenario { + class Composition { + <> + +Program ProgramRoot + +Service SessionRoot + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Program { + } + class Service { + } + } + namespace System { + class FuncᐸIServiceᐳ { + <> + } + } ``` diff --git a/readme/bind-attribute-for-a-generic-type.md b/readme/bind-attribute-for-a-generic-type.md index cab8273d..9f92b121 100644 --- a/readme/bind-attribute-for-a-generic-type.md +++ b/readme/bind-attribute-for-a-generic-type.md @@ -95,24 +95,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependencyᐸInt32ᐳ dep) - } - class IDependencyᐸInt32ᐳ - class Facade { - +Facade() - } - class IService { - <> - } Composition ..> Service : IService Root Service *-- IDependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ IDependencyᐸInt32ᐳ o-- "Singleton" Facade : Facade + namespace Pure.DI.UsageTests.Basics.BindAttributeForGenericTypeScenario { + class Composition { + <> + +IService Root + } + class Facade { + +Facade() + } + class IDependencyᐸInt32ᐳ { + <> + } + class IService { + <> + } + class Service { + +Service(IDependencyᐸInt32ᐳ dep) + } + } ``` diff --git a/readme/bind-attribute-with-lifetime-and-tag.md b/readme/bind-attribute-with-lifetime-and-tag.md index 41c80f81..fc177f3d 100644 --- a/readme/bind-attribute-with-lifetime-and-tag.md +++ b/readme/bind-attribute-with-lifetime-and-tag.md @@ -99,24 +99,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dep) - } - class IDependency - class Facade { - +Facade() - } - class IService { - <> - } Composition ..> Service : IService Root Service o-- "Singleton" IDependency : "my tag" IDependency IDependency o-- "Singleton" Facade : Facade + namespace Pure.DI.UsageTests.Basics.BindAttributeWithLifetimeAndTagScenario { + class Composition { + <> + +IService Root + } + class Facade { + +Facade() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dep) + } + } ``` diff --git a/readme/bind-attribute.md b/readme/bind-attribute.md index d2288934..55359d9a 100644 --- a/readme/bind-attribute.md +++ b/readme/bind-attribute.md @@ -99,24 +99,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dep) - } - class IDependency - class Facade { - +Facade() - } - class IService { - <> - } Composition ..> Service : IService Root Service *-- IDependency : IDependency IDependency o-- "Singleton" Facade : Facade + namespace Pure.DI.UsageTests.Basics.BindAttributeScenario { + class Composition { + <> + +IService Root + } + class Facade { + +Facade() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dep) + } + } ``` diff --git a/readme/build-up-of-an-existing-generic-object.md b/readme/build-up-of-an-existing-generic-object.md index acdd6260..a60afc1d 100644 --- a/readme/build-up-of-an-existing-generic-object.md +++ b/readme/build-up-of-an-existing-generic-object.md @@ -92,35 +92,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IServiceᐸGuidᐳ GetMyService(string name) - } ServiceᐸGuidᐳ --|> IServiceᐸGuidᐳ ServiceᐸGuidᐳ --|> IEquatableᐸServiceᐸGuidᐳᐳ - class ServiceᐸGuidᐳ { - +Service(IDependencyᐸGuidᐳ Dependency) - } DependencyᐸGuidᐳ --|> IDependencyᐸGuidᐳ - class DependencyᐸGuidᐳ { - +String Name - +SetId(T id) : Void - } - class String - class Guid - class IServiceᐸGuidᐳ { - <> - } - class IEquatableᐸServiceᐸGuidᐳᐳ { - <> - } - class IDependencyᐸGuidᐳ { - <> - } Composition ..> ServiceᐸGuidᐳ : IServiceᐸGuidᐳ GetMyService(string name) ServiceᐸGuidᐳ *-- DependencyᐸGuidᐳ : IDependencyᐸGuidᐳ DependencyᐸGuidᐳ o-- String : Argument "name" DependencyᐸGuidᐳ *-- Guid : Guid + namespace Pure.DI.UsageTests.Basics.GenericBuildUpScenario { + class Composition { + <> + +IServiceᐸGuidᐳ GetMyService(string name) + } + class DependencyᐸGuidᐳ { + +String Name + +SetId(T id) : Void + } + class IDependencyᐸGuidᐳ { + <> + } + class IServiceᐸGuidᐳ { + <> + } + class ServiceᐸGuidᐳ { + <> + +Service(IDependencyᐸGuidᐳ Dependency) + } + } + namespace System { + class Guid { + <> + } + class IEquatableᐸServiceᐸGuidᐳᐳ { + <> + } + class String { + } + } ``` diff --git a/readme/build-up-of-an-existing-object.md b/readme/build-up-of-an-existing-object.md index cf0c39a6..1eed6fc1 100644 --- a/readme/build-up-of-an-existing-object.md +++ b/readme/build-up-of-an-existing-object.md @@ -88,35 +88,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService GetMyService(string name) - } Service --|> IService Service --|> IEquatableᐸServiceᐳ - class Service { - +Service(IDependency Dependency) - } Dependency --|> IDependency - class Dependency { - +String Name - +SetId(Guid id) : Void - } - class String - class Guid - class IService { - <> - } - class IEquatableᐸServiceᐳ { - <> - } - class IDependency { - <> - } Composition ..> Service : IService GetMyService(string name) Service *-- Dependency : IDependency Dependency o-- String : Argument "name" Dependency *-- Guid : Guid + namespace Pure.DI.UsageTests.Basics.BuildUpScenario { + class Composition { + <> + +IService GetMyService(string name) + } + class Dependency { + +String Name + +SetId(Guid id) : Void + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + <> + +Service(IDependency Dependency) + } + } + namespace System { + class Guid { + <> + } + class IEquatableᐸServiceᐳ { + <> + } + class String { + } + } ``` diff --git a/readme/check-for-a-root.md b/readme/check-for-a-root.md index faf2abbd..12e178af 100644 --- a/readme/check-for-a-root.md +++ b/readme/check-for-a-root.md @@ -242,8 +242,19 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency : "MyDepTag" + Composition ..> Service : IService Root + Composition ..> Dependency : IDependency _ + Service *-- Dependency : "MyDepTag" IDependency + namespace Pure.DI.UsageTests.Hints.CheckForRootScenario { + class Composition { <> +IService Root -IDependency _ @@ -251,24 +262,20 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + +IDependency Dependency + } } - Service --|> IService - class Service { - +Service() - +IDependency Dependency - } - Dependency --|> IDependency : "MyDepTag" - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Composition ..> Dependency : IDependency _ - Service *-- Dependency : "MyDepTag" IDependency ``` diff --git a/readme/class-arguments.md b/readme/class-arguments.md index ca3029cc..64f6ac85 100644 --- a/readme/class-arguments.md +++ b/readme/class-arguments.md @@ -108,31 +108,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service(String name, IDependency dependency) - } - class String Dependency --|> IDependency - class Dependency { - +Dependency(Int32 id, String name) - } - class Int32 - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyService Service o-- String : "my service name" Argument "serviceName" Service *-- Dependency : IDependency Dependency o-- Int32 : Argument "id" Dependency o-- String : Argument "dependencyName" + namespace Pure.DI.UsageTests.Basics.ClassArgumentsScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + +Dependency(Int32 id, String name) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(String name, IDependency dependency) + } + } + namespace System { + class Int32 { + <> + } + class String { + } + } ``` diff --git a/readme/complex-generics.md b/readme/complex-generics.md index ece7cd08..4df54416 100644 --- a/readme/complex-generics.md +++ b/readme/complex-generics.md @@ -115,36 +115,51 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +ProgramᐸT1ᐳ GetRootᐸT1ᐳ(T1 depArg) - } ServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ --|> IServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ - class ServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ { - +Service(IDependencyᐸT1ᐳ dependency1, IDependencyᐸInt32ᐳ dependency2) - } DependencyStructᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ : "value type" - class DependencyStructᐸInt32ᐳ { - +DependencyStruct() - } DependencyᐸT1ᐳ --|> IDependencyᐸT1ᐳ - class DependencyᐸT1ᐳ { - +Dependency(T1 value) - } - class IServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ { - <> - } - class IDependencyᐸInt32ᐳ { - <> - } - class IDependencyᐸT1ᐳ { - <> - } Composition ..> ProgramᐸT1ᐳ : ProgramᐸT1ᐳ GetRootᐸT1ᐳ(T1 depArg) ProgramᐸT1ᐳ *-- ServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ : IServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ ServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ *-- DependencyᐸT1ᐳ : IDependencyᐸT1ᐳ ServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ o-- "Singleton" DependencyStructᐸInt32ᐳ : "value type" IDependencyᐸInt32ᐳ DependencyᐸT1ᐳ o-- T1 : Argument "depArg" + namespace Pure.DI { + class T1 { + <> + } + } + namespace Pure.DI.UsageTests.Generics.ComplexGenericsScenario { + class Composition { + <> + +ProgramᐸT1ᐳ GetRootᐸT1ᐳ(T1 depArg) + } + class DependencyStructᐸInt32ᐳ { + <> + +DependencyStruct() + } + class DependencyᐸT1ᐳ { + +Dependency(T1 value) + } + class IDependencyᐸInt32ᐳ { + <> + } + class IDependencyᐸT1ᐳ { + <> + } + class IServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ { + <> + } + class ProgramᐸT1ᐳ { + } + class ServiceᐸT1ˏInt32ˏListᐸT1ᐳˏDictionaryᐸT1ˏInt32ᐳᐳ { + +Service(IDependencyᐸT1ᐳ dependency1, IDependencyᐸInt32ᐳ dependency2) + } + } ``` diff --git a/readme/composition-root-kinds.md b/readme/composition-root-kinds.md index 587f8d3a..0cf21f3b 100644 --- a/readme/composition-root-kinds.md +++ b/readme/composition-root-kinds.md @@ -231,8 +231,21 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Dependency --|> IDependency + Service --|> IService + OtherService --|> IService : "Other" + Composition ..> Dependency : IDependency Dependency + Composition ..> Service : IService GetRoot() + Composition ..> OtherService : IService GetOtherService() + Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario { + class Composition { <> +IDependency Dependency +IService GetOtherService() @@ -241,28 +254,22 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class OtherService { + +OtherService() + } + class Service { + +Service(IDependency dependency) + } } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - OtherService --|> IService : "Other" - class OtherService { - +OtherService() - } - class IDependency { - <> - } - class IService { - <> - } - Composition ..> Dependency : IDependency Dependency - Composition ..> Service : IService GetRoot() - Composition ..> OtherService : IService GetOtherService() - Service *-- Dependency : IDependency ``` diff --git a/readme/composition-roots.md b/readme/composition-roots.md index 4747417e..74585173 100644 --- a/readme/composition-roots.md +++ b/readme/composition-roots.md @@ -263,8 +263,21 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + OtherService --|> IService : "Other" + Dependency --|> IDependency + Service --|> IService + Composition ..> OtherService : IService MyOtherService + Composition ..> Dependency : IDependency _ + Composition ..> Service : IService MyService + Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.CompositionRootsScenario { + class Composition { <> +IService MyOtherService +IService MyService @@ -273,28 +286,22 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class OtherService { + +OtherService() + } + class Service { + +Service(IDependency dependency) + } } - OtherService --|> IService : "Other" - class OtherService { - +OtherService() - } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> OtherService : IService MyOtherService - Composition ..> Dependency : IDependency _ - Composition ..> Service : IService MyService - Service *-- Dependency : IDependency ``` diff --git a/readme/constructor-ordinal-attribute.md b/readme/constructor-ordinal-attribute.md index f9c50173..2eb27dbd 100644 --- a/readme/constructor-ordinal-attribute.md +++ b/readme/constructor-ordinal-attribute.md @@ -81,20 +81,30 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Composition ..> Service : IService Root + Service o-- String : Argument "serviceName" + namespace Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario { + class Composition { <> +IService Root + } + class IService { + <> + } + class Service { + ~Service(String name) + } } - Service --|> IService - class Service { - ~Service(String name) + namespace System { + class String { + } } - class String - class IService { - <> - } - Composition ..> Service : IService Root - Service o-- String : Argument "serviceName" ``` diff --git a/readme/custom-attributes.md b/readme/custom-attributes.md index 7e412bea..fc53ea9a 100644 --- a/readme/custom-attributes.md +++ b/readme/custom-attributes.md @@ -109,42 +109,57 @@ partial class PersonComposition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class PersonComposition { - <> - +IPerson Person - } Person --|> IPerson - class Person { - +Person(String name) - ~Object Id - +Initialize(Object state) : Void - } - class String - class Int32 Uri --|> IFormattable Uri --|> ISpanFormattable Uri --|> IEquatableᐸUriᐳ Uri --|> ISerializable - class Uri - class IPerson { - <> - } - class IFormattable { - <> - } - class ISpanFormattable { - <> - } - class IEquatableᐸUriᐳ { - <> - } - class ISerializable { - <> - } PersonComposition ..> Person : IPerson Person Person *-- String : "NikName" String Person o-- Int32 : Argument "personId" Person *-- Uri : Uri + namespace Pure.DI.UsageTests.Attributes.CustomAttributesScenario { + class IPerson { + <> + } + class Person { + +Person(String name) + ~Object Id + +Initialize(Object state) : Void + } + class PersonComposition { + <> + +IPerson Person + } + } + namespace System { + class IEquatableᐸUriᐳ { + <> + } + class IFormattable { + <> + } + class Int32 { + <> + } + class ISpanFormattable { + <> + } + class String { + } + class Uri { + } + } + namespace System.Runtime.Serialization { + class ISerializable { + <> + } + } ``` diff --git a/readme/custom-generic-argument-attribute.md b/readme/custom-generic-argument-attribute.md index d2dfa0a8..2b2c6c9e 100644 --- a/readme/custom-generic-argument-attribute.md +++ b/readme/custom-generic-argument-attribute.md @@ -192,38 +192,45 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + DependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ + DependencyᐸStringᐳ --|> IDependencyᐸStringᐳ + Composition ..> Service : IService Root + Service *-- DependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ + Service *-- DependencyᐸStringᐳ : IDependencyᐸStringᐳ + namespace Pure.DI.UsageTests.Attributes.CustomGenericArgumentAttributeScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class DependencyᐸInt32ᐳ { + +Dependency() + } + class DependencyᐸStringᐳ { + +Dependency() + } + class IDependencyᐸInt32ᐳ { + <> + } + class IDependencyᐸStringᐳ { + <> + } + class IService { + <> + } + class Service { + +Service(IDependencyᐸInt32ᐳ intDependency, IDependencyᐸStringᐳ stringDependency) + } } - Service --|> IService - class Service { - +Service(IDependencyᐸInt32ᐳ intDependency, IDependencyᐸStringᐳ stringDependency) - } - DependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ - class DependencyᐸInt32ᐳ { - +Dependency() - } - DependencyᐸStringᐳ --|> IDependencyᐸStringᐳ - class DependencyᐸStringᐳ { - +Dependency() - } - class IService { - <> - } - class IDependencyᐸInt32ᐳ { - <> - } - class IDependencyᐸStringᐳ { - <> - } - Composition ..> Service : IService Root - Service *-- DependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ - Service *-- DependencyᐸStringᐳ : IDependencyᐸStringᐳ ``` diff --git a/readme/custom-generic-argument.md b/readme/custom-generic-argument.md index 8f686389..adc0e749 100644 --- a/readme/custom-generic-argument.md +++ b/readme/custom-generic-argument.md @@ -188,38 +188,45 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + DependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ + DependencyᐸStringᐳ --|> IDependencyᐸStringᐳ + Composition ..> Service : IService Root + Service *-- DependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ + Service *-- DependencyᐸStringᐳ : IDependencyᐸStringᐳ + namespace Pure.DI.UsageTests.Generics.CustomGenericArgumentScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class DependencyᐸInt32ᐳ { + +Dependency() + } + class DependencyᐸStringᐳ { + +Dependency() + } + class IDependencyᐸInt32ᐳ { + <> + } + class IDependencyᐸStringᐳ { + <> + } + class IService { + <> + } + class Service { + +Service(IDependencyᐸInt32ᐳ intDependency, IDependencyᐸStringᐳ stringDependency) + } } - Service --|> IService - class Service { - +Service(IDependencyᐸInt32ᐳ intDependency, IDependencyᐸStringᐳ stringDependency) - } - DependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ - class DependencyᐸInt32ᐳ { - +Dependency() - } - DependencyᐸStringᐳ --|> IDependencyᐸStringᐳ - class DependencyᐸStringᐳ { - +Dependency() - } - class IService { - <> - } - class IDependencyᐸInt32ᐳ { - <> - } - class IDependencyᐸStringᐳ { - <> - } - Composition ..> Service : IService Root - Service *-- DependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ - Service *-- DependencyᐸStringᐳ : IDependencyᐸStringᐳ ``` diff --git a/readme/custom-universal-attribute.md b/readme/custom-universal-attribute.md index 744221f0..0a527100 100644 --- a/readme/custom-universal-attribute.md +++ b/readme/custom-universal-attribute.md @@ -86,42 +86,57 @@ partial class PersonComposition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class PersonComposition { - <> - +IPerson Person - } Person --|> IPerson - class Person { - +Person(String name) - ~Object Id - +Initialize(Object state) : Void - } - class String - class Int32 Uri --|> IFormattable Uri --|> ISpanFormattable Uri --|> IEquatableᐸUriᐳ Uri --|> ISerializable - class Uri - class IPerson { - <> - } - class IFormattable { - <> - } - class ISpanFormattable { - <> - } - class IEquatableᐸUriᐳ { - <> - } - class ISerializable { - <> - } PersonComposition ..> Person : IPerson Person Person *-- String : "NikName" String Person o-- Int32 : Argument "personId" Person *-- Uri : Uri + namespace Pure.DI.UsageTests.Attributes.CustomUniversalAttributeScenario { + class IPerson { + <> + } + class Person { + +Person(String name) + ~Object Id + +Initialize(Object state) : Void + } + class PersonComposition { + <> + +IPerson Person + } + } + namespace System { + class IEquatableᐸUriᐳ { + <> + } + class IFormattable { + <> + } + class Int32 { + <> + } + class ISpanFormattable { + <> + } + class String { + } + class Uri { + } + } + namespace System.Runtime.Serialization { + class ISerializable { + <> + } + } ``` diff --git a/readme/decorator.md b/readme/decorator.md index 6458a394..b3b777c1 100644 --- a/readme/decorator.md +++ b/readme/decorator.md @@ -67,23 +67,30 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } GreetingService --|> IService - class GreetingService { - +GreetingService(IService baseService) - } Service --|> IService : "base" - class Service { - +Service() - } - class IService { - <> - } Composition ..> GreetingService : IService Root GreetingService *-- Service : "base" IService + namespace Pure.DI.UsageTests.Interception.DecoratorScenario { + class Composition { + <> + +IService Root + } + class GreetingService { + +GreetingService(IService baseService) + } + class IService { + <> + } + class Service { + +Service() + } + } ``` 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 1038e287..01e02a52 100644 --- a/readme/default-lifetime-for-a-type-and-a-tag.md +++ b/readme/default-lifetime-for-a-type-and-a-tag.md @@ -105,27 +105,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } Dependency --|> IDependency : "some tag" - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "Singleton" Dependency : "some tag" IDependency Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.DefaultLifetimeForTypeAndTagScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + } ``` diff --git a/readme/default-lifetime-for-a-type.md b/readme/default-lifetime-for-a-type.md index b394f720..e0d0a95e 100644 --- a/readme/default-lifetime-for-a-type.md +++ b/readme/default-lifetime-for-a-type.md @@ -92,26 +92,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "2 Singleton instances" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.DefaultLifetimeForTypeScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + } ``` diff --git a/readme/default-lifetime.md b/readme/default-lifetime.md index e5276f11..c09ac514 100644 --- a/readme/default-lifetime.md +++ b/readme/default-lifetime.md @@ -100,26 +100,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "2 Singleton instances" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + } ``` diff --git a/readme/default-values.md b/readme/default-values.md index 3e24c2e2..8393cafb 100644 --- a/readme/default-values.md +++ b/readme/default-values.md @@ -69,27 +69,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(String name) - +IDependency Dependency - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.DefaultValuesScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(String name) + +IDependency Dependency + } + } ``` diff --git a/readme/dependent-compositions.md b/readme/dependent-compositions.md index 24a491ab..6a1b7dda 100644 --- a/readme/dependent-compositions.md +++ b/readme/dependent-compositions.md @@ -367,8 +367,29 @@ partial class OtherComposition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class OtherComposition { + Service --|> IService + Dependency --|> IDependency + OtherComposition ..> Program : Program Program + OtherComposition ..> Service : IService Root + Program *-- Service : IService + Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Advanced.DependentCompositionsScenario { + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class OtherComposition { <> +Program Program +IService Root @@ -376,24 +397,12 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Program { + } + class Service { + +Service(IDependency dependency) + } } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - OtherComposition ..> Program : Program Program - OtherComposition ..> Service : IService Root - Program *-- Service : IService - Service *-- Dependency : IDependency ``` diff --git a/readme/disposable-singleton.md b/readme/disposable-singleton.md index 2f553ca8..ce9b9698 100644 --- a/readme/disposable-singleton.md +++ b/readme/disposable-singleton.md @@ -133,27 +133,39 @@ partial class Composition: IDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Composition --|> IDisposable Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } + namespace System { + class IDisposable { + <> + } + } ``` diff --git a/readme/enumerable-generics.md b/readme/enumerable-generics.md index 4eaca6e4..82304d2c 100644 --- a/readme/enumerable-generics.md +++ b/readme/enumerable-generics.md @@ -237,54 +237,18 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IServiceᐸInt32ᐳ IntRoot - +IServiceᐸStringᐳ StringRoot - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } ServiceᐸStringᐳ --|> IServiceᐸStringᐳ - class ServiceᐸStringᐳ { - +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) - } ServiceᐸInt32ᐳ --|> IServiceᐸInt32ᐳ - class ServiceᐸInt32ᐳ { - +Service(IEnumerableᐸIDependencyᐸInt32ᐳᐳ dependencies) - } - class IEnumerableᐸIDependencyᐸStringᐳᐳ - class IEnumerableᐸIDependencyᐸInt32ᐳᐳ AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ - class AbcDependencyᐸStringᐳ { - +AbcDependency() - } XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : "Xyz" - class XyzDependencyᐸStringᐳ { - +XyzDependency() - } AbcDependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ - class AbcDependencyᐸInt32ᐳ { - +AbcDependency() - } XyzDependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ : "Xyz" - class XyzDependencyᐸInt32ᐳ { - +XyzDependency() - } - class IServiceᐸStringᐳ { - <> - } - class IServiceᐸInt32ᐳ { - <> - } - class IDependencyᐸStringᐳ { - <> - } - class IDependencyᐸInt32ᐳ { - <> - } Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ StringRoot Composition ..> ServiceᐸInt32ᐳ : IServiceᐸInt32ᐳ IntRoot ServiceᐸStringᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ @@ -293,5 +257,54 @@ classDiagram IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : "Xyz" IDependencyᐸStringᐳ IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- AbcDependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- XyzDependencyᐸInt32ᐳ : "Xyz" IDependencyᐸInt32ᐳ + namespace Pure.DI.UsageTests.BCL.EnumerableGenericsScenario { + class AbcDependencyᐸInt32ᐳ { + +AbcDependency() + } + class AbcDependencyᐸStringᐳ { + +AbcDependency() + } + class Composition { + <> + +IServiceᐸInt32ᐳ IntRoot + +IServiceᐸStringᐳ StringRoot + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + class IDependencyᐸInt32ᐳ { + <> + } + class IDependencyᐸStringᐳ { + <> + } + class IServiceᐸInt32ᐳ { + <> + } + class IServiceᐸStringᐳ { + <> + } + class ServiceᐸInt32ᐳ { + +Service(IEnumerableᐸIDependencyᐸInt32ᐳᐳ dependencies) + } + class ServiceᐸStringᐳ { + +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) + } + class XyzDependencyᐸInt32ᐳ { + +XyzDependency() + } + class XyzDependencyᐸStringᐳ { + +XyzDependency() + } + } + namespace System.Collections.Generic { + class IEnumerableᐸIDependencyᐸInt32ᐳᐳ { + <> + } + class IEnumerableᐸIDependencyᐸStringᐳᐳ { + <> + } + } ``` diff --git a/readme/enumerable.md b/readme/enumerable.md index b6e20383..de3949b7 100644 --- a/readme/enumerable.md +++ b/readme/enumerable.md @@ -192,37 +192,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + AbcDependency --|> IDependency + XyzDependency --|> IDependency : 2 + Composition ..> Service : IService Root + Service o-- "PerBlock" IEnumerableᐸIDependencyᐳ : IEnumerableᐸIDependencyᐳ + IEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency + IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency + namespace Pure.DI.UsageTests.BCL.EnumerableScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IEnumerableᐸIDependencyᐳ dependencies) + } + class XyzDependency { + +XyzDependency() + } } - Service --|> IService - class Service { - +Service(IEnumerableᐸIDependencyᐳ dependencies) - } - class IEnumerableᐸIDependencyᐳ - AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - XyzDependency --|> IDependency : 2 - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> + namespace System.Collections.Generic { + class IEnumerableᐸIDependencyᐳ { + <> + } } - Composition ..> Service : IService Root - Service o-- "PerBlock" IEnumerableᐸIDependencyᐳ : IEnumerableᐸIDependencyᐳ - IEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency - IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency ``` diff --git a/readme/factory.md b/readme/factory.md index ffebfcef..ceb23795 100644 --- a/readme/factory.md +++ b/readme/factory.md @@ -128,28 +128,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService GetMyService(bool isFake) - } Service --|> IService - class Service { - +Service(IDependency dependency) - } - class IDependency - class Boolean - class Dependency { - +Dependency(DateTimeOffset time) - } - class DateTimeOffset - class IService { - <> - } Composition ..> Service : IService GetMyService(bool isFake) Service *-- IDependency : IDependency IDependency o-- Boolean : "FakeArgTag" Argument "isFake" IDependency *-- Dependency : Dependency Dependency *-- DateTimeOffset : DateTimeOffset + namespace Pure.DI.UsageTests.Basics.FactoryScenario { + class Composition { + <> + +IService GetMyService(bool isFake) + } + class Dependency { + +Dependency(DateTimeOffset time) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } + namespace System { + class Boolean { + <> + } + class DateTimeOffset { + <> + } + } ``` diff --git a/readme/field-injection.md b/readme/field-injection.md index a4429bc8..8065562f 100644 --- a/readme/field-injection.md +++ b/readme/field-injection.md @@ -71,27 +71,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service() - ~IDependency DependencyVal - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyService Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.FieldInjectionScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + ~IDependency DependencyVal + } + } ``` diff --git a/readme/func-with-arguments.md b/readme/func-with-arguments.md index 0bc0e7d6..af40613c 100644 --- a/readme/func-with-arguments.md +++ b/readme/func-with-arguments.md @@ -256,39 +256,52 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Service --|> IService - class Service { - +Service(FuncᐸInt32ˏInt32ˏIDependencyᐳ dependencyFactory) - } - class FuncᐸInt32ˏInt32ˏIDependencyᐳ - class Dependency { - +Dependency(IClock clock, Int32 id, Int32 subId) - } Clock --|> IClock - class Clock { - +Clock() - } - class Int32 - class IService { - <> - } - class IClock { - <> - } Composition ..> Service : IService Root Service *-- FuncᐸInt32ˏInt32ˏIDependencyᐳ : FuncᐸInt32ˏInt32ˏIDependencyᐳ FuncᐸInt32ˏInt32ˏIDependencyᐳ *-- Dependency : Dependency Dependency o-- "Singleton" Clock : IClock Dependency *-- Int32 : Int32 Dependency *-- Int32 : "sub" Int32 + namespace Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario { + class Clock { + +Clock() + } + class Composition { + <> + +IService Root + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency(IClock clock, Int32 id, Int32 subId) + } + class IClock { + <> + } + class IService { + <> + } + class Service { + +Service(FuncᐸInt32ˏInt32ˏIDependencyᐳ dependencyFactory) + } + } + namespace System { + class FuncᐸInt32ˏInt32ˏIDependencyᐳ { + <> + } + class Int32 { + <> + } + } ``` diff --git a/readme/func-with-tag.md b/readme/func-with-tag.md index 8c333c05..cad2f6a1 100644 --- a/readme/func-with-tag.md +++ b/readme/func-with-tag.md @@ -187,32 +187,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency : "my tag" + Composition ..> Service : IService Root + Service o-- "PerBlock" FuncᐸIDependencyᐳ : "my tag" FuncᐸIDependencyᐳ + FuncᐸIDependencyᐳ *-- Dependency : "my tag" IDependency + namespace Pure.DI.UsageTests.BCL.FuncWithTagScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(FuncᐸIDependencyᐳ dependencyFactory) + } } - Service --|> IService - class Service { - +Service(FuncᐸIDependencyᐳ dependencyFactory) + namespace System { + class FuncᐸIDependencyᐳ { + <> + } } - class FuncᐸIDependencyᐳ - Dependency --|> IDependency : "my tag" - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service o-- "PerBlock" FuncᐸIDependencyᐳ : "my tag" FuncᐸIDependencyᐳ - FuncᐸIDependencyᐳ *-- Dependency : "my tag" IDependency ``` diff --git a/readme/func.md b/readme/func.md index 69faaec7..8acdaecf 100644 --- a/readme/func.md +++ b/readme/func.md @@ -190,32 +190,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService Root + Service o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ + FuncᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.FuncScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(FuncᐸIDependencyᐳ dependencyFactory) + } } - Service --|> IService - class Service { - +Service(FuncᐸIDependencyᐳ dependencyFactory) + namespace System { + class FuncᐸIDependencyᐳ { + <> + } } - class FuncᐸIDependencyᐳ - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ - FuncᐸIDependencyᐳ *-- Dependency : IDependency ``` diff --git a/readme/generic-async-composition-roots-with-constraints.md b/readme/generic-async-composition-roots-with-constraints.md index d48af63e..84719d28 100644 --- a/readme/generic-async-composition-roots-with-constraints.md +++ b/readme/generic-async-composition-roots-with-constraints.md @@ -145,39 +145,15 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +TaskᐸIServiceᐸT2ˏTᐳᐳ GetMyRootAsyncᐸT2ˏTᐳ(System.Threading.CancellationToken cancellationToken) - +TaskᐸIServiceᐸT2ˏBooleanᐳᐳ GetOtherServiceAsyncᐸT2ᐳ(System.Threading.CancellationToken cancellationToken) - } - class FuncᐸIServiceᐸT2ˏBooleanᐳᐳ - class TaskFactoryᐸIServiceᐸT2ˏBooleanᐳᐳ - class FuncᐸIServiceᐸT2ˏTᐳᐳ - class TaskFactoryᐸIServiceᐸT2ˏTᐳᐳ OtherServiceᐸT2ᐳ --|> IServiceᐸT2ˏBooleanᐳ : "Other" - class OtherServiceᐸT2ᐳ - class CancellationToken - class TaskCreationOptions - class TaskContinuationOptions - class TaskScheduler ServiceᐸT2ˏTᐳ --|> IServiceᐸT2ˏTᐳ - class ServiceᐸT2ˏTᐳ { - +Service(IDependencyᐸT2ᐳ dependency) - } DependencyᐸT2ᐳ --|> IDependencyᐸT2ᐳ - class DependencyᐸT2ᐳ { - +Dependency() - } - class IServiceᐸT2ˏBooleanᐳ { - <> - } - class IServiceᐸT2ˏTᐳ { - <> - } - class IDependencyᐸT2ᐳ { - <> - } Composition ..> TaskᐸIServiceᐸT2ˏBooleanᐳᐳ : TaskᐸIServiceᐸT2ˏBooleanᐳᐳ GetOtherServiceAsyncᐸT2ᐳ(System.Threading.CancellationToken cancellationToken) Composition ..> TaskᐸIServiceᐸT2ˏTᐳᐳ : TaskᐸIServiceᐸT2ˏTᐳᐳ GetMyRootAsyncᐸT2ˏTᐳ(System.Threading.CancellationToken cancellationToken) TaskᐸIServiceᐸT2ˏBooleanᐳᐳ o-- "PerBlock" FuncᐸIServiceᐸT2ˏBooleanᐳᐳ : "Other" FuncᐸIServiceᐸT2ˏBooleanᐳᐳ @@ -196,5 +172,61 @@ classDiagram TaskFactoryᐸIServiceᐸT2ˏTᐳᐳ *-- TaskScheduler : TaskScheduler OtherServiceᐸT2ᐳ *-- DependencyᐸT2ᐳ : IDependencyᐸT2ᐳ ServiceᐸT2ˏTᐳ *-- DependencyᐸT2ᐳ : IDependencyᐸT2ᐳ + namespace Pure.DI.UsageTests.Generics.GenericAsyncCompositionRootsWithConstraintsScenario { + class Composition { + <> + +TaskᐸIServiceᐸT2ˏTᐳᐳ GetMyRootAsyncᐸT2ˏTᐳ(System.Threading.CancellationToken cancellationToken) + +TaskᐸIServiceᐸT2ˏBooleanᐳᐳ GetOtherServiceAsyncᐸT2ᐳ(System.Threading.CancellationToken cancellationToken) + } + class DependencyᐸT2ᐳ { + +Dependency() + } + class IDependencyᐸT2ᐳ { + <> + } + class IServiceᐸT2ˏBooleanᐳ { + <> + } + class IServiceᐸT2ˏTᐳ { + <> + } + class OtherServiceᐸT2ᐳ { + } + class ServiceᐸT2ˏTᐳ { + +Service(IDependencyᐸT2ᐳ dependency) + } + } + namespace System { + class FuncᐸIServiceᐸT2ˏBooleanᐳᐳ { + <> + } + class FuncᐸIServiceᐸT2ˏTᐳᐳ { + <> + } + } + namespace System.Threading { + class CancellationToken { + <> + } + } + namespace System.Threading.Tasks { + class TaskContinuationOptions { + <> + } + class TaskCreationOptions { + <> + } + class TaskFactoryᐸIServiceᐸT2ˏBooleanᐳᐳ { + } + class TaskFactoryᐸIServiceᐸT2ˏTᐳᐳ { + } + class TaskScheduler { + <> + } + class TaskᐸIServiceᐸT2ˏBooleanᐳᐳ { + } + class TaskᐸIServiceᐸT2ˏTᐳᐳ { + } + } ``` diff --git a/readme/generic-composition-roots-with-constraints.md b/readme/generic-composition-roots-with-constraints.md index b4ac6a78..53d643c3 100644 --- a/readme/generic-composition-roots-with-constraints.md +++ b/readme/generic-composition-roots-with-constraints.md @@ -101,34 +101,42 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IServiceᐸT2ˏTᐳ GetMyRootᐸT2ˏTᐳ() - +IServiceᐸT2ˏBooleanᐳ GetOtherServiceᐸT2ᐳ() - } OtherServiceᐸT2ᐳ --|> IServiceᐸT2ˏBooleanᐳ : "Other" - class OtherServiceᐸT2ᐳ ServiceᐸT2ˏTᐳ --|> IServiceᐸT2ˏTᐳ - class ServiceᐸT2ˏTᐳ { - +Service(IDependencyᐸT2ᐳ dependency) - } DependencyᐸT2ᐳ --|> IDependencyᐸT2ᐳ - class DependencyᐸT2ᐳ { - +Dependency() - } - class IServiceᐸT2ˏBooleanᐳ { - <> - } - class IServiceᐸT2ˏTᐳ { - <> - } - class IDependencyᐸT2ᐳ { - <> - } Composition ..> OtherServiceᐸT2ᐳ : IServiceᐸT2ˏBooleanᐳ GetOtherServiceᐸT2ᐳ() Composition ..> ServiceᐸT2ˏTᐳ : IServiceᐸT2ˏTᐳ GetMyRootᐸT2ˏTᐳ() OtherServiceᐸT2ᐳ *-- DependencyᐸT2ᐳ : IDependencyᐸT2ᐳ ServiceᐸT2ˏTᐳ *-- DependencyᐸT2ᐳ : IDependencyᐸT2ᐳ + namespace Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario { + class Composition { + <> + +IServiceᐸT2ˏTᐳ GetMyRootᐸT2ˏTᐳ() + +IServiceᐸT2ˏBooleanᐳ GetOtherServiceᐸT2ᐳ() + } + class DependencyᐸT2ᐳ { + +Dependency() + } + class IDependencyᐸT2ᐳ { + <> + } + class IServiceᐸT2ˏBooleanᐳ { + <> + } + class IServiceᐸT2ˏTᐳ { + <> + } + class OtherServiceᐸT2ᐳ { + } + class ServiceᐸT2ˏTᐳ { + +Service(IDependencyᐸT2ᐳ dependency) + } + } ``` diff --git a/readme/generic-composition-roots.md b/readme/generic-composition-roots.md index 90f487a3..b84020ce 100644 --- a/readme/generic-composition-roots.md +++ b/readme/generic-composition-roots.md @@ -92,31 +92,39 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IServiceᐸT1ᐳ GetMyRootᐸT1ᐳ() - +IServiceᐸT1ᐳ GetOtherServiceᐸT1ᐳ() - } OtherServiceᐸT1ᐳ --|> IServiceᐸT1ᐳ : "Other" - class OtherServiceᐸT1ᐳ ServiceᐸT1ᐳ --|> IServiceᐸT1ᐳ - class ServiceᐸT1ᐳ { - +Service(IDependencyᐸT1ᐳ dependency) - } DependencyᐸT1ᐳ --|> IDependencyᐸT1ᐳ - class DependencyᐸT1ᐳ { - +Dependency() - } - class IServiceᐸT1ᐳ { - <> - } - class IDependencyᐸT1ᐳ { - <> - } Composition ..> OtherServiceᐸT1ᐳ : IServiceᐸT1ᐳ GetOtherServiceᐸT1ᐳ() Composition ..> ServiceᐸT1ᐳ : IServiceᐸT1ᐳ GetMyRootᐸT1ᐳ() OtherServiceᐸT1ᐳ *-- DependencyᐸT1ᐳ : IDependencyᐸT1ᐳ ServiceᐸT1ᐳ *-- DependencyᐸT1ᐳ : IDependencyᐸT1ᐳ + namespace Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario { + class Composition { + <> + +IServiceᐸT1ᐳ GetMyRootᐸT1ᐳ() + +IServiceᐸT1ᐳ GetOtherServiceᐸT1ᐳ() + } + class DependencyᐸT1ᐳ { + +Dependency() + } + class IDependencyᐸT1ᐳ { + <> + } + class IServiceᐸT1ᐳ { + <> + } + class OtherServiceᐸT1ᐳ { + } + class ServiceᐸT1ᐳ { + +Service(IDependencyᐸT1ᐳ dependency) + } + } ``` diff --git a/readme/generic-root-arguments.md b/readme/generic-root-arguments.md index ea0fd70c..7d380410 100644 --- a/readme/generic-root-arguments.md +++ b/readme/generic-root-arguments.md @@ -63,20 +63,32 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IServiceᐸT1ᐳ GetMyServiceᐸT1ᐳ(T1 someArg) - } ServiceᐸT1ᐳ --|> IServiceᐸT1ᐳ - class ServiceᐸT1ᐳ { - +Service() - +SetDependency(T1 dependency) : Void - } - class IServiceᐸT1ᐳ { - <> - } Composition ..> ServiceᐸT1ᐳ : IServiceᐸT1ᐳ GetMyServiceᐸT1ᐳ(T1 someArg) ServiceᐸT1ᐳ o-- T1 : Argument "someArg" + namespace Pure.DI { + class T1 { + <> + } + } + namespace Pure.DI.UsageTests.Basics.GenericRootArgScenario { + class Composition { + <> + +IServiceᐸT1ᐳ GetMyServiceᐸT1ᐳ(T1 someArg) + } + class IServiceᐸT1ᐳ { + <> + } + class ServiceᐸT1ᐳ { + +Service() + +SetDependency(T1 dependency) : Void + } + } ``` diff --git a/readme/generics.md b/readme/generics.md index b85b7a64..c9140300 100644 --- a/readme/generics.md +++ b/readme/generics.md @@ -121,34 +121,41 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependencyᐸInt32ᐳ intDependency, IDependencyᐸStringᐳ stringDependency) - } DependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ - class DependencyᐸInt32ᐳ { - +Dependency() - } DependencyᐸStringᐳ --|> IDependencyᐸStringᐳ - class DependencyᐸStringᐳ { - +Dependency() - } - class IService { - <> - } - class IDependencyᐸInt32ᐳ { - <> - } - class IDependencyᐸStringᐳ { - <> - } Composition ..> Service : IService Root Service *-- DependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ Service *-- DependencyᐸStringᐳ : IDependencyᐸStringᐳ + namespace Pure.DI.UsageTests.Generics.GenericsScenario { + class Composition { + <> + +IService Root + } + class DependencyᐸInt32ᐳ { + +Dependency() + } + class DependencyᐸStringᐳ { + +Dependency() + } + class IDependencyᐸInt32ᐳ { + <> + } + class IDependencyᐸStringᐳ { + <> + } + class IService { + <> + } + class Service { + +Service(IDependencyᐸInt32ᐳ intDependency, IDependencyᐸStringᐳ stringDependency) + } + } ``` diff --git a/readme/inject-attribute.md b/readme/inject-attribute.md index f5ca627a..999b33b2 100644 --- a/readme/inject-attribute.md +++ b/readme/inject-attribute.md @@ -85,26 +85,39 @@ partial class PersonComposition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class PersonComposition { - <> - +IPerson Person - } Person --|> IPerson - class Person { - +Person(String name) - ~Object Id - +Initialize(Object state) : Void - } - class String - class Int32 - class Uri - class IPerson { - <> - } PersonComposition ..> Person : IPerson Person Person *-- String : "NikName" String Person o-- Int32 : Argument "personId" Person *-- Uri : "Person Uri" Uri + namespace Pure.DI.UsageTests.Attributes.InjectAttributeScenario { + class IPerson { + <> + } + class Person { + +Person(String name) + ~Object Id + +Initialize(Object state) : Void + } + class PersonComposition { + <> + +IPerson Person + } + } + namespace System { + class Int32 { + <> + } + class String { + } + class Uri { + } + } ``` diff --git a/readme/injections-of-abstractions.md b/readme/injections-of-abstractions.md index 0bb3e816..05b633e8 100644 --- a/readme/injections-of-abstractions.md +++ b/readme/injections-of-abstractions.md @@ -81,27 +81,36 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Program Root - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Program : Program Root Program *-- Service : IService Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.InjectionsOfAbstractionsScenario { + class Composition { + <> + +Program Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Program { + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/interception.md b/readme/interception.md index 3014f65b..ccd71ca2 100644 --- a/readme/interception.md +++ b/readme/interception.md @@ -109,18 +109,25 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Composition ..> Service : IService Root + namespace Pure.DI.UsageTests.Interception.InterceptionScenario { + class Composition { <> +IService Root + } + class IService { + <> + } + class Service { + +Service() + } } - Service --|> IService - class Service { - +Service() - } - class IService { - <> - } - Composition ..> Service : IService Root ``` diff --git a/readme/keyed-service-provider.md b/readme/keyed-service-provider.md index a57fb692..df80d111 100644 --- a/readme/keyed-service-provider.md +++ b/readme/keyed-service-provider.md @@ -250,8 +250,19 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService : "Service Key" + Dependency --|> IDependency : "Dependency Key" + Composition ..> Service : IService _ + Composition ..> Dependency : IDependency _ + Service o-- "Singleton" Dependency : "Dependency Key" IDependency + namespace Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario { + class Composition { <> -IDependency _ -IService _ @@ -259,23 +270,19 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object GetService(Type type) + object GetRequiredKeyedService(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - Service --|> IService : "Service Key" - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency : "Dependency Key" - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService _ - Composition ..> Dependency : IDependency _ - Service o-- "Singleton" Dependency : "Dependency Key" IDependency ``` diff --git a/readme/lazy.md b/readme/lazy.md index faa60326..5b04e7b8 100644 --- a/readme/lazy.md +++ b/readme/lazy.md @@ -186,34 +186,46 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService Root + Service *-- LazyᐸIDependencyᐳ : LazyᐸIDependencyᐳ + LazyᐸIDependencyᐳ o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ + FuncᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.LazyScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(LazyᐸIDependencyᐳ dependency) + } } - Service --|> IService - class Service { - +Service(LazyᐸIDependencyᐳ dependency) + namespace System { + class FuncᐸIDependencyᐳ { + <> + } + class LazyᐸIDependencyᐳ { + } } - class LazyᐸIDependencyᐳ - class FuncᐸIDependencyᐳ - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service *-- LazyᐸIDependencyᐳ : LazyᐸIDependencyᐳ - LazyᐸIDependencyᐳ o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ - FuncᐸIDependencyᐳ *-- Dependency : IDependency ``` diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index b62f9e83..66d0e81e 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -108,32 +108,50 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService GetRoot(System.Threading.CancellationToken cancellationToken) - } Service --|> IService - class Service { - +Service(TaskᐸIDependencyᐳ dependencyTask) - } - class TaskᐸIDependencyᐳ - class FuncᐸIDependencyᐳ - class CancellationToken Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService GetRoot(System.Threading.CancellationToken cancellationToken) Service *-- TaskᐸIDependencyᐳ : TaskᐸIDependencyᐳ TaskᐸIDependencyᐳ o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ TaskᐸIDependencyᐳ o-- CancellationToken : Argument "cancellationToken" FuncᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.ManualTaskScenario { + class Composition { + <> + +IService GetRoot(System.Threading.CancellationToken cancellationToken) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(TaskᐸIDependencyᐳ dependencyTask) + } + } + namespace System { + class FuncᐸIDependencyᐳ { + <> + } + } + namespace System.Threading { + class CancellationToken { + <> + } + } + namespace System.Threading.Tasks { + class TaskᐸIDependencyᐳ { + } + } ``` diff --git a/readme/member-ordinal-attribute.md b/readme/member-ordinal-attribute.md index 722bf9f0..eacf7258 100644 --- a/readme/member-ordinal-attribute.md +++ b/readme/member-ordinal-attribute.md @@ -110,27 +110,41 @@ partial class PersonComposition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class PersonComposition { - <> - +IPerson Person - } Person --|> IPerson - class Person { - +Person() - +Int32 Id - +String FirstName - +DateTime Birthday - } - class Int32 - class String - class DateTime - class IPerson { - <> - } PersonComposition ..> Person : IPerson Person Person o-- Int32 : Argument "personId" Person o-- String : Argument "personName" Person o-- DateTime : Argument "personBirthday" + namespace Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario { + class IPerson { + <> + } + class Person { + +Person() + +Int32 Id + +String FirstName + +DateTime Birthday + } + class PersonComposition { + <> + +IPerson Person + } + } + namespace System { + class DateTime { + <> + } + class Int32 { + <> + } + class String { + } + } ``` diff --git a/readme/method-injection.md b/readme/method-injection.md index f6edd695..28976601 100644 --- a/readme/method-injection.md +++ b/readme/method-injection.md @@ -73,27 +73,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service() - +SetDependency(IDependency dependency) : Void - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyService Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.MethodInjectionScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + +SetDependency(IDependency dependency) : Void + } + } ``` diff --git a/readme/oncannotresolve-hint.md b/readme/oncannotresolve-hint.md index 409a8e9a..88b276ea 100644 --- a/readme/oncannotresolve-hint.md +++ b/readme/oncannotresolve-hint.md @@ -94,28 +94,38 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency) - } - class String Dependency --|> IDependency - class Dependency { - +Dependency(String name) - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- Dependency : IDependency Dependency *-- String : String + namespace Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency(String name) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } + namespace System { + class String { + } + } ``` diff --git a/readme/ondependencyinjection-hint.md b/readme/ondependencyinjection-hint.md index a9ba2cc7..70d157f2 100644 --- a/readme/ondependencyinjection-hint.md +++ b/readme/ondependencyinjection-hint.md @@ -92,26 +92,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/onnewinstance-hint.md b/readme/onnewinstance-hint.md index b11acab4..a6bcccca 100644 --- a/readme/onnewinstance-hint.md +++ b/readme/onnewinstance-hint.md @@ -116,26 +116,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/overriding-the-bcl-binding.md b/readme/overriding-the-bcl-binding.md index 286ecbdc..db19b423 100644 --- a/readme/overriding-the-bcl-binding.md +++ b/readme/overriding-the-bcl-binding.md @@ -194,24 +194,35 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Composition ..> Service : IService Root + Service *-- ArrayᐸIDependencyᐳ : ArrayᐸIDependencyᐳ + namespace Pure.DI.UsageTests.BCL.OverridingBclBindingScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class IService { + <> + } + class Service { + +Service(ArrayᐸIDependencyᐳ dependencies) + } } - Service --|> IService - class Service { - +Service(ArrayᐸIDependencyᐳ dependencies) + namespace System { + class ArrayᐸIDependencyᐳ { + <> + } } - class ArrayᐸIDependencyᐳ - class IService { - <> - } - Composition ..> Service : IService Root - Service *-- ArrayᐸIDependencyᐳ : ArrayᐸIDependencyᐳ ``` diff --git a/readme/partial-class.md b/readme/partial-class.md index 2e849e4d..8592232d 100644 --- a/readme/partial-class.md +++ b/readme/partial-class.md @@ -215,27 +215,41 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Dependency --|> IDependency + Composition ..> Service : Service Root + Service *-- String : "name with id" String + Service *-- "2 " Dependency : IDependency + Dependency *-- Int64 : Int64 + namespace Pure.DI.UsageTests.Advanced.PartialClassScenario { + class Composition { <> +Service Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency(Int64 id) + } + class IDependency { + <> + } + class Service { + } } - class String - Dependency --|> IDependency - class Dependency { - +Dependency(Int64 id) + namespace System { + class Int64 { + <> + } + class String { + } } - class Int64 - class IDependency { - <> - } - Composition ..> Service : Service Root - Service *-- String : "name with id" String - Service *-- "2 " Dependency : IDependency - Dependency *-- Int64 : Int64 ``` diff --git a/readme/perblock.md b/readme/perblock.md index b3077e78..edfc83ee 100644 --- a/readme/perblock.md +++ b/readme/perblock.md @@ -97,24 +97,36 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Service Root - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class ValueTupleᐸIDependencyˏIDependencyᐳ { - +ValueTuple(IDependency item1, IDependency item2) - } - class IDependency { - <> - } Composition ..> Service : Service Root Service o-- "2 PerBlock instances" Dependency : IDependency Service o-- "Singleton" ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ ValueTupleᐸIDependencyˏIDependencyᐳ o-- "2 PerBlock instances" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.PerBlockScenario { + class Composition { + <> + +Service Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class Service { + } + } + namespace System { + class ValueTupleᐸIDependencyˏIDependencyᐳ { + <> + +ValueTuple(IDependency item1, IDependency item2) + } + } ``` diff --git a/readme/perresolve.md b/readme/perresolve.md index 479bba19..8a59a3ec 100644 --- a/readme/perresolve.md +++ b/readme/perresolve.md @@ -112,24 +112,36 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Service Root - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class ValueTupleᐸIDependencyˏIDependencyᐳ { - +ValueTuple(IDependency item1, IDependency item2) - } - class IDependency { - <> - } Composition ..> Service : Service Root Service o-- "2 PerResolve instances" Dependency : IDependency Service o-- "Singleton" ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ ValueTupleᐸIDependencyˏIDependencyᐳ o-- "2 PerResolve instances" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.PerResolveScenario { + class Composition { + <> + +Service Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class Service { + } + } + namespace System { + class ValueTupleᐸIDependencyˏIDependencyᐳ { + <> + +ValueTuple(IDependency item1, IDependency item2) + } + } ``` diff --git a/readme/property-injection.md b/readme/property-injection.md index ba152ead..793b9e03 100644 --- a/readme/property-injection.md +++ b/readme/property-injection.md @@ -70,27 +70,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service() - +IDependency Dependency - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyService Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.PropertyInjectionScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + +IDependency Dependency + } + } ``` diff --git a/readme/required-properties-or-fields.md b/readme/required-properties-or-fields.md index 1097d99d..84851d3b 100644 --- a/readme/required-properties-or-fields.md +++ b/readme/required-properties-or-fields.md @@ -78,30 +78,40 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service() - +String ServiceNameField - +IDependency Dependency - } - class String Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- String : Argument "name" Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + +String ServiceNameField + +IDependency Dependency + } + } + namespace System { + class String { + } + } ``` diff --git a/readme/resolve-hint.md b/readme/resolve-hint.md index 5fae0347..a14fcbbe 100644 --- a/readme/resolve-hint.md +++ b/readme/resolve-hint.md @@ -72,28 +72,35 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IDependency DependencyRoot - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Composition ..> Dependency : IDependency DependencyRoot Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Hints.ResolveHintScenario { + class Composition { + <> + +IDependency DependencyRoot + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/resolve-methods.md b/readme/resolve-methods.md index 4a1799b1..f5f0b4fe 100644 --- a/readme/resolve-methods.md +++ b/readme/resolve-methods.md @@ -209,8 +209,20 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + OtherService --|> IService : "My Tag" + Service --|> IService + Dependency --|> IDependency + Composition ..> OtherService : IService OtherService + Composition ..> Service : IService _ + Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.ResolveMethodsScenario { + class Composition { <> +IService OtherService -IService _ @@ -218,27 +230,22 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class OtherService { + +OtherService() + } + class Service { + +Service(IDependency dependency) + } } - OtherService --|> IService : "My Tag" - class OtherService { - +OtherService() - } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> OtherService : IService OtherService - Composition ..> Service : IService _ - Service *-- Dependency : IDependency ``` diff --git a/readme/root-arguments.md b/readme/root-arguments.md index d1c00fe2..3df357f1 100644 --- a/readme/root-arguments.md +++ b/readme/root-arguments.md @@ -98,31 +98,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService CreateServiceWithArgs(int id, string dependencyName, string serviceName) - } Service --|> IService - class Service { - +Service(String name, IDependency dependency) - } - class String Dependency --|> IDependency - class Dependency { - +Dependency(Int32 id, String dependencyName) - } - class Int32 - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService CreateServiceWithArgs(int id, string dependencyName, string serviceName) Service o-- String : "forService" Argument "serviceName" Service *-- Dependency : IDependency Dependency o-- Int32 : Argument "id" Dependency o-- String : Argument "dependencyName" + namespace Pure.DI.UsageTests.Basics.RootArgumentsScenario { + class Composition { + <> + +IService CreateServiceWithArgs(int id, string dependencyName, string serviceName) + } + class Dependency { + +Dependency(Int32 id, String dependencyName) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(String name, IDependency dependency) + } + } + namespace System { + class Int32 { + <> + } + class String { + } + } ``` diff --git a/readme/root-binding.md b/readme/root-binding.md index d040b723..2e54a64b 100644 --- a/readme/root-binding.md +++ b/readme/root-binding.md @@ -73,26 +73,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyRoot - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyRoot Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.Basics.RootBindScenario { + class Composition { + <> + +IService MyRoot + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/scope.md b/readme/scope.md index 40535789..e4db6377 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -182,37 +182,52 @@ partial class Composition: IDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Program ProgramRoot - +IService SessionRoot - } Composition --|> IDisposable Service --|> IService - class Service { - +Service(IDependency dependency) - } - class FuncᐸSessionᐳ Dependency --|> IDependency - class Dependency { - +Dependency() - } - class Session { - +Session(Composition composition) - } - class Composition - class IService { - <> - } - class IDependency { - <> - } Composition ..> Program : Program ProgramRoot Composition ..> Service : IService SessionRoot Program o-- "PerBlock" FuncᐸSessionᐳ : FuncᐸSessionᐳ Service o-- "Scoped" Dependency : IDependency FuncᐸSessionᐳ *-- Session : Session Session *-- Composition : Composition + namespace Pure.DI.UsageTests.Lifetimes.ScopeScenario { + class Composition { + <> + +Program ProgramRoot + +IService SessionRoot + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Program { + } + class Service { + +Service(IDependency dependency) + } + class Session { + +Session(Composition composition) + } + } + namespace System { + class FuncᐸSessionᐳ { + <> + } + class IDisposable { + <> + } + } ``` diff --git a/readme/service-collection.md b/readme/service-collection.md index 22297158..db083669 100644 --- a/readme/service-collection.md +++ b/readme/service-collection.md @@ -249,8 +249,19 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency : "Dependency Key" + Composition ..> Service : IService _ + Composition ..> Dependency : IDependency _ + Service o-- "Singleton" Dependency : "Dependency Key" IDependency + namespace Pure.DI.UsageTests.BCL.ServiceCollectionScenario { + class Composition { <> -IDependency _ -IService _ @@ -258,23 +269,19 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency : "Dependency Key" - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService _ - Composition ..> Dependency : IDependency _ - Service o-- "Singleton" Dependency : "Dependency Key" IDependency ``` diff --git a/readme/service-provider-with-scope.md b/readme/service-provider-with-scope.md index 5a011224..b034e499 100644 --- a/readme/service-provider-with-scope.md +++ b/readme/service-provider-with-scope.md @@ -321,8 +321,20 @@ partial class Composition: IDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Composition --|> IDisposable + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService _ + Composition ..> Dependency : IDependency _ + Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario { + class Composition { <> -IDependency _ -IService _ @@ -330,24 +342,24 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object GetService(Type type) + object GetRequiredKeyedService(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - Composition --|> IDisposable - Service --|> IService - class Service { - +Service(IDependency dependency) + namespace System { + class IDisposable { + <> + } } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService _ - Composition ..> Dependency : IDependency _ - Service o-- "Singleton" Dependency : IDependency ``` diff --git a/readme/service-provider.md b/readme/service-provider.md index 76b633bc..7193d96b 100644 --- a/readme/service-provider.md +++ b/readme/service-provider.md @@ -245,8 +245,19 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService _ + Composition ..> Dependency : IDependency _ + Service o-- "Singleton" Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.ServiceProviderScenario { + class Composition { <> -IDependency _ -IService _ @@ -254,23 +265,19 @@ classDiagram + T ResolveᐸTᐳ(object? tag) + object GetService(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - Service --|> IService - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService _ - Composition ..> Dependency : IDependency _ - Service o-- "Singleton" Dependency : IDependency ``` diff --git a/readme/simplified-binding.md b/readme/simplified-binding.md index fc141763..c6f36369 100644 --- a/readme/simplified-binding.md +++ b/readme/simplified-binding.md @@ -126,36 +126,45 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service(Dependency dependencyImpl, IDependency dependency, IOtherDependency otherDependency) - } Dependency --|> IDependency Dependency --|> IOtherDependency Dependency --|> IEnumerableᐸStringᐳ - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - class IOtherDependency { - <> - } - class IEnumerableᐸStringᐳ { - <> - } Composition ..> Service : IService MyService Service o-- "PerBlock" Dependency : Dependency Service o-- "PerBlock" Dependency : IDependency Service o-- "PerBlock" Dependency : IOtherDependency + namespace Pure.DI.UsageTests.Basics.SimplifiedBindingScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IOtherDependency { + <> + } + class IService { + <> + } + class Service { + +Service(Dependency dependencyImpl, IDependency dependency, IOtherDependency otherDependency) + } + } + namespace System.Collections.Generic { + class IEnumerableᐸStringᐳ { + <> + } + } ``` diff --git a/readme/simplified-factory.md b/readme/simplified-factory.md index d372da49..7bba26c5 100644 --- a/readme/simplified-factory.md +++ b/readme/simplified-factory.md @@ -96,26 +96,38 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency - class DateTimeOffset - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyService Service *-- Dependency : IDependency Dependency *-- DateTimeOffset : "now datetime" DateTimeOffset + namespace Pure.DI.UsageTests.Basics.SimplifiedFactoryScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } + namespace System { + class DateTimeOffset { + <> + } + } ``` diff --git a/readme/singleton.md b/readme/singleton.md index f6abc02c..277fca25 100644 --- a/readme/singleton.md +++ b/readme/singleton.md @@ -103,26 +103,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "2 Singleton instances" Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.SingletonScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + } ``` diff --git a/readme/span-and-readonlyspan.md b/readme/span-and-readonlyspan.md index 01747620..ff9afe90 100644 --- a/readme/span-and-readonlyspan.md +++ b/readme/span-and-readonlyspan.md @@ -191,30 +191,42 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Composition ..> Service : IService Root + Service *-- ReadOnlySpanᐸDependencyᐳ : ReadOnlySpanᐸDependencyᐳ + ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'a' Dependency + ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'b' Dependency + ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'c' Dependency + namespace Pure.DI.UsageTests.BCL.SpanScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + <> + +Dependency() + } + class IService { + <> + } + class Service { + +Service(ReadOnlySpanᐸDependencyᐳ dependencies) + } } - Service --|> IService - class Service { - +Service(ReadOnlySpanᐸDependencyᐳ dependencies) - } - class ReadOnlySpanᐸDependencyᐳ - class Dependency { - +Dependency() - } - class IService { - <> + namespace System { + class ReadOnlySpanᐸDependencyᐳ { + <> + } } - Composition ..> Service : IService Root - Service *-- ReadOnlySpanᐸDependencyᐳ : ReadOnlySpanᐸDependencyᐳ - ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'a' Dependency - ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'b' Dependency - ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'c' Dependency ``` diff --git a/readme/tag-attribute.md b/readme/tag-attribute.md index af9e4ed2..01d42d97 100644 --- a/readme/tag-attribute.md +++ b/readme/tag-attribute.md @@ -79,31 +79,38 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } AbcDependency --|> IDependency : "Abc" - class AbcDependency { - +AbcDependency() - } XyzDependency --|> IDependency : "Xyz" - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- AbcDependency : "Abc" IDependency Service *-- XyzDependency : "Xyz" IDependency + namespace Pure.DI.UsageTests.Basics.TagAttributeScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-on-a-constructor-argument.md b/readme/tag-on-a-constructor-argument.md index d068af1e..4eae138d 100644 --- a/readme/tag-on-a-constructor-argument.md +++ b/readme/tag-on-a-constructor-argument.md @@ -88,35 +88,42 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, ConsumerᐸStringᐳ consumer) - } AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - class ConsumerᐸStringᐳ { - +Consumer(IDependency myDep) - } XyzDependency --|> IDependency - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- AbcDependency : IDependency Service *-- ConsumerᐸStringᐳ : ConsumerᐸStringᐳ ConsumerᐸStringᐳ *-- XyzDependency : IDependency + namespace Pure.DI.UsageTests.Advanced.TagOnConstructorArgScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + } + class ConsumerᐸStringᐳ { + +Consumer(IDependency myDep) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, ConsumerᐸStringᐳ consumer) + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-on-a-member.md b/readme/tag-on-a-member.md index 47f573d3..28037db7 100644 --- a/readme/tag-on-a-member.md +++ b/readme/tag-on-a-member.md @@ -74,27 +74,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service() - +IDependency Dependency - } XyzDependency --|> IDependency - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- XyzDependency : IDependency + namespace Pure.DI.UsageTests.Advanced.TagOnMemberScenario { + class Composition { + <> + +IService Root + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + +IDependency Dependency + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-on-a-method-argument.md b/readme/tag-on-a-method-argument.md index d7a1a8ad..6ca114cd 100644 --- a/readme/tag-on-a-method-argument.md +++ b/readme/tag-on-a-method-argument.md @@ -80,27 +80,34 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service() - +Initialize(IDependency dep) : Void - } XyzDependency --|> IDependency - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- XyzDependency : IDependency + namespace Pure.DI.UsageTests.Advanced.TagOnMethodArgScenario { + class Composition { + <> + +IService Root + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service() + +Initialize(IDependency dep) : Void + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-on-injection-site-with-wildcards.md b/readme/tag-on-injection-site-with-wildcards.md index d7474991..7645c0e7 100644 --- a/readme/tag-on-injection-site-with-wildcards.md +++ b/readme/tag-on-injection-site-with-wildcards.md @@ -99,37 +99,44 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2, ConsumerᐸStringᐳ consumer) - +IDependency Dependency3 - } XyzDependency --|> IDependency - class XyzDependency { - +XyzDependency() - } - class ConsumerᐸStringᐳ { - +Consumer(IDependency myDep) - } AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- "2 " XyzDependency : IDependency Service *-- ConsumerᐸStringᐳ : ConsumerᐸStringᐳ Service *-- AbcDependency : IDependency ConsumerᐸStringᐳ *-- AbcDependency : IDependency + namespace Pure.DI.UsageTests.Advanced.TagOnInjectionSiteWithWildcardsScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + } + class ConsumerᐸStringᐳ { + +Consumer(IDependency myDep) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2, ConsumerᐸStringᐳ consumer) + +IDependency Dependency3 + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-on-injection-site.md b/readme/tag-on-injection-site.md index 21e5b6be..b1b9cbda 100644 --- a/readme/tag-on-injection-site.md +++ b/readme/tag-on-injection-site.md @@ -86,38 +86,45 @@ service.Dependency4.ShouldBeOfType(); Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2, ConsumerᐸStringᐳ consumer) - +IDependency Dependency3 - } AbcDependency --|> IDependency AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } XyzDependency --|> IDependency - class XyzDependency { - +XyzDependency() - } - class ConsumerᐸStringᐳ { - +Consumer(IDependency myDep) - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- AbcDependency : IDependency Service *-- "2 " XyzDependency : IDependency Service *-- ConsumerᐸStringᐳ : ConsumerᐸStringᐳ ConsumerᐸStringᐳ *-- AbcDependency : IDependency + namespace MyNamespace { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + } + class ConsumerᐸStringᐳ { + +Consumer(IDependency myDep) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2, ConsumerᐸStringᐳ consumer) + +IDependency Dependency3 + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-type.md b/readme/tag-type.md index 52f00827..426fca0c 100644 --- a/readme/tag-type.md +++ b/readme/tag-type.md @@ -259,39 +259,46 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - +IDependency XyzRoot - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } XyzDependency --|> IDependency : typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency) - class XyzDependency { - +XyzDependency() - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2, IDependency dependency3) - } AbcDependency --|> IDependency : typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency) AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - class IDependency { - <> - } - class IService { - <> - } Composition ..> XyzDependency : IDependency XyzRoot Composition ..> Service : IService Root Service *-- AbcDependency : typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency) IDependency Service o-- "Singleton" XyzDependency : typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency) IDependency Service *-- AbcDependency : IDependency + namespace Pure.DI.UsageTests.Advanced.TagTypeScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + +IDependency XyzRoot + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2, IDependency dependency3) + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/tag-unique.md b/readme/tag-unique.md index 6138dbe2..c17b8cf8 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -190,37 +190,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + ServiceᐸStringᐳ --|> IServiceᐸStringᐳ + AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.AbcDependency) + XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.XyzDependency) + Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ Root + ServiceᐸStringᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.AbcDependency) IDependencyᐸStringᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.XyzDependency) IDependencyᐸStringᐳ + namespace Pure.DI.UsageTests.Advanced.TagUniqueScenario { + class AbcDependencyᐸStringᐳ { + +AbcDependency() + } + class Composition { <> +IServiceᐸStringᐳ Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class IDependencyᐸStringᐳ { + <> + } + class IServiceᐸStringᐳ { + <> + } + class ServiceᐸStringᐳ { + +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) + } + class XyzDependencyᐸStringᐳ { + +XyzDependency() + } } - ServiceᐸStringᐳ --|> IServiceᐸStringᐳ - class ServiceᐸStringᐳ { - +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) - } - class IEnumerableᐸIDependencyᐸStringᐳᐳ - AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.AbcDependency) - class AbcDependencyᐸStringᐳ { - +AbcDependency() - } - XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.XyzDependency) - class XyzDependencyᐸStringᐳ { - +XyzDependency() - } - class IServiceᐸStringᐳ { - <> - } - class IDependencyᐸStringᐳ { - <> + namespace System.Collections.Generic { + class IEnumerableᐸIDependencyᐸStringᐳᐳ { + <> + } } - Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ Root - ServiceᐸStringᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.AbcDependency) IDependencyᐸStringᐳ - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.XyzDependency) IDependencyᐸStringᐳ ``` diff --git a/readme/tags.md b/readme/tags.md index ee15c438..47279e89 100644 --- a/readme/tags.md +++ b/readme/tags.md @@ -127,35 +127,42 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - +IDependency XyzRoot - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2, IDependency dependency3) - } XyzDependency --|> IDependency : "XyzTag" - class XyzDependency { - +XyzDependency() - } AbcDependency --|> IDependency : "AbcTag" AbcDependency --|> IDependency - class AbcDependency { - +AbcDependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Composition ..> XyzDependency : IDependency XyzRoot Service *-- AbcDependency : "AbcTag" IDependency Service o-- "Singleton" XyzDependency : "XyzTag" IDependency Service *-- AbcDependency : IDependency + namespace Pure.DI.UsageTests.Basics.TagsScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + +IDependency XyzRoot + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2, IDependency dependency3) + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/task.md b/readme/task.md index 3efb7237..ad5da231 100644 --- a/readme/task.md +++ b/readme/task.md @@ -108,32 +108,14 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService GetRoot(System.Threading.CancellationToken cancellationToken) - } Service --|> IService - class Service { - +Service(TaskᐸIDependencyᐳ dependencyTask) - } - class TaskᐸIDependencyᐳ - class FuncᐸIDependencyᐳ - class TaskFactoryᐸIDependencyᐳ Dependency --|> IDependency - class Dependency { - +Dependency() - } - class CancellationToken - class TaskCreationOptions - class TaskContinuationOptions - class TaskScheduler - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService GetRoot(System.Threading.CancellationToken cancellationToken) Service *-- TaskᐸIDependencyᐳ : TaskᐸIDependencyᐳ TaskᐸIDependencyᐳ o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ @@ -143,5 +125,48 @@ classDiagram TaskFactoryᐸIDependencyᐳ *-- TaskCreationOptions : TaskCreationOptions TaskFactoryᐸIDependencyᐳ *-- TaskContinuationOptions : TaskContinuationOptions TaskFactoryᐸIDependencyᐳ *-- TaskScheduler : TaskScheduler + namespace Pure.DI.UsageTests.BCL.TaskScenario { + class Composition { + <> + +IService GetRoot(System.Threading.CancellationToken cancellationToken) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(TaskᐸIDependencyᐳ dependencyTask) + } + } + namespace System { + class FuncᐸIDependencyᐳ { + <> + } + } + namespace System.Threading { + class CancellationToken { + <> + } + } + namespace System.Threading.Tasks { + class TaskContinuationOptions { + <> + } + class TaskCreationOptions { + <> + } + class TaskFactoryᐸIDependencyᐳ { + } + class TaskScheduler { + <> + } + class TaskᐸIDependencyᐳ { + } + } ``` diff --git a/readme/threadsafe-hint.md b/readme/threadsafe-hint.md index 4e61a8ef..88b22df7 100644 --- a/readme/threadsafe-hint.md +++ b/readme/threadsafe-hint.md @@ -73,28 +73,39 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(FuncᐸIDependencyᐳ dependencyFactory) - } - class FuncᐸIDependencyᐳ Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service o-- "PerBlock" FuncᐸIDependencyᐳ : FuncᐸIDependencyᐳ FuncᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Hints.ThreadSafeHintScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(FuncᐸIDependencyᐳ dependencyFactory) + } + } + namespace System { + class FuncᐸIDependencyᐳ { + <> + } + } ``` diff --git a/readme/tostring-hint.md b/readme/tostring-hint.md index 42f2027f..61fdc67d 100644 --- a/readme/tostring-hint.md +++ b/readme/tostring-hint.md @@ -60,26 +60,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService MyService - } Service --|> IService - class Service { - +Service(IDependency dependency) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService MyService Service *-- Dependency : IDependency + namespace Pure.DI.UsageTests.Hints.ToStringHintScenario { + class Composition { + <> + +IService MyService + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } + } ``` diff --git a/readme/tracking-async-disposable-instances-in-delegates.md b/readme/tracking-async-disposable-instances-in-delegates.md index faddf9f8..1b9bd716 100644 --- a/readme/tracking-async-disposable-instances-in-delegates.md +++ b/readme/tracking-async-disposable-instances-in-delegates.md @@ -245,29 +245,47 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Dependency --|> IDependency + Composition ..> Service : Service Root + Service o-- "PerBlock" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ + FuncᐸOwnedᐸIDependencyᐳᐳ o-- "PerBlock" OwnedᐸIDependencyᐳ : OwnedᐸIDependencyᐳ + OwnedᐸIDependencyᐳ *-- Owned : Owned + OwnedᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI { + class Owned { + } + class OwnedᐸIDependencyᐳ { + <> + } + } + namespace Pure.DI.UsageTests.Advanced.TrackingAsyncDisposableInDelegatesScenario { + class Composition { <> +Service Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class Service { + } } - class FuncᐸOwnedᐸIDependencyᐳᐳ - class OwnedᐸIDependencyᐳ - class Owned - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IDependency { - <> + namespace System { + class FuncᐸOwnedᐸIDependencyᐳᐳ { + <> + } } - Composition ..> Service : Service Root - Service o-- "PerBlock" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ - FuncᐸOwnedᐸIDependencyᐳᐳ o-- "PerBlock" OwnedᐸIDependencyᐳ : OwnedᐸIDependencyᐳ - OwnedᐸIDependencyᐳ *-- Owned : Owned - OwnedᐸIDependencyᐳ *-- Dependency : IDependency ``` 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 000df810..c5cc3c0d 100644 --- a/readme/tracking-async-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-async-disposable-instances-per-a-composition-root.md @@ -155,37 +155,52 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Dependency --|> IAsyncDisposable + Composition ..> OwnedᐸIServiceᐳ : OwnedᐸIServiceᐳ Root + OwnedᐸIServiceᐳ *-- Owned : Owned + OwnedᐸIServiceᐳ *-- Service : IService + Service *-- Dependency : IDependency + namespace Pure.DI { + class Owned { + } + class OwnedᐸIServiceᐳ { + <> + } + } + namespace Pure.DI.UsageTests.Advanced.TrackingAsyncDisposableScenario { + class Composition { <> +OwnedᐸIServiceᐳ Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - class Owned - Service --|> IService - class Service { - +Service(IDependency dependency) + namespace System { + class IAsyncDisposable { + <> + } } - Dependency --|> IDependency - Dependency --|> IAsyncDisposable - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - class IAsyncDisposable { - <> - } - Composition ..> OwnedᐸIServiceᐳ : OwnedᐸIServiceᐳ Root - OwnedᐸIServiceᐳ *-- Owned : Owned - OwnedᐸIServiceᐳ *-- Service : IService - Service *-- Dependency : IDependency ``` diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index 6b6fcb42..dff87771 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -238,29 +238,47 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Dependency --|> IDependency + Composition ..> Service : Service Root + Service o-- "PerBlock" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ + FuncᐸOwnedᐸIDependencyᐳᐳ o-- "PerBlock" OwnedᐸIDependencyᐳ : OwnedᐸIDependencyᐳ + OwnedᐸIDependencyᐳ *-- Owned : Owned + OwnedᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI { + class Owned { + } + class OwnedᐸIDependencyᐳ { + <> + } + } + namespace Pure.DI.UsageTests.Advanced.TrackingDisposableInDelegatesScenario { + class Composition { <> +Service Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class Service { + } } - class FuncᐸOwnedᐸIDependencyᐳᐳ - class OwnedᐸIDependencyᐳ - class Owned - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IDependency { - <> + namespace System { + class FuncᐸOwnedᐸIDependencyᐳᐳ { + <> + } } - Composition ..> Service : Service Root - Service o-- "PerBlock" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ - FuncᐸOwnedᐸIDependencyᐳᐳ o-- "PerBlock" OwnedᐸIDependencyᐳ : OwnedᐸIDependencyᐳ - OwnedᐸIDependencyᐳ *-- Owned : Owned - OwnedᐸIDependencyᐳ *-- Dependency : IDependency ``` diff --git a/readme/tracking-disposable-instances-per-a-composition-root.md b/readme/tracking-disposable-instances-per-a-composition-root.md index cbadefdd..6765813e 100644 --- a/readme/tracking-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-disposable-instances-per-a-composition-root.md @@ -151,33 +151,46 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> OwnedᐸIServiceᐳ : OwnedᐸIServiceᐳ Root + OwnedᐸIServiceᐳ *-- Owned : Owned + OwnedᐸIServiceᐳ *-- Service : IService + Service *-- Dependency : IDependency + namespace Pure.DI { + class Owned { + } + class OwnedᐸIServiceᐳ { + <> + } + } + namespace Pure.DI.UsageTests.Advanced.TrackingDisposableScenario { + class Composition { <> +OwnedᐸIServiceᐳ Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency) + } } - class Owned - Service --|> IService - class Service { - +Service(IDependency dependency) - } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> OwnedᐸIServiceᐳ : OwnedᐸIServiceᐳ Root - OwnedᐸIServiceᐳ *-- Owned : Owned - OwnedᐸIServiceᐳ *-- Service : IService - Service *-- Dependency : IDependency ``` diff --git a/readme/tracking-disposable-instances-using-pre-built-classes.md b/readme/tracking-disposable-instances-using-pre-built-classes.md index d003ff0d..6419b273 100644 --- a/readme/tracking-disposable-instances-using-pre-built-classes.md +++ b/readme/tracking-disposable-instances-using-pre-built-classes.md @@ -338,26 +338,14 @@ partial class Composition: IDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Service Root - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Composition --|> IDisposable - class FuncᐸOwnᐸIDependencyᐳᐳ - class OwnᐸIDependencyᐳ - class Own Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IDependency { - <> - } Composition ..> Service : Service Root Service o-- "PerBlock" FuncᐸOwnᐸIDependencyᐳᐳ : FuncᐸOwnᐸIDependencyᐳᐳ Service o-- "PerBlock" FuncᐸOwnᐸIDependencyᐳᐳ : "single" FuncᐸOwnᐸIDependencyᐳᐳ @@ -367,5 +355,38 @@ classDiagram OwnᐸIDependencyᐳ *-- Dependency : IDependency OwnᐸIDependencyᐳ *-- Own : Own OwnᐸIDependencyᐳ o-- "Singleton" Dependency : "single" IDependency + namespace Pure.DI.Abstractions { + class Own { + } + class OwnᐸIDependencyᐳ { + <> + } + } + namespace Pure.DI.UsageTests.Advanced.TrackingDisposableWithAbstractionsScenario { + class Composition { + <> + +Service Root + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class Service { + } + } + namespace System { + class FuncᐸOwnᐸIDependencyᐳᐳ { + <> + } + class IDisposable { + <> + } + } ``` diff --git a/readme/tracking-disposable-instances-with-different-lifetimes.md b/readme/tracking-disposable-instances-with-different-lifetimes.md index 3ea1d94b..016f99c3 100644 --- a/readme/tracking-disposable-instances-with-different-lifetimes.md +++ b/readme/tracking-disposable-instances-with-different-lifetimes.md @@ -328,26 +328,14 @@ partial class Composition: IDisposable Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +Service Root - + T ResolveᐸTᐳ() - + T ResolveᐸTᐳ(object? tag) - + object Resolve(Type type) - + object Resolve(Type type, object? tag) - } Composition --|> IDisposable - class FuncᐸOwnedᐸIDependencyᐳᐳ - class OwnedᐸIDependencyᐳ - class Owned Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IDependency { - <> - } Composition ..> Service : Service Root Service o-- "PerBlock" FuncᐸOwnedᐸIDependencyᐳᐳ : FuncᐸOwnedᐸIDependencyᐳᐳ Service o-- "PerBlock" FuncᐸOwnedᐸIDependencyᐳᐳ : "single" FuncᐸOwnedᐸIDependencyᐳᐳ @@ -357,5 +345,38 @@ classDiagram OwnedᐸIDependencyᐳ *-- Dependency : IDependency OwnedᐸIDependencyᐳ *-- Owned : Owned OwnedᐸIDependencyᐳ o-- "Singleton" Dependency : "single" IDependency + namespace Pure.DI { + class Owned { + } + class OwnedᐸIDependencyᐳ { + <> + } + } + namespace Pure.DI.UsageTests.Advanced.TrackingDisposableWithDifferentLifetimesScenario { + class Composition { + <> + +Service Root + + T ResolveᐸTᐳ() + + T ResolveᐸTᐳ(object? tag) + + object Resolve(Type type) + + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class Service { + } + } + namespace System { + class FuncᐸOwnedᐸIDependencyᐳᐳ { + <> + } + class IDisposable { + <> + } + } ``` diff --git a/readme/transient.md b/readme/transient.md index 81bf108c..ba6c58af 100644 --- a/readme/transient.md +++ b/readme/transient.md @@ -84,26 +84,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } Composition ..> Service : IService Root Service *-- "2 " Dependency : IDependency + namespace Pure.DI.UsageTests.Lifetimes.TransientScenario { + class Composition { + <> + +IService Root + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + } ``` diff --git a/readme/tuple.md b/readme/tuple.md index 288cef3d..ae631ed2 100644 --- a/readme/tuple.md +++ b/readme/tuple.md @@ -181,36 +181,48 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService Root + Service *-- ValueTupleᐸPointˏIDependencyᐳ : ValueTupleᐸPointˏIDependencyᐳ + ValueTupleᐸPointˏIDependencyᐳ *-- Point : Point + ValueTupleᐸPointˏIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.TupleScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Point { + <> + } + class Service { + +Service(ValueTupleᐸPointˏIDependencyᐳ tuple) + } } - Service --|> IService - class Service { - +Service(ValueTupleᐸPointˏIDependencyᐳ tuple) - } - class ValueTupleᐸPointˏIDependencyᐳ { - +ValueTuple(Point item1, IDependency item2) + namespace System { + class ValueTupleᐸPointˏIDependencyᐳ { + <> + +ValueTuple(Point item1, IDependency item2) + } } - class Point - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service *-- ValueTupleᐸPointˏIDependencyᐳ : ValueTupleᐸPointˏIDependencyᐳ - ValueTupleᐸPointˏIDependencyᐳ *-- Point : Point - ValueTupleᐸPointˏIDependencyᐳ *-- Dependency : IDependency ``` diff --git a/readme/type-attribute.md b/readme/type-attribute.md index 1eb940c7..dc147b31 100644 --- a/readme/type-attribute.md +++ b/readme/type-attribute.md @@ -75,26 +75,33 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { - <> - +IService Root - } Service --|> IService - class Service { - +Service(IDependency dependency1, IDependency dependency2) - } - class AbcDependency { - +AbcDependency() - } - class XyzDependency { - +XyzDependency() - } - class IService { - <> - } Composition ..> Service : IService Root Service *-- AbcDependency : AbcDependency Service *-- XyzDependency : XyzDependency + namespace Pure.DI.UsageTests.Attributes.TypeAttributeScenario { + class AbcDependency { + +AbcDependency() + } + class Composition { + <> + +IService Root + } + class IService { + <> + } + class Service { + +Service(IDependency dependency1, IDependency dependency2) + } + class XyzDependency { + +XyzDependency() + } + } ``` diff --git a/readme/valuetask.md b/readme/valuetask.md index 90bb8e46..cfcebd43 100644 --- a/readme/valuetask.md +++ b/readme/valuetask.md @@ -190,32 +190,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService Root + Service *-- ValueTaskᐸIDependencyᐳ : ValueTaskᐸIDependencyᐳ + ValueTaskᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.ValueTaskScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(ValueTaskᐸIDependencyᐳ dependencyTask) + } } - Service --|> IService - class Service { - +Service(ValueTaskᐸIDependencyᐳ dependencyTask) + namespace System.Threading.Tasks { + class ValueTaskᐸIDependencyᐳ { + <> + } } - class ValueTaskᐸIDependencyᐳ - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service *-- ValueTaskᐸIDependencyᐳ : ValueTaskᐸIDependencyᐳ - ValueTaskᐸIDependencyᐳ *-- Dependency : IDependency ``` diff --git a/readme/weak-reference.md b/readme/weak-reference.md index 67760e8a..0316c6da 100644 --- a/readme/weak-reference.md +++ b/readme/weak-reference.md @@ -175,34 +175,43 @@ partial class Composition Class diagram: ```mermaid +--- + config: + class: + hideEmptyMembersBox: true +--- classDiagram - class Composition { + Service --|> IService + Dependency --|> IDependency + Composition ..> Service : IService Root + Service *-- WeakReferenceᐸIDependencyᐳ : WeakReferenceᐸIDependencyᐳ + WeakReferenceᐸIDependencyᐳ *-- Dependency : IDependency + namespace Pure.DI.UsageTests.BCL.WeakReferenceScenario { + class Composition { <> +IService Root + T ResolveᐸTᐳ() + T ResolveᐸTᐳ(object? tag) + object Resolve(Type type) + object Resolve(Type type, object? tag) + } + class Dependency { + +Dependency() + } + class IDependency { + <> + } + class IService { + <> + } + class Service { + +Service(WeakReferenceᐸIDependencyᐳ dependency) + } } - Service --|> IService - class Service { - +Service(WeakReferenceᐸIDependencyᐳ dependency) - } - class WeakReferenceᐸIDependencyᐳ { - +WeakReference(IDependency target) + namespace System { + class WeakReferenceᐸIDependencyᐳ { + +WeakReference(IDependency target) + } } - Dependency --|> IDependency - class Dependency { - +Dependency() - } - class IService { - <> - } - class IDependency { - <> - } - Composition ..> Service : IService Root - Service *-- WeakReferenceᐸIDependencyᐳ : WeakReferenceᐸIDependencyᐳ - WeakReferenceᐸIDependencyᐳ *-- Dependency : IDependency ``` diff --git a/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs b/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs index 0ba1f0a1..05cd499c 100644 --- a/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/ClassDiagramBuilder.cs @@ -137,7 +137,7 @@ public LinesBuilder Build(CompositionCode composition) } } - foreach (var classByNamespace in classes.GroupBy(i => i.Namespace).OrderBy(i => i.Key)) + foreach (var classByNamespace in classes.GroupBy(i => i.ActualNamespace).OrderBy(i => i.Key)) { var ns = classByNamespace.Key; var hasNamespace = !string.IsNullOrWhiteSpace(ns); @@ -380,6 +380,8 @@ public override void VisitField(in LinesBuilder ctx, in DpField field) private record Class(string Namespace, string Name, string Kind, ITypeSymbol? Type, LinesBuilder Lines) { + public string ActualNamespace => string.IsNullOrWhiteSpace(Namespace) ? nameof(System) : Namespace; + public string ActualKind { get