diff --git a/README.md b/README.md index f9821a161..8a9bc5de1 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ The full analog of this application with top-level statements can be found [here
Just try! -Download a sample project +Clone a [sample project](https://github.com/DevTeam/Pure.DI.Example): ```shell git clone https://github.com/DevTeam/Pure.DI.Example.git diff --git a/readme/Avalonia.md b/readme/Avalonia.md index 06c060fba..b3e33f3b4 100644 --- a/readme/Avalonia.md +++ b/readme/Avalonia.md @@ -110,7 +110,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 29ad312a8..9e5011788 100644 --- a/readme/BlazorServerApp.md +++ b/readme/BlazorServerApp.md @@ -67,7 +67,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 a1e31e0cc..0ec9c3342 100644 --- a/readme/BlazorWebAssemblyApp.md +++ b/readme/BlazorWebAssemblyApp.md @@ -66,7 +66,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 46d1dbd30..da7e6985c 100644 --- a/readme/Console.md +++ b/readme/Console.md @@ -89,7 +89,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 b0f38dbba..98302e02b 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 3efc68322..67bde8d92 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 0d28cd9f3..c3c771db0 100644 --- a/readme/GrpcService.md +++ b/readme/GrpcService.md @@ -52,7 +52,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 461267aec..2c601e477 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 f4d9a6955..4c3d83f92 100644 --- a/readme/MinimalWebAPI.md +++ b/readme/MinimalWebAPI.md @@ -75,7 +75,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ReadmeTemplate.md b/readme/ReadmeTemplate.md index dfb17a9c8..cb7179aa6 100644 --- a/readme/ReadmeTemplate.md +++ b/readme/ReadmeTemplate.md @@ -132,7 +132,7 @@ The full analog of this application with top-level statements can be found [here
Just try! -Download a sample project +Clone a [sample project](https://github.com/DevTeam/Pure.DI.Example): ```shell git clone https://github.com/DevTeam/Pure.DI.Example.git diff --git a/readme/WebAPI.md b/readme/WebAPI.md index cc93e1250..9540253db 100644 --- a/readme/WebAPI.md +++ b/readme/WebAPI.md @@ -50,7 +50,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 5a744055f..0652e834a 100644 --- a/readme/WebApp.md +++ b/readme/WebApp.md @@ -50,7 +50,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 00ec46a63..6b310379d 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 96e371d26..421c5f7df 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 fe28582b6..100e996e8 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/auto-scoped.md b/readme/auto-scoped.md index 1442f05e0..30124f2cd 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -64,6 +64,9 @@ var service2 = program.CreateService(); service1.Dependency.ShouldNotBe(service2.Dependency); ``` +>[!IMPORTANT] +>The method `Inject()`cannot be used outside of the binding setup. + The following partial class will be generated: ```c# diff --git a/readme/decorator.md b/readme/decorator.md index 147df19b6..7bfdce583 100644 --- a/readme/decorator.md +++ b/readme/decorator.md @@ -29,7 +29,7 @@ var service = composition.Root; service.GetMessage().ShouldBe("Hello World !!!"); ``` -Here an instance of the _Service_ type, labeled _"base"_, is embedded in the decorator _DecoratorService_. You can use any tag that semantically reflects the feature of the abstraction being embedded. The tag can be a constant, a type, or a value of an enumerated type. +Here an instance of the _Service_ type, labeled _"base"_, is injected in the decorator _DecoratorService_. You can use any tag that semantically reflects the feature of the abstraction being embedded. The tag can be a constant, a type, or a value of an enumerated type. The following partial class will be generated: diff --git a/readme/factory.md b/readme/factory.md index ba2c176ff..6a4c1fb30 100644 --- a/readme/factory.md +++ b/readme/factory.md @@ -61,7 +61,9 @@ var service = composition.MyService; service.Dependency.IsInitialized.ShouldBeTrue(); ``` -This approach is more expensive to maintain, but allows you to create objects more flexibly by passing them some state and introducing dependencies. As in the case of automatic dependency embedding, objects give up control on embedding, and the whole process takes place when the object graph is created. +This approach is more expensive to maintain, but allows you to create objects more flexibly by passing them some state and introducing dependencies. As in the case of automatic dependency injecting, objects give up control on embedding, and the whole process takes place when the object graph is created. +>[!IMPORTANT] +>The method `Inject()`cannot be used outside of the binding setup. The following partial class will be generated: diff --git a/readme/generic-async-composition-roots-with-constraints.md b/readme/generic-async-composition-roots-with-constraints.md index ef4ba86a3..b34b2bb83 100644 --- a/readme/generic-async-composition-roots-with-constraints.md +++ b/readme/generic-async-composition-roots-with-constraints.md @@ -2,6 +2,9 @@ [![CSharp](https://img.shields.io/badge/C%23-code-blue.svg)](../tests/Pure.DI.UsageTests/Generics/GenericAsyncCompositionRootsWithConstraintsScenario.cs) +>[!IMPORTANT] +>`Resolve' methods cannot be used to resolve generic composition roots. + ```c# interface IDependency @@ -56,8 +59,8 @@ var service = await composition.GetMyRootAsync(CancellationToken var someOtherService = await composition.GetOtherServiceAsync(CancellationToken.None); ``` -> [!IMPORTANT] -> `Resolve' methods cannot be used to resolve generic composition roots. +>[!IMPORTANT] +>The method `Inject()`cannot be used outside of the binding setup. The following partial class will be generated: diff --git a/readme/generic-composition-roots-with-constraints.md b/readme/generic-composition-roots-with-constraints.md index a5ba5851b..051c1c490 100644 --- a/readme/generic-composition-roots-with-constraints.md +++ b/readme/generic-composition-roots-with-constraints.md @@ -2,6 +2,9 @@ [![CSharp](https://img.shields.io/badge/C%23-code-blue.svg)](../tests/Pure.DI.UsageTests/Generics/GenericCompositionRootsWithConstraintsScenario.cs) +>[!IMPORTANT] +>`Resolve' methods cannot be used to resolve generic composition roots. + ```c# interface IDependency @@ -54,8 +57,8 @@ var service = composition.GetMyRoot(); var someOtherService = composition.GetOtherService(); ``` -> [!IMPORTANT] -> `Resolve' methods cannot be used to resolve generic composition roots. +>[!IMPORTANT] +>The method `Inject()`cannot be used outside of the binding setup. The following partial class will be generated: diff --git a/readme/generic-composition-roots.md b/readme/generic-composition-roots.md index 64e963299..9e8494515 100644 --- a/readme/generic-composition-roots.md +++ b/readme/generic-composition-roots.md @@ -3,6 +3,8 @@ [![CSharp](https://img.shields.io/badge/C%23-code-blue.svg)](../tests/Pure.DI.UsageTests/Generics/GenericsCompositionRootsScenario.cs) Sometimes you want to be able to create composition roots with type parameters. In this case, the composition root can only be represented by a method. +>[!IMPORTANT] +>`Resolve()' methods cannot be used to resolve generic composition roots. ```c# @@ -49,8 +51,8 @@ var service = composition.GetMyRoot(); var someOtherService = composition.GetOtherService(); ``` -> [!IMPORTANT] -> `Resolve' methods cannot be used to resolve generic composition roots. +>[!IMPORTANT] +>The method `Inject()`cannot be used outside of the binding setup. The following partial class will be generated: diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index 4ab67628e..897fa0e70 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -67,6 +67,9 @@ var service = composition.GetRoot(cancellationTokenSource.Token); await service.RunAsync(cancellationTokenSource.Token); ``` +>[!IMPORTANT] +>The method `Inject()`cannot be used outside of the binding setup. + The following partial class will be generated: ```c# diff --git a/readme/tag-unique.md b/readme/tag-unique.md index ee241d9b8..e48d2a0b7 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -2,7 +2,7 @@ [![CSharp](https://img.shields.io/badge/C%23-code-blue.svg)](../tests/Pure.DI.UsageTests/Advanced/TagUniqueScenario.cs) -`Tag.Unique` is useful to register a binding with a unique tag. It will not be available through the composition root or `Resolve` methods directly, but can be embedded in compositions as some kind of enumeration. +`Tag.Unique` is useful to register a binding with a unique tag. It will not be available through the composition root or `Resolve` methods directly, but can be injected in compositions as some kind of enumeration. ```c# diff --git a/src/Pure.DI.Core/Components/Api.g.cs b/src/Pure.DI.Core/Components/Api.g.cs index b875fc0ff..c0cdfcd54 100644 --- a/src/Pure.DI.Core/Components/Api.g.cs +++ b/src/Pure.DI.Core/Components/Api.g.cs @@ -1962,12 +1962,12 @@ internal interface IBinding } /// - /// Abstract injection context./>. + /// Injection context. Cannot be used outside of the binding setup. /// internal interface IContext { /// - /// The tag that was used to inject the current object in the object graph. See also + /// The tag that was used to inject the current object in the object graph. Cannot be used outside of the binding setup. See also /// /// /// DI.Setup("Composition") @@ -1985,7 +1985,7 @@ internal interface IContext object Tag { get; } /// - /// Injects an instance of type T. + /// Injects an instance of type T. Cannot be used outside of the binding setup. /// /// /// DI.Setup("Composition") @@ -2020,7 +2020,7 @@ internal interface IContext void Inject(out T value); /// - /// Injects an instance of type T marked with a tag. + /// Injects an instance of type T marked with a tag. Cannot be used outside of the binding setup. /// /// /// DI.Setup("Composition") diff --git a/tests/Pure.DI.UsageTests/Advanced/TagUniqueScenario.cs b/tests/Pure.DI.UsageTests/Advanced/TagUniqueScenario.cs index 6ced0b56f..86381bbf0 100644 --- a/tests/Pure.DI.UsageTests/Advanced/TagUniqueScenario.cs +++ b/tests/Pure.DI.UsageTests/Advanced/TagUniqueScenario.cs @@ -2,7 +2,7 @@ $v=true $p=4 $d=Tag Unique -$h=`Tag.Unique` is useful to register a binding with a unique tag. It will not be available through the composition root or `Resolve` methods directly, but can be embedded in compositions as some kind of enumeration. +$h=`Tag.Unique` is useful to register a binding with a unique tag. It will not be available through the composition root or `Resolve` methods directly, but can be injected in compositions as some kind of enumeration. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/BaseClassLibrary/ManualTaskScenario.cs b/tests/Pure.DI.UsageTests/BaseClassLibrary/ManualTaskScenario.cs index 0840ad460..00438edcb 100644 --- a/tests/Pure.DI.UsageTests/BaseClassLibrary/ManualTaskScenario.cs +++ b/tests/Pure.DI.UsageTests/BaseClassLibrary/ManualTaskScenario.cs @@ -3,6 +3,8 @@ $p=4 $d=Manually started tasks $h=By default, tasks are started automatically when they are injected. But you can override this behavior as shown in the example below. It is also recommended to add a binding for CancellationToken to be able to cancel the execution of a task. +$f=>[!IMPORTANT] +$f=>The method `Inject()`cannot be used outside of the binding setup. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/Basics/FactoryScenario.cs b/tests/Pure.DI.UsageTests/Basics/FactoryScenario.cs index 3511cf9aa..165075955 100644 --- a/tests/Pure.DI.UsageTests/Basics/FactoryScenario.cs +++ b/tests/Pure.DI.UsageTests/Basics/FactoryScenario.cs @@ -4,7 +4,9 @@ $d=Factory $h=This example demonstrates how to create and initialize an instance manually. $h=At the compilation stage, the set of dependencies that an object needs in order to be created is determined. In most cases, this happens automatically according to the set of constructors and their arguments and does not require any additional customization efforts. But sometimes it is necessary to manually create an object, as in lines of code: -$f=This approach is more expensive to maintain, but allows you to create objects more flexibly by passing them some state and introducing dependencies. As in the case of automatic dependency embedding, objects give up control on embedding, and the whole process takes place when the object graph is created. +$f=This approach is more expensive to maintain, but allows you to create objects more flexibly by passing them some state and introducing dependencies. As in the case of automatic dependency injecting, objects give up control on embedding, and the whole process takes place when the object graph is created. +$f=>[!IMPORTANT] +$f=>The method `Inject()`cannot be used outside of the binding setup. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/Generics/GenericAsyncCompositionRootsWithConstraintsScenario.cs b/tests/Pure.DI.UsageTests/Generics/GenericAsyncCompositionRootsWithConstraintsScenario.cs index 6918ddddd..cb6d2a141 100644 --- a/tests/Pure.DI.UsageTests/Generics/GenericAsyncCompositionRootsWithConstraintsScenario.cs +++ b/tests/Pure.DI.UsageTests/Generics/GenericAsyncCompositionRootsWithConstraintsScenario.cs @@ -2,8 +2,10 @@ $v=true $p=5 $d=Generic async composition roots with constraints -$f=> [!IMPORTANT] -$f=> `Resolve' methods cannot be used to resolve generic composition roots. +$h=>[!IMPORTANT] +$h=>`Resolve' methods cannot be used to resolve generic composition roots. +$f=>[!IMPORTANT] +$f=>The method `Inject()`cannot be used outside of the binding setup. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/Generics/GenericCompositionRootsWithConstraintsScenario.cs b/tests/Pure.DI.UsageTests/Generics/GenericCompositionRootsWithConstraintsScenario.cs index dea64d7bd..d821f6b0d 100644 --- a/tests/Pure.DI.UsageTests/Generics/GenericCompositionRootsWithConstraintsScenario.cs +++ b/tests/Pure.DI.UsageTests/Generics/GenericCompositionRootsWithConstraintsScenario.cs @@ -2,8 +2,10 @@ $v=true $p=4 $d=Generic composition roots with constraints -$f=> [!IMPORTANT] -$f=> `Resolve' methods cannot be used to resolve generic composition roots. +$h=>[!IMPORTANT] +$h=>`Resolve' methods cannot be used to resolve generic composition roots. +$f=>[!IMPORTANT] +$f=>The method `Inject()`cannot be used outside of the binding setup. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/Generics/GenericsCompositionRootsScenario.cs b/tests/Pure.DI.UsageTests/Generics/GenericsCompositionRootsScenario.cs index 0948eb063..016164e2b 100644 --- a/tests/Pure.DI.UsageTests/Generics/GenericsCompositionRootsScenario.cs +++ b/tests/Pure.DI.UsageTests/Generics/GenericsCompositionRootsScenario.cs @@ -3,8 +3,10 @@ $p=2 $d=Generic composition roots $h=Sometimes you want to be able to create composition roots with type parameters. In this case, the composition root can only be represented by a method. -$f=> [!IMPORTANT] -$f=> `Resolve' methods cannot be used to resolve generic composition roots. +$h=>[!IMPORTANT] +$h=>`Resolve()' methods cannot be used to resolve generic composition roots. +$f=>[!IMPORTANT] +$f=>The method `Inject()`cannot be used outside of the binding setup. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/Interception/DecoratorScenario.cs b/tests/Pure.DI.UsageTests/Interception/DecoratorScenario.cs index ed4190548..d3b1ab31e 100644 --- a/tests/Pure.DI.UsageTests/Interception/DecoratorScenario.cs +++ b/tests/Pure.DI.UsageTests/Interception/DecoratorScenario.cs @@ -4,7 +4,7 @@ $d=Decorator $h=Interception is the ability to intercept calls between objects in order to enrich or change their behavior, but without having to change their code. A prerequisite for interception is weak binding. That is, if programming is abstraction-based, the underlying implementation can be transformed or improved by "packaging" it into other implementations of the same abstraction. At its core, intercept is an application of the Decorator design pattern. This pattern provides a flexible alternative to inheritance by dynamically "attaching" additional responsibility to an object. Decorator "packs" one implementation of an abstraction into another implementation of the same abstraction like a "matryoshka doll". $h=_Decorator_ is a well-known and useful design pattern. It is convenient to use tagged dependencies to build a chain of nested decorators, as in the example below: -$f=Here an instance of the _Service_ type, labeled _"base"_, is embedded in the decorator _DecoratorService_. You can use any tag that semantically reflects the feature of the abstraction being embedded. The tag can be a constant, a type, or a value of an enumerated type. +$f=Here an instance of the _Service_ type, labeled _"base"_, is injected in the decorator _DecoratorService_. You can use any tag that semantically reflects the feature of the abstraction being embedded. The tag can be a constant, a type, or a value of an enumerated type. */ // ReSharper disable ClassNeverInstantiated.Local diff --git a/tests/Pure.DI.UsageTests/Lifetimes/AutoScopedScenario.cs b/tests/Pure.DI.UsageTests/Lifetimes/AutoScopedScenario.cs index 1c1649da1..58c73380f 100644 --- a/tests/Pure.DI.UsageTests/Lifetimes/AutoScopedScenario.cs +++ b/tests/Pure.DI.UsageTests/Lifetimes/AutoScopedScenario.cs @@ -3,6 +3,8 @@ $p=5 $d=Auto scoped $h=You can use the following example to automatically create a session when creating instances of a particular type: +$f=>[!IMPORTANT] +$f=>The method `Inject()`cannot be used outside of the binding setup. */ // ReSharper disable ClassNeverInstantiated.Local