From f2f91d2f20202009e1914ce732d3d40bb04fda67 Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Thu, 7 Mar 2024 23:27:54 +0300 Subject: [PATCH] Update readme --- readme/Avalonia.md | 2 +- readme/BlazorServerApp.md | 2 +- readme/BlazorWebAssemblyApp.md | 2 +- readme/Console.md | 2 +- readme/ConsoleNativeAOT.md | 2 +- readme/ConsoleTopLevelStatements.md | 2 +- readme/GrpcService.md | 2 +- readme/Maui.md | 2 +- readme/MinimalWebAPI.md | 2 +- readme/WebAPI.md | 2 +- readme/WebApp.md | 2 +- readme/WinFormsApp.md | 2 +- readme/WinFormsAppNetCore.md | 2 +- readme/Wpf.md | 2 +- readme/abstractions-binding.md | 24 +++++++++++++++++++++--- readme/tag-unique.md | 18 +++++++++--------- 16 files changed, 44 insertions(+), 26 deletions(-) diff --git a/readme/Avalonia.md b/readme/Avalonia.md index 809c729c6..67ecb172d 100644 --- a/readme/Avalonia.md +++ b/readme/Avalonia.md @@ -107,7 +107,7 @@ The [project file](/samples/AvaloniaApp/AvaloniaApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/BlazorServerApp.md b/readme/BlazorServerApp.md index 7ea4b2bf7..a29715101 100644 --- a/readme/BlazorServerApp.md +++ b/readme/BlazorServerApp.md @@ -68,7 +68,7 @@ The [project file](/samples/BlazorServerApp/BlazorServerApp.csproj) looks like t - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/BlazorWebAssemblyApp.md b/readme/BlazorWebAssemblyApp.md index 40362915a..f26d6e951 100644 --- a/readme/BlazorWebAssemblyApp.md +++ b/readme/BlazorWebAssemblyApp.md @@ -65,7 +65,7 @@ The [project file](/samples/BlazorWebAssemblyApp/BlazorWebAssemblyApp.csproj) lo - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Console.md b/readme/Console.md index c6f85a0d0..efa3ef00f 100644 --- a/readme/Console.md +++ b/readme/Console.md @@ -90,7 +90,7 @@ The [project file](/samples/ShroedingersCat/ShroedingersCat.csproj) looks like t - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ConsoleNativeAOT.md b/readme/ConsoleNativeAOT.md index e870184c2..d1ab74511 100644 --- a/readme/ConsoleNativeAOT.md +++ b/readme/ConsoleNativeAOT.md @@ -16,7 +16,7 @@ The [project file](/samples/ShroedingersCatNativeAOT/ShroedingersCatNativeAOT.cs - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ConsoleTopLevelStatements.md b/readme/ConsoleTopLevelStatements.md index 9335c2361..27bfa9fe2 100644 --- a/readme/ConsoleTopLevelStatements.md +++ b/readme/ConsoleTopLevelStatements.md @@ -78,7 +78,7 @@ The [project file](/samples/ShroedingersCatTopLevelStatements/ShroedingersCatTop - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/GrpcService.md b/readme/GrpcService.md index 832c92220..6ffe28781 100644 --- a/readme/GrpcService.md +++ b/readme/GrpcService.md @@ -53,7 +53,7 @@ The [project file](/samples/GrpcService/GrpcService.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Maui.md b/readme/Maui.md index 90b44620b..057f45330 100644 --- a/readme/Maui.md +++ b/readme/Maui.md @@ -208,7 +208,7 @@ The [project file](/samples/MAUIApp/MAUIApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/MinimalWebAPI.md b/readme/MinimalWebAPI.md index 896bb2ead..a835f6325 100644 --- a/readme/MinimalWebAPI.md +++ b/readme/MinimalWebAPI.md @@ -76,7 +76,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WebAPI.md b/readme/WebAPI.md index 338fc89b9..e6302580e 100644 --- a/readme/WebAPI.md +++ b/readme/WebAPI.md @@ -51,7 +51,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WebApp.md b/readme/WebApp.md index e9f284b04..64fd2bdb4 100644 --- a/readme/WebApp.md +++ b/readme/WebApp.md @@ -51,7 +51,7 @@ The [project file](/samples/WebApp/WebApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WinFormsApp.md b/readme/WinFormsApp.md index 3af9c1c17..6c571d399 100644 --- a/readme/WinFormsApp.md +++ b/readme/WinFormsApp.md @@ -55,7 +55,7 @@ The [project file](/samples/WinFormsApp/WinFormsApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WinFormsAppNetCore.md b/readme/WinFormsAppNetCore.md index dad32b60d..e8d4d7749 100644 --- a/readme/WinFormsAppNetCore.md +++ b/readme/WinFormsAppNetCore.md @@ -62,7 +62,7 @@ The [project file](/samples/WinFormsAppNetCore/WinFormsAppNetCore.csproj) looks - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Wpf.md b/readme/Wpf.md index 187f67fa2..e4c6b9419 100644 --- a/readme/Wpf.md +++ b/readme/Wpf.md @@ -68,7 +68,7 @@ The [project file](/samples/WpfAppNetCore/WpfAppNetCore.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/abstractions-binding.md b/readme/abstractions-binding.md index 646e2ef51..08a0a7c29 100644 --- a/readme/abstractions-binding.md +++ b/readme/abstractions-binding.md @@ -2,7 +2,24 @@ [![CSharp](https://img.shields.io/badge/C%23-code-blue.svg)](../tests/Pure.DI.UsageTests/Basics/AbstractionsBindingScenario.cs) -You can use the `Bind(...)` method without type parameters. In this case binding will be performed for all abstract types implemented directly and for the implementation type itself. +You can use the `Bind(...)` method without type parameters. In this case binding will be performed for the implementation type itself, and if the implementation is a class or structure, for all abstract but NOT special types that are directly implemented. +Special types include: + +- `System.Object` +- `System.Enum` +- `System.MulticastDelegate` +- `System.Delegate` +- `System.Collections.IEnumerable` +- `System.Collections.Generic.IEnumerable<T>` +- `System.Collections.Generic.IList<T>` +- `System.Collections.Generic.ICollection<T>` +- `System.Collections.IEnumerator` +- `System.Collections.Generic.IEnumerator<T>` +- `System.Collections.Generic.IIReadOnlyList<T>` +- `System.Collections.Generic.IReadOnlyCollection<T>` +- `System.IDisposable` +- `System.IAsyncResult` +- `System.AsyncCallback` ```c# interface IDependency; @@ -18,8 +35,9 @@ class Service( // Specifies to create a partial class "Composition" DI.Setup("Composition") - // Begins the definition of the binding for all abstract types - // that are directly implemented and the implementation type itself. + // Begins the binding definition for the implementation type itself, + // and if the implementation is a class or structure, + // for all abstract but NOT special types that are directly implemented. // So that's the equivalent of the following: // .Bind() // .As(Lifetime.PerBlock) diff --git a/readme/tag-unique.md b/readme/tag-unique.md index f0035631d..2697e31ae 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -46,11 +46,11 @@ classDiagram + object Resolve(Type type, object? tag) } class IEnumerableᐸIDependencyᐸStringᐳᐳ - AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : ad975a96-d565-4aa7-9772-2b91200047e2 + AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : 23508a1a-2b97-4f29-8261-361a230ce771 class AbcDependencyᐸStringᐳ { +AbcDependency() } - XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : 2467a94e-98f8-4fc4-8ef1-7aa17cbf8942 + XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : b8c93da5-50d8-40fc-a590-0712d886be9f class XyzDependencyᐸStringᐳ { +XyzDependency() } @@ -64,8 +64,8 @@ classDiagram class IServiceᐸStringᐳ { <> } - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : ad975a96-d565-4aa7-9772-2b91200047e2 IDependencyᐸStringᐳ - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : 2467a94e-98f8-4fc4-8ef1-7aa17cbf8942 IDependencyᐸStringᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : 23508a1a-2b97-4f29-8261-361a230ce771 IDependencyᐸStringᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : b8c93da5-50d8-40fc-a590-0712d886be9f IDependencyᐸStringᐳ Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ Root ServiceᐸStringᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ ``` @@ -99,7 +99,7 @@ classDiagram /// var instance = composition.Root; /// /// -/// Class diagram
+/// Class diagram
/// This class was created by Pure.DI source code generator. /// /// @@ -236,11 +236,11 @@ partial class Composition " + object Resolve(Type type, object? tag)\n" + " }\n" + " class IEnumerableᐸIDependencyᐸStringᐳᐳ\n" + - " AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : ad975a96-d565-4aa7-9772-2b91200047e2 \n" + + " AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : 23508a1a-2b97-4f29-8261-361a230ce771 \n" + " class AbcDependencyᐸStringᐳ {\n" + " +AbcDependency()\n" + " }\n" + - " XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : 2467a94e-98f8-4fc4-8ef1-7aa17cbf8942 \n" + + " XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : b8c93da5-50d8-40fc-a590-0712d886be9f \n" + " class XyzDependencyᐸStringᐳ {\n" + " +XyzDependency()\n" + " }\n" + @@ -254,8 +254,8 @@ partial class Composition " class IServiceᐸStringᐳ {\n" + " <>\n" + " }\n" + - " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : ad975a96-d565-4aa7-9772-2b91200047e2 IDependencyᐸStringᐳ\n" + - " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : 2467a94e-98f8-4fc4-8ef1-7aa17cbf8942 IDependencyᐸStringᐳ\n" + + " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : 23508a1a-2b97-4f29-8261-361a230ce771 IDependencyᐸStringᐳ\n" + + " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : b8c93da5-50d8-40fc-a590-0712d886be9f IDependencyᐸStringᐳ\n" + " Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ Root\n" + " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ"; }