devlooped / TableStorage

Repository pattern with POCO object support for storing to Azure / Cosmos DB Table Storage

Home Page:https://clarius.org/TableStorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow annotating record constructor parameters with PartitionKey/RowKey

kzu opened this issue · comments

When using C# 9 records for storage (super convenient!), you typically don't declare the properties explicitly, but leverage the concise syntax instead:

public record Book(string ISBN, string Author, string Title);

Since you don't have a property to place the PartitionKey and RowKey attributes, you need to instead provide them via lambdas on every creation of a table partition or repository.

It would be nice if we could allow the attributes in the record constructor arguments themselves:

public record Book([RowKey] string ISBN, [PartitionKey] string Author, string Title);