Skip to content

Commit 49ccaff

Browse files
Update documentation
1 parent 31953db commit 49ccaff

30 files changed

+76
-76
lines changed

AGENTS.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ Advantages:
11961196
- Can be used with legacy code
11971197

11981198
Use Cases:
1199-
- When objects are created outside the DI container
1199+
- When objects are created outside the DI
12001200
- For working with third-party libraries
12011201
- When migrating existing code to DI
12021202
- For complex object graphs where full construction is not feasible
@@ -1440,7 +1440,7 @@ interface ISmartKitchen
14401440
class SmartKitchen : ISmartKitchen
14411441
{
14421442
// The Dependency attribute specifies to perform an injection.
1443-
// The container will automatically assign a value to this field
1443+
// The DI will automatically assign a value to this field
14441444
// when creating the SmartKitchen instance.
14451445
[Dependency]
14461446
public ICoffeeMachine? CoffeeMachineImpl;
@@ -1457,11 +1457,11 @@ To run the above code, the following NuGet packages must be added:
14571457
The key points are:
14581458
- The field must be writable
14591459
- The `Dependency` (or `Ordinal`) attribute is used to mark the field for injection
1460-
- The container automatically injects the dependency when resolving the object graph
1460+
- The DI automatically injects the dependency when resolving the object graph
14611461

14621462
## Method injection
14631463

1464-
To use dependency implementation for a method, simply add the _Ordinal_ attribute to that method, specifying the sequence number that will be used to define the call to that method:
1464+
To use dependency injection for a method, simply add the _Dependency_ (or _Ordinal_) attribute to that method, specifying the sequence number that will be used to define the call to that method:
14651465

14661466
```c#
14671467
using Shouldly;
@@ -1489,9 +1489,9 @@ interface INavigator
14891489

14901490
class Navigator : INavigator
14911491
{
1492-
// The Dependency attribute specifies that the container should call this method
1493-
// to inject the dependency.
1494-
[Dependency]
1492+
// The Dependency (or Ordinal) attribute indicates that the method
1493+
// should be called to inject the dependency.
1494+
[Dependency(ordinal: 0)]
14951495
public void LoadMap(IMap map) =>
14961496
CurrentMap = map;
14971497

@@ -1506,7 +1506,7 @@ To run the above code, the following NuGet packages must be added:
15061506
The key points are:
15071507
- The method must be available to be called from a composition class
15081508
- The `Dependency` (or `Ordinal`) attribute is used to mark the method for injection
1509-
- The container automatically calls the method to inject dependencies
1509+
- The DI automatically calls the method to inject dependencies
15101510

15111511
## Property injection
15121512

@@ -1553,7 +1553,7 @@ To run the above code, the following NuGet packages must be added:
15531553
The key points are:
15541554
- The property must be writable
15551555
- The `Dependency` (or `Ordinal`) attribute is used to mark the property for injection
1556-
- The container automatically injects the dependency when resolving the object graph
1556+
- The DI automatically injects the dependency when resolving the object graph
15571557

15581558
## Default values
15591559

@@ -1605,7 +1605,7 @@ To run the above code, the following NuGet packages must be added:
16051605

16061606
The key points are:
16071607
- Default constructor arguments can be used for simple values
1608-
- The DI container will use these defaults if no explicit bindings are provided
1608+
- The DI will use these defaults if no explicit bindings are provided
16091609

16101610
This example shows how to handle default values in a dependency injection scenario:
16111611
- **Constructor Default Argument**: The `SecuritySystem` class has a constructor with a default value for the name parameter. If no value is provided, "Home Guard" will be used.
@@ -2453,7 +2453,7 @@ sealed class CheckoutService(IRequestContext context) : ICheckoutService
24532453
public IRequestContext Context => context;
24542454
}
24552455

2456-
// Implements a request scope (per-request container)
2456+
// Implements a request scope (per-request composition)
24572457
sealed class RequestScope(Composition parent) : Composition(parent);
24582458

24592459
partial class App(Func<RequestScope> requestScopeFactory)
@@ -2940,7 +2940,7 @@ interface ICheckoutService
29402940
/// <summary>
29412941
/// Represents a singleton infrastructure component.
29422942
/// Think: audit log writer, message producer, telemetry pipeline, DB connection, etc.
2943-
/// It is owned by the DI container and must be disposed asynchronously.
2943+
/// It is owned by the DI composition and must be disposed asynchronously.
29442944
/// </summary>
29452945
sealed class AuditLogWriter : IAsyncDisposable
29462946
{
@@ -5207,13 +5207,13 @@ class SqlDatabaseClient : IDatabaseClient
52075207
{
52085208
// The integer value in the argument specifies
52095209
// the ordinal of injection.
5210-
// The DI container will try to use this constructor first (Ordinal 0).
5210+
// The DI will try to use this constructor first (Ordinal 0).
52115211
[Ordinal(0)]
52125212
internal SqlDatabaseClient(string connectionString) =>
52135213
ConnectionString = connectionString;
52145214

52155215
// If the first constructor cannot be used (e.g. connectionString is missing),
5216-
// the DI container will try to use this one (Ordinal 1).
5216+
// the DI will try to use this one (Ordinal 1).
52175217
[Ordinal(1)]
52185218
public SqlDatabaseClient(IConfiguration configuration) =>
52195219
ConnectionString = "Server=.;Database=DefaultDb;";
@@ -5814,7 +5814,7 @@ class DiscreteGpu : IGpu
58145814

58155815
class GraphicsAdapter
58165816
{
5817-
// Binds the property to the container with the specified
5817+
// Binds the property to the composition with the specified
58185818
// lifetime and tag. This allows the "HighPerformance" GPU
58195819
// to be injected into other components.
58205820
[Bind(lifetime: Lifetime.Singleton, tags: ["HighPerformance"])]
@@ -6421,7 +6421,7 @@ class BusinessService(IDatabaseAccess databaseAccess) : IBusinessService
64216421

64226422
partial class Composition
64236423
{
6424-
// This method is called when a dependency cannot be resolved by the standard DI container.
6424+
// This method is called when a dependency cannot be resolved by the standard DI.
64256425
// It serves as a fallback mechanism.
64266426
private partial T OnCannotResolve<T>(
64276427
object? tag,
@@ -8143,7 +8143,7 @@ partial class Composition
81438143
partial class Composition
81448144
{
81458145
// Public API setup (Composition Roots).
8146-
// Determines which objects can be retrieved directly from the container.
8146+
// Determines which objects can be retrieved directly from the composition.
81478147
private static void SetupApi() =>
81488148
DI.Setup()
81498149
.Root<IClassCommenter>("Commenter");
@@ -8716,7 +8716,7 @@ queryHandler1.ExclusiveConnection.IsDisposed.ShouldBeTrue();
87168716
// The shared connection is STILL alive
87178717
queryHandler1.SharedConnection.IsDisposed.ShouldBeFalse();
87188718

8719-
// Disposing the composition root container
8719+
// Disposing the root composition
87208720
// This should dispose all Singletons
87218721
composition.Dispose();
87228722

@@ -8759,7 +8759,7 @@ class QueryHandler(
87598759
// Disposes the owned instances.
87608760
// For the exclusive connection (Transient), this disposes the actual connection.
87618761
// For the shared connection (Singleton), this just releases the ownership
8762-
// but does NOT dispose the underlying singleton instance until the container is disposed.
8762+
// but does NOT dispose the underlying singleton instance until the composition is disposed.
87638763
_exclusiveConnection.Dispose();
87648764
_sharedConnection.Dispose();
87658765
}
@@ -9344,7 +9344,7 @@ To run the above code, the following NuGet packages must be added:
93449344
- [Pure.DI.Abstractions](https://www.nuget.org/packages/Pure.DI.Abstractions)
93459345

93469346
>[!NOTE]
9347-
>AutoMapper integration enables clean separation between DI container concerns and object mapping logic.
9347+
>AutoMapper integration enables clean separation between DI composition concerns and object mapping logic.
93489348
93499349
## JSON serialization
93509350

AGENTS_MEDIUM.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ Advantages:
11961196
- Can be used with legacy code
11971197

11981198
Use Cases:
1199-
- When objects are created outside the DI container
1199+
- When objects are created outside the DI
12001200
- For working with third-party libraries
12011201
- When migrating existing code to DI
12021202
- For complex object graphs where full construction is not feasible
@@ -1440,7 +1440,7 @@ interface ISmartKitchen
14401440
class SmartKitchen : ISmartKitchen
14411441
{
14421442
// The Dependency attribute specifies to perform an injection.
1443-
// The container will automatically assign a value to this field
1443+
// The DI will automatically assign a value to this field
14441444
// when creating the SmartKitchen instance.
14451445
[Dependency]
14461446
public ICoffeeMachine? CoffeeMachineImpl;
@@ -1457,11 +1457,11 @@ To run the above code, the following NuGet packages must be added:
14571457
The key points are:
14581458
- The field must be writable
14591459
- The `Dependency` (or `Ordinal`) attribute is used to mark the field for injection
1460-
- The container automatically injects the dependency when resolving the object graph
1460+
- The DI automatically injects the dependency when resolving the object graph
14611461

14621462
## Method injection
14631463

1464-
To use dependency implementation for a method, simply add the _Ordinal_ attribute to that method, specifying the sequence number that will be used to define the call to that method:
1464+
To use dependency injection for a method, simply add the _Dependency_ (or _Ordinal_) attribute to that method, specifying the sequence number that will be used to define the call to that method:
14651465

14661466
```c#
14671467
using Shouldly;
@@ -1489,9 +1489,9 @@ interface INavigator
14891489

14901490
class Navigator : INavigator
14911491
{
1492-
// The Dependency attribute specifies that the container should call this method
1493-
// to inject the dependency.
1494-
[Dependency]
1492+
// The Dependency (or Ordinal) attribute indicates that the method
1493+
// should be called to inject the dependency.
1494+
[Dependency(ordinal: 0)]
14951495
public void LoadMap(IMap map) =>
14961496
CurrentMap = map;
14971497

@@ -1506,7 +1506,7 @@ To run the above code, the following NuGet packages must be added:
15061506
The key points are:
15071507
- The method must be available to be called from a composition class
15081508
- The `Dependency` (or `Ordinal`) attribute is used to mark the method for injection
1509-
- The container automatically calls the method to inject dependencies
1509+
- The DI automatically calls the method to inject dependencies
15101510

15111511
## Property injection
15121512

@@ -1553,7 +1553,7 @@ To run the above code, the following NuGet packages must be added:
15531553
The key points are:
15541554
- The property must be writable
15551555
- The `Dependency` (or `Ordinal`) attribute is used to mark the property for injection
1556-
- The container automatically injects the dependency when resolving the object graph
1556+
- The DI automatically injects the dependency when resolving the object graph
15571557

15581558
## Default values
15591559

@@ -1605,7 +1605,7 @@ To run the above code, the following NuGet packages must be added:
16051605

16061606
The key points are:
16071607
- Default constructor arguments can be used for simple values
1608-
- The DI container will use these defaults if no explicit bindings are provided
1608+
- The DI will use these defaults if no explicit bindings are provided
16091609

16101610
This example shows how to handle default values in a dependency injection scenario:
16111611
- **Constructor Default Argument**: The `SecuritySystem` class has a constructor with a default value for the name parameter. If no value is provided, "Home Guard" will be used.
@@ -2788,13 +2788,13 @@ class SqlDatabaseClient : IDatabaseClient
27882788
{
27892789
// The integer value in the argument specifies
27902790
// the ordinal of injection.
2791-
// The DI container will try to use this constructor first (Ordinal 0).
2791+
// The DI will try to use this constructor first (Ordinal 0).
27922792
[Ordinal(0)]
27932793
internal SqlDatabaseClient(string connectionString) =>
27942794
ConnectionString = connectionString;
27952795

27962796
// If the first constructor cannot be used (e.g. connectionString is missing),
2797-
// the DI container will try to use this one (Ordinal 1).
2797+
// the DI will try to use this one (Ordinal 1).
27982798
[Ordinal(1)]
27992799
public SqlDatabaseClient(IConfiguration configuration) =>
28002800
ConnectionString = "Server=.;Database=DefaultDb;";

AGENTS_SMALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ sealed class CheckoutService(IRequestContext context) : ICheckoutService
11791179
public IRequestContext Context => context;
11801180
}
11811181

1182-
// Implements a request scope (per-request container)
1182+
// Implements a request scope (per-request composition)
11831183
sealed class RequestScope(Composition parent) : Composition(parent);
11841184

11851185
partial class App(Func<RequestScope> requestScopeFactory)

readme/a-few-partial-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ partial class Composition
4242
partial class Composition
4343
{
4444
// Public API setup (Composition Roots).
45-
// Determines which objects can be retrieved directly from the container.
45+
// Determines which objects can be retrieved directly from the composition.
4646
private static void SetupApi() =>
4747
DI.Setup()
4848
.Root<IClassCommenter>("Commenter");

readme/async-disposable-singleton.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ interface ICheckoutService
4242
/// <summary>
4343
/// Represents a singleton infrastructure component.
4444
/// Think: audit log writer, message producer, telemetry pipeline, DB connection, etc.
45-
/// It is owned by the DI container and must be disposed asynchronously.
45+
/// It is owned by the DI composition and must be disposed asynchronously.
4646
/// </summary>
4747
sealed class AuditLogWriter : IAsyncDisposable
4848
{

readme/automapper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ dotnet run
172172
</details>
173173

174174
>[!NOTE]
175-
>AutoMapper integration enables clean separation between DI container concerns and object mapping logic.
175+
>AutoMapper integration enables clean separation between DI composition concerns and object mapping logic.
176176
177177
The following partial class will be generated:
178178

readme/bind-attribute-with-lifetime-and-tag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DiscreteGpu : IGpu
3030

3131
class GraphicsAdapter
3232
{
33-
// Binds the property to the container with the specified
33+
// Binds the property to the composition with the specified
3434
// lifetime and tag. This allows the "HighPerformance" GPU
3535
// to be injected into other components.
3636
[Bind(lifetime: Lifetime.Singleton, tags: ["HighPerformance"])]

readme/builder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Advantages:
8383
- Can be used with legacy code
8484

8585
Use Cases:
86-
- When objects are created outside the DI container
86+
- When objects are created outside the DI
8787
- For working with third-party libraries
8888
- When migrating existing code to DI
8989
- For complex object graphs where full construction is not feasible

readme/constructor-ordinal-attribute.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class SqlDatabaseClient : IDatabaseClient
3535
{
3636
// The integer value in the argument specifies
3737
// the ordinal of injection.
38-
// The DI container will try to use this constructor first (Ordinal 0).
38+
// The DI will try to use this constructor first (Ordinal 0).
3939
[Ordinal(0)]
4040
internal SqlDatabaseClient(string connectionString) =>
4141
ConnectionString = connectionString;
4242

4343
// If the first constructor cannot be used (e.g. connectionString is missing),
44-
// the DI container will try to use this one (Ordinal 1).
44+
// the DI will try to use this one (Ordinal 1).
4545
[Ordinal(1)]
4646
public SqlDatabaseClient(IConfiguration configuration) =>
4747
ConnectionString = "Server=.;Database=DefaultDb;";

readme/default-values.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ dotnet run
7272

7373
The key points are:
7474
- Default constructor arguments can be used for simple values
75-
- The DI container will use these defaults if no explicit bindings are provided
75+
- The DI will use these defaults if no explicit bindings are provided
7676

7777
This example shows how to handle default values in a dependency injection scenario:
7878
- **Constructor Default Argument**: The `SecuritySystem` class has a constructor with a default value for the name parameter. If no value is provided, "Home Guard" will be used.

0 commit comments

Comments
 (0)