Class ReflectionActivationUtils
Reflection helpers for resolving a Type by name and converting a raw string into an
argument of an arbitrary target type. Mirrors the private matching semantics of
Serenity.Tasking.Application.Tasks.ReflectionCallTask (the source of truth: an exact
FullName match, then a short-name match only when it uniquely identifies a single
loaded type) so every reflection-based activation site in Serenity behaves identically for a given
type name. Kept as a standalone copy rather than having ReflectionCallTask delegate here, to
avoid changing the behavior of that existing boot-pipeline task outside dedicated test coverage.
Inherited Members
Namespace: Serenity.Shared.Utils
Assembly: Serenity.Shared.dll
Syntax
public static class ReflectionActivationUtils
Methods
ConvertFromString(string, Type)
Converts a string to the specified target type, supporting basic types, enums, and types with a public static TryParse method.
Declaration
public static object ConvertFromString(string raw, Type targetType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | raw | The raw string to convert. |
| Type | targetType | The target type to convert to. |
Returns
| Type | Description |
|---|---|
| object | The converted object. |
ResolveType(string)
Resolves a type by its name, trying the runtime-qualified name first, then an exact full-name match, then a short-name match if it uniquely identifies a single loaded type.
Declaration
public static Type ResolveType(string typeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | typeName | The name of the type to resolve. |
Returns
| Type | Description |
|---|---|
| Type | The resolved type, or null if not found or ambiguous. |