Skip to main content
Version: Preview (0.3.0-preview.205)

Class AnyEntityIdTypeConverter

Namespace: AdCodicem.ValueObjects.Identifiers
Assembly: AdCodicem.ValueObjects.Identifiers.dll

Converts an to and from text for the boundaries that go through : MVC model binding, configuration binding, and the designers.

public sealed class AnyEntityIdTypeConverter : TypeConverter

Inheritance​

object ← TypeConverter ← AnyEntityIdTypeConverter

Inherited Members​

TypeConverter.CanConvertFrom(ITypeDescriptorContext?, Type), TypeConverter.CanConvertFrom(Type), TypeConverter.CanConvertTo(ITypeDescriptorContext?, Type?), TypeConverter.CanConvertTo(Type?), TypeConverter.ConvertFrom(ITypeDescriptorContext?, CultureInfo?, object), TypeConverter.ConvertFrom(object), TypeConverter.ConvertFromInvariantString(ITypeDescriptorContext?, string), TypeConverter.ConvertFromInvariantString(string), TypeConverter.ConvertFromString(ITypeDescriptorContext?, CultureInfo?, string), TypeConverter.ConvertFromString(ITypeDescriptorContext?, string), TypeConverter.ConvertFromString(string), TypeConverter.ConvertTo(ITypeDescriptorContext?, CultureInfo?, object?, Type), TypeConverter.ConvertTo(object?, Type), TypeConverter.ConvertToInvariantString(ITypeDescriptorContext?, object?), TypeConverter.ConvertToInvariantString(object?), TypeConverter.ConvertToString(ITypeDescriptorContext?, CultureInfo?, object?), TypeConverter.ConvertToString(ITypeDescriptorContext?, object?), TypeConverter.ConvertToString(object?), TypeConverter.CreateInstance(IDictionary), TypeConverter.CreateInstance(ITypeDescriptorContext?, IDictionary), TypeConverter.GetCreateInstanceSupported(), TypeConverter.GetCreateInstanceSupported(ITypeDescriptorContext?), TypeConverter.GetProperties(ITypeDescriptorContext?, object), TypeConverter.GetProperties(ITypeDescriptorContext?, object, Attribute[]?), TypeConverter.GetProperties(object), TypeConverter.GetPropertiesSupported(), TypeConverter.GetPropertiesSupported(ITypeDescriptorContext?), TypeConverter.GetStandardValues(), TypeConverter.GetStandardValues(ITypeDescriptorContext?), TypeConverter.GetStandardValuesExclusive(), TypeConverter.GetStandardValuesExclusive(ITypeDescriptorContext?), TypeConverter.GetStandardValuesSupported(), TypeConverter.GetStandardValuesSupported(ITypeDescriptorContext?), TypeConverter.IsValid(ITypeDescriptorContext?, object?), TypeConverter.IsValid(object), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

Minimal APIs need none of this — implements , which is exactly what their parameter binding looks for.

Methods​

CanConvertFrom(ITypeDescriptorContext?, Type)​

Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.

public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)

Parameters​

context ITypeDescriptorContext?

An that provides a format context.

sourceType Type

A that represents the type you want to convert from.

Returns​

bool

true if this converter can perform the conversion; otherwise, false.

CanConvertTo(ITypeDescriptorContext?, Type?)​

Returns whether this converter can convert the object to the specified type, using the specified context.

public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)

Parameters​

context ITypeDescriptorContext?

An that provides a format context.

destinationType Type?

A that represents the type you want to convert to.

Returns​

bool

true if this converter can perform the conversion; otherwise, false.

ConvertFrom(ITypeDescriptorContext?, CultureInfo?, object)​

Converts the given object to the type of this converter, using the specified context and culture information.

public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)

Parameters​

context ITypeDescriptorContext?

An that provides a format context.

culture CultureInfo?

The to use as the current culture.

value object

The to convert.

Returns​

object?

An that represents the converted value.

Remarks​

Anything but text, null included, goes to the base class, which throws , as the converter of a generated identifier does.

Exceptions​

NotSupportedException

The conversion cannot be performed.

ConvertTo(ITypeDescriptorContext?, CultureInfo?, object?, Type)​

Converts the given value object to the specified type, using the specified context and culture information.

public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)

Parameters​

context ITypeDescriptorContext?

An that provides a format context.

culture CultureInfo?

A . If null is passed, the current culture is assumed.

value object?

The to convert.

destinationType Type

The to convert the value parameter to.

Returns​

object?

An that represents the converted value.

Exceptions​

ArgumentNullException

The destinationType parameter is null.

NotSupportedException

The conversion cannot be performed.