Class TypeShapeAttribute
- Namespace
- PolyType
- Assembly
- PolyType.dll
Configures the generated ITypeShape of the annotated type.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class TypeShapeAttribute : Attribute
- Inheritance
-
TypeShapeAttribute
- Inherited Members
Properties
AssociatedTypes
Types for which a factory should be generated when a type shape is generated for the type this attribute is applied to.
public Type[] AssociatedTypes { get; init; }
Property Value
- Type[]
Remarks
Each type must declare a public default constructor.
If the type this attribute is applied to is a generic type definition, each type in this array must also be a generic type definition with the same number of generic type parameters.
Kind
Gets the kind that should be generated for the annotated type.
public TypeShapeKind Kind { get; init; }
Property Value
Remarks
Passing None will result in the generation of an IObjectTypeShape that does not contain any properties or constructors.
Exceptions
- ArgumentOutOfRangeException
The specified value is not a valid TypeShapeKind.
Marshaller
Gets a type implementing an IMarshaller<T, TSurrogate> to a surrogate type.
public Type? Marshaller { get; init; }
Property Value
Remarks
The type should have a parameterless constructor and must implement IMarshaller<T, TSurrogate> where either of the two generic types should match the annotated type.
Types that specify a Marshaller will be of shape ISurrogateTypeShape.