Interface ITypes

Namespace
Cratis.Types
Assembly
Cratis.Fundamentals.dll

Defines a system for working with types.

public interface ITypes
Extension Methods

Properties

All

Gets returns all collected types.

IEnumerable<Type> All { get; }

Property Value

IEnumerable<Type>

Assemblies

Gets all assemblies used for type discovery.

IEnumerable<Assembly> Assemblies { get; }

Property Value

IEnumerable<Assembly>

DiscoveryMode

Gets how the assemblies used for type discovery were arrived at.

TypeDiscoveryMode DiscoveryMode { get; }

Property Value

TypeDiscoveryMode

Remarks

Together with Assemblies this answers, from a running application, which discovery strategy is in force and which assemblies reached it. That matters because Generated captures only the assemblies loaded by the time the type universe was built, and an assembly that arrives later contributes nothing to it - silently, since a shorter FindMultiple<T>() result is indistinguishable from a feature nobody wrote.

Defaulted rather than abstract so that adding it breaks no existing implementation. An implementation that does not say reports Unknown.

Methods

FindMultiple(Type)

Find multiple implementations of a basetype.

IEnumerable<Type> FindMultiple(Type type)

Parameters

type Type

Basetype to find for.

Returns

IEnumerable<Type>

All types implementing or inheriting from the given basetype.

Remarks

If the base type is an interface, it will look for any types implementing the interface. If it is a class, it will find anyone inheriting from that class.

FindMultiple<T>()

Find multiple implementations of a basetype.

IEnumerable<Type> FindMultiple<T>()

Returns

IEnumerable<Type>

All types implementing or inheriting from the given basetype.

Type Parameters

T

Basetype to find for.

Remarks

If the base type is an interface, it will look for any types implementing the interface. If it is a class, it will find anyone inheriting from that class.

FindSingle(Type)

Find a single implementation of a basetype.

Type FindSingle(Type type)

Parameters

type Type

Basetype to find for.

Returns

Type

Type found.

Remarks

If the base type is an interface, it will look for any types implementing the interface. If it is a class, it will find anyone inheriting from that class.

Exceptions

MultipleTypesFound

If there is more than one instance found.

FindSingle<T>()

Find a single implementation of a basetype.

Type FindSingle<T>()

Returns

Type

Type found.

Type Parameters

T

Basetype to find for.

Remarks

If the base type is an interface, it will look for any types implementing the interface. If it is a class, it will find anyone inheriting from that class.

Exceptions

MultipleTypesFound

If there is more than one instance found.

FindTypeByFullName(string)

Find a single type using the full name, without assembly.

Type FindTypeByFullName(string fullName)

Parameters

fullName string

full name of the type to find.

Returns

Type

The type is found, null otherwise.