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
Another example of `CustomHandler` is to register Options types. We can define custom `OptionAttribute`, which allows to specify configuration section key.
103
-
And then read that value in our `CustomHandler`:
102
+
Another example of `Handler` is to register Options types. We can define custom `OptionAttribute`, which allows to specify configuration section key.
@@ -164,12 +164,12 @@ public static partial class ModelBuilderExtensions
164
164
|**ExcludeByTypeName**| Sets this value to exclude types from being registered by their full name. You can use '*' wildcards. You can also use ',' to separate multiple filters. |
165
165
|**ExcludeByAttribute**| Excludes matching types by the specified attribute type being present. |
166
166
|**KeySelector**| Sets this property to add types as keyed services. This property should point to one of the following: <br>- The name of a static method in the current type with a string return type. The method should be either generic or have a single parameter of type `Type`. <br>- A constant field or static property in the implementation type. |
167
-
|**CustomHandler**|*(Obsolete — use `GenerateServiceHandler` instead.)* Sets this property to invoke a custom method for each type found instead of regular registration logic. |
167
+
|**CustomHandler**|*(Obsolete — use `ScanForTypes` instead.)* Sets this property to invoke a custom method for each type found instead of regular registration logic. |
168
168
169
-
`GenerateServiceHandler` attribute is used to invoke a custom method for each matched type. It has the same filtering properties as `GenerateServiceRegistrations`, but without the registration-specific ones (`Lifetime`, `AsImplementedInterfaces`, `AsSelf`, `KeySelector`):
169
+
`ScanForTypes` attribute is used to invoke a custom method for each matched type. It has the same filtering properties as `GenerateServiceRegistrations`, but without the registration-specific ones (`Lifetime`, `AsImplementedInterfaces`, `AsSelf`, `KeySelector`):
170
170
| Property | Description |
171
171
| --- | --- |
172
-
|**CustomHandler**| Sets this property to invoke a custom method for each type found. This property should point to one of the following: <br>- Name of a generic method in the current type. <br>- Static method name in found types. <br>**Note:** Types are automatically filtered by the generic constraints defined on the method's type parameters (e.g., `class`, `struct`, `new()`, interface constraints). |
172
+
|**Handler**| Sets this property to invoke a custom method for each type found. This property should point to one of the following: <br>- Name of a generic method in the current type. <br>- Static method name in found types. <br>**Note:** Types are automatically filtered by the generic constraints defined on the method's type parameters (e.g., `class`, `struct`, `new()`, interface constraints). |
173
173
|**FromAssemblyOf**| Sets the assembly containing the given type as the source of types to scan. If not specified, the assembly containing the method with this attribute will be used. |
174
174
|**AssemblyNameFilter**| Sets this value to filter scanned assemblies by assembly name. This option is incompatible with `FromAssemblyOf`. You can use '*' wildcards. You can also use ',' to separate multiple filters. |
175
175
|**AssignableTo**| Sets the type that the scanned types must be assignable to. |
0 commit comments