Class DerivedTypes

Namespace
Cratis.Serialization
Assembly
Cratis.Fundamentals.dll

Represents an implementation of IDerivedTypes.

[Singleton]
public class DerivedTypes : IDerivedTypes
Inheritance
DerivedTypes
Implements
Inherited Members
Extension Methods

Constructors

DerivedTypes(ITypes)

Initializes a new instance of ITypes.

public DerivedTypes(ITypes types)

Parameters

types ITypes

ITypes representing all types in the system.

Fields

Instance

Gets the global instance of DerivedTypes.

public static readonly DerivedTypes Instance

Field Value

DerivedTypes

Remarks

Its recommended to use the singleton defined here, rather than building your own instance. This is due to the performance impact of scanning all assemblies in the application.

Properties

TypesWithDerivatives

Gets all the types that has derivatives.

public IEnumerable<Type> TypesWithDerivatives { get; }

Property Value

IEnumerable<Type>

Methods

GetDerivedTypeFor(Type, DerivedTypeId)

Get the derived type for a target type.

public Type GetDerivedTypeFor(Type targetType, DerivedTypeId derivedTypeId)

Parameters

targetType Type

Target type to get for.

derivedTypeId DerivedTypeId

The unique identifier of the derived type.

Returns

Type

The derived type.

GetTargetTypeFor(Type)

Get the target type from a derived type.

public Type GetTargetTypeFor(Type derivedType)

Parameters

derivedType Type

Derived type to get from.

Returns

Type

The target type.

HasDerivatives(Type)

Check if a type has derivative types.

public bool HasDerivatives(Type type)

Parameters

type Type

Type to check.

Returns

bool

True if it has derivatives, false if not.

IsDerivedType(Type)

Check if a type is a derived type.

public bool IsDerivedType(Type type)

Parameters

type Type

Type to check.

Returns

bool

True if it is a derived type, false if not.