Table of Contents

Class DynamoDbDefaultConverterAttribute

Namespace
DynaSharp.Mapping
Assembly
DynaSharp.dll

Selects the converter of a type for every mapped type of an assembly, where a DynamoDbConverterAttribute would have to go on every property: [assembly: DynamoDbDefaultConverter(typeof(DateTimeOffset), typeof(StoredTimestampConverter))]. It can be repeated, once per type.

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class DynamoDbDefaultConverterAttribute : Attribute
Inheritance
DynamoDbDefaultConverterAttribute
Inherited Members

Remarks

The first match wins: DynamoDbConverterAttribute on the property, on the type of the value, this attribute, the built-in converters. It covers the type, its nullable form and elements of lists, dictionaries and arrays, wherever the generator looks for the converter of a value. An element of a set needs a converter that also implements IDynamoDbSetElementConverter<T>, or the set is DYNA003.

In a key it does what a DynamoDbConverterAttribute on the property does. A plain key goes through it, and its type need not be one DynamoDB can hold, so DYNA017 does not apply. A template has formats of its own, so a placeholder ignores it, and the attribute of the property, if it is stored, goes through it. A VersionAttribute property keeps the built-in converter, because an update has to add to it.

A converter that does not fit is DYNA008. Two defaults for one type, and a type that is nullable or an open generic, are DYNA029. The converter implements IDynamoDbConverter<T> for the value type without nullability, as DynamoDbConverterAttribute says.

Constructors

DynamoDbDefaultConverterAttribute(Type, Type)

Initializes a new instance of the DynamoDbDefaultConverterAttribute class.

public DynamoDbDefaultConverterAttribute(Type valueType, Type converterType)

Parameters

valueType Type

The type the converter is for, without nullability.

converterType Type

The converter type, closed over its type arguments.

Properties

ConverterType

Gets the converter type.

public Type ConverterType { get; }

Property Value

Type

ValueType

Gets the type the converter is for.

public Type ValueType { get; }

Property Value

Type