Type Descriptions
The ClientBuilder provides powerful utilities to analyze .NET types using reflection, then describe them in a consistent, structured format. This is especially useful for multiple purposes.
At the center of this system are two key parts:
TypeDescription: a structured representation of any .NET typeIDescriptionExtractor: a reflection-based service that producesTypeDescriptionobjects for any input type
What is TypeDescription?
TypeDescription is a metadata model that represents the structure and characteristics of a .NET Type. It acts like a schema snapshot for:
- Classes
- Interfaces
- Enums
- Collections
- Generics
- Complex domain models
What does it describe?
| Field | Description |
|---|---|
Name | The short name of the type, e.g., User. |
FullName | Fully qualified .NET type name, e.g., MyApp.Domain.Models.User. |
Properties | All public, non-static, non-excluded properties, as PropertyDescription. |
IsClass | True if the type is a class. |
IsInterface | True if the type is an interface. |
IsEnum | True if the type is an enum. |
IsCollection | True if the type is a collection or array. |
IsNullable | True if the type is nullable. |
IsGenericType | True if the type is generic (e.g., List<T>). |
GenericTypes | The generic type arguments. |
GenericTypeDescription | The base generic type definition (List<>). |
BaseType | The base type (e.g., a parent class). |
IsComplex | True if the type is complex (not primitive or enum). |
Hardcoded | True if the description was overridden manually. |
EnumValues | Raw key-value pairs for enum name and integer value. |
EnumValueItems | Enum entries with friendly names, keys, etc. |
SourceType | The original .NET Type instance. |
What is PropertyDescription?
Each property inside a TypeDescription is described using PropertyDescription:
| Field | Description |
|---|---|
Name | The property name, e.g., FirstName. |
Type | Its TypeDescription. |
ReadOnly | True if the property is read-only. |
DefaultValue | The default value, if available. |
What is IDescriptionExtractor?
IDescriptionExtractor is a reflection-based service for extracting TypeDescription metadata from runtime .NET Type definitions.
The extractor supports:
| Method | Purpose |
|---|---|
ExtractTypeDescription | Analyze a Type and produce its TypeDescription. |
ExtractResponseDescription | Same as above but wraps void/non-void logic. |
ExtractArgumentDescription | Describe a method argument by name + type. |
ExtractUniqueClassesFromClasses | Find all unique classes (including nested ones). |
ExtractInnerClassDescriptions | Recursively find inner classes for a given type. |
ExtractUniqueEnumsFromClasses | Find unique enums in a given type tree. |