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: docs/docs/test-lifecycle/property-injection.md
+5-10Lines changed: 5 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,11 @@ The required keyword keeps your code clean and correct. If a property isn't pass
8
8
## AOT-Compatible Property Attributes
9
9
10
10
Supported attributes for properties in AOT mode:
11
-
-**Argument** - Compile-time constant values
12
-
-**MethodDataSource** - Static method data sources
13
-
-**ClassDataSource** - Static class-based data sources
11
+
-**MethodDataSource** - Data sources via calling a method
12
+
-**ClassDataSource<T>** - A data source that injects in T
14
13
-**DataSourceGeneratorAttribute** - Source-generated data (first item only)
15
-
-**ClassDataSource** - Dependency injection with service provider
14
+
15
+
For dependency injection with service providers, inherit from `DependencyInjectionDataSourceAttribute<TScope>` to create custom attributes. See [Dependency Injection](./dependency-injection.md) documentation for details.
16
16
17
17
The AOT system generates strongly-typed property setters at compile time, eliminating reflection overhead and ensuring Native AOT compatibility.
18
18
@@ -55,10 +55,6 @@ namespace MyTestProject;
55
55
56
56
publicclassPropertySetterTests
57
57
{
58
-
// Compile-time constant injection
59
-
[Arguments("1")]
60
-
publicrequiredstringProperty1 { get; init; }
61
-
62
58
// Static method data source injection
63
59
[MethodDataSource(nameof(GetMethodData))]
64
60
publicrequiredstringProperty2 { get; init; }
@@ -83,15 +79,14 @@ public class PropertySetterTests
0 commit comments