For reading an item by the primary index key, we can simply use the IDynamoDbContext.LoadAsync<TItem>(key, ...)
method. Reading by the secondary key is much less ergonomic. Looking at the options, it seems this functionality is not exposed through high-level APIs and we have to defer to the low-level APIs, which require additional information, like index name.
Is there an idiomatic way to read an item by its secondary index in C#? If not, how would we implement a LoadBySecondaryKeyAsync<TItem>(string secondaryKey, ...)
method that would abstract away low-level concepts like index name? Are deterministic defaults provided for fields like index name, or must these be created/managed by the application? It seems like they must be managed by the application, but then why is indexName not a mandatory parameter to DynamoDBGlobalSecondaryIndexHashKey
attribute and why does it even accept multiple values?