Amazon DynamoDB · Types · Amazon DynamoDB's own types

ArxDynamoModelBuilder

Definition

Namespace
ARX.SDK.DynamoDb.Model
Package
ARX.SDK.DynamoDb
C#
public sealed class ArxDynamoModelBuilder

Declares an ArxDynamoModel. Not thread-safe; build once, at startup.

Methods

  • ArxDynamoModelBuilder Table(string entity, string partitionKey, string? sortKey = null, ArxDynamoKeyType partitionKeyType = ArxDynamoKeyType.String, ArxDynamoKeyType sortKeyType = ArxDynamoKeyType.String, string? tableName = null)

    A table for one entity (multi-table design): the entity's own attributes are the keys. The table is named after the entity unless tableName says otherwise.

    Parameter Type Description
    entitystringThe entity's name.
    partitionKeystringThe attribute that is the table's partition key.
    sortKeystring?= nullThe attribute that is its sort key; null for none.
    partitionKeyTypeArxDynamoKeyType= ArxDynamoKeyType.StringThe partition key's DynamoDB type: String, Number or Binary.
    sortKeyTypeArxDynamoKeyType= ArxDynamoKeyType.StringThe sort key's DynamoDB type: String, Number or Binary.
    tableNamestring?= nullThe table's name in DynamoDB; the entity's name when null.
  • ArxDynamoModelBuilder Index(string entity, string indexName, string partitionKey, string? sortKey = null, ArxDynamoKeyType partitionKeyType = ArxDynamoKeyType.String, ArxDynamoKeyType sortKeyType = ArxDynamoKeyType.String)

    A global secondary index on a table-per-entity table, keyed by the entity's attributes.

    Parameter Type Description
    entitystringThe entity whose table has the index.
    indexNamestringThe index's name in DynamoDB.
    partitionKeystringThe attribute that is the index's partition key.
    sortKeystring?= nullThe attribute that is its sort key; null for none.
    partitionKeyTypeArxDynamoKeyType= ArxDynamoKeyType.StringThe partition key's DynamoDB type: String, Number or Binary.
    sortKeyTypeArxDynamoKeyType= ArxDynamoKeyType.StringThe sort key's DynamoDB type: String, Number or Binary.
  • ArxDynamoModelBuilder SingleTable(string tableName, string partitionKey, string sortKey, Action<ArxDynamoSingleTableBuilder> configure, string typeAttribute = "entity_type")

    A table that holds several entities (single-table design): its key attributes (often PK and SK), the attribute that names each item's entity, and the entities, indexes and entity index keys declared in configure.

    Parameter Type Description
    tableNamestringThe table's name in DynamoDB.
    partitionKeystringThe table's partition key attribute (often PK).
    sortKeystringThe table's sort key attribute (often SK).
    configureAction<ArxDynamoSingleTableBuilder>Declares the table's entities, indexes and entity index keys.
    typeAttributestring= "entity_type"The attribute that names each item's entity.
  • ArxDynamoModelBuilder WriteSharding(string entity, int shards, string by)

    Write sharding for a single-table entity: its partition key gets a #SHARD#n suffix, n from a stable hash of by, so writes spread over shards partitions. A read of one item still goes to one key; a read of the whole partition asks every shard and merges by the sort key.

    Parameter Type Description
    entitystringThe single-table entity whose writes are spread.
    shardsintHow many partitions to spread over.
    bystringThe attribute whose value picks the shard.
  • ArxDynamoModel Build()

    The model, checked and read-only from now on.