You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1196,7 +1196,7 @@ Advantages:
1196
1196
- Can be used with legacy code
1197
1197
1198
1198
Use Cases:
1199
-
- When objects are created outside the DI container
1199
+
- When objects are created outside the DI
1200
1200
- For working with third-party libraries
1201
1201
- When migrating existing code to DI
1202
1202
- For complex object graphs where full construction is not feasible
@@ -1440,7 +1440,7 @@ interface ISmartKitchen
1440
1440
classSmartKitchen : ISmartKitchen
1441
1441
{
1442
1442
// 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
1444
1444
// when creating the SmartKitchen instance.
1445
1445
[Dependency]
1446
1446
publicICoffeeMachine? CoffeeMachineImpl;
@@ -1457,11 +1457,11 @@ To run the above code, the following NuGet packages must be added:
1457
1457
The key points are:
1458
1458
- The field must be writable
1459
1459
- 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
1461
1461
1462
1462
## Method injection
1463
1463
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:
1465
1465
1466
1466
```c#
1467
1467
usingShouldly;
@@ -1489,9 +1489,9 @@ interface INavigator
1489
1489
1490
1490
classNavigator : INavigator
1491
1491
{
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)]
1495
1495
publicvoidLoadMap(IMapmap) =>
1496
1496
CurrentMap=map;
1497
1497
@@ -1506,7 +1506,7 @@ To run the above code, the following NuGet packages must be added:
1506
1506
The key points are:
1507
1507
- The method must be available to be called from a composition class
1508
1508
- 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
1510
1510
1511
1511
## Property injection
1512
1512
@@ -1553,7 +1553,7 @@ To run the above code, the following NuGet packages must be added:
1553
1553
The key points are:
1554
1554
- The property must be writable
1555
1555
- 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
1557
1557
1558
1558
## Default values
1559
1559
@@ -1605,7 +1605,7 @@ To run the above code, the following NuGet packages must be added:
1605
1605
1606
1606
The key points are:
1607
1607
- 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
1609
1609
1610
1610
This example shows how to handle default values in a dependency injection scenario:
1611
1611
-**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
2453
2453
publicIRequestContextContext=>context;
2454
2454
}
2455
2455
2456
-
// Implements a request scope (per-request container)
2456
+
// Implements a request scope (per-request composition)
Copy file name to clipboardExpand all lines: AGENTS_MEDIUM.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1196,7 +1196,7 @@ Advantages:
1196
1196
- Can be used with legacy code
1197
1197
1198
1198
Use Cases:
1199
-
- When objects are created outside the DI container
1199
+
- When objects are created outside the DI
1200
1200
- For working with third-party libraries
1201
1201
- When migrating existing code to DI
1202
1202
- For complex object graphs where full construction is not feasible
@@ -1440,7 +1440,7 @@ interface ISmartKitchen
1440
1440
classSmartKitchen : ISmartKitchen
1441
1441
{
1442
1442
// 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
1444
1444
// when creating the SmartKitchen instance.
1445
1445
[Dependency]
1446
1446
publicICoffeeMachine? CoffeeMachineImpl;
@@ -1457,11 +1457,11 @@ To run the above code, the following NuGet packages must be added:
1457
1457
The key points are:
1458
1458
- The field must be writable
1459
1459
- 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
1461
1461
1462
1462
## Method injection
1463
1463
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:
1465
1465
1466
1466
```c#
1467
1467
usingShouldly;
@@ -1489,9 +1489,9 @@ interface INavigator
1489
1489
1490
1490
classNavigator : INavigator
1491
1491
{
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)]
1495
1495
publicvoidLoadMap(IMapmap) =>
1496
1496
CurrentMap=map;
1497
1497
@@ -1506,7 +1506,7 @@ To run the above code, the following NuGet packages must be added:
1506
1506
The key points are:
1507
1507
- The method must be available to be called from a composition class
1508
1508
- 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
1510
1510
1511
1511
## Property injection
1512
1512
@@ -1553,7 +1553,7 @@ To run the above code, the following NuGet packages must be added:
1553
1553
The key points are:
1554
1554
- The property must be writable
1555
1555
- 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
1557
1557
1558
1558
## Default values
1559
1559
@@ -1605,7 +1605,7 @@ To run the above code, the following NuGet packages must be added:
1605
1605
1606
1606
The key points are:
1607
1607
- 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
1609
1609
1610
1610
This example shows how to handle default values in a dependency injection scenario:
1611
1611
-**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
2788
2788
{
2789
2789
// The integer value in the argument specifies
2790
2790
// 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).
Copy file name to clipboardExpand all lines: readme/default-values.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ dotnet run
72
72
73
73
The key points are:
74
74
- 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
76
76
77
77
This example shows how to handle default values in a dependency injection scenario:
78
78
-**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