Azure Table Storage¶
The Azure Table Storage module generates complete persistence abstractions from [TableEntity] and [TableStore] attributes — typed entity mappers, store interfaces, store implementations backed by TableServiceClient, effect methods, capability interfaces, and DI registration.
Quick Start¶
Define a table entity:
using Deepstaging.Cloud.Azure.Storage;
[TableEntity("Conversations")]
public partial record Conversation
{
[PartitionKey] public required string ThreadTs { get; init; }
[RowKey] public required string PhoneNumber { get; init; }
public required string DisplayName { get; init; }
public required int MessageCount { get; init; }
public required DateTimeOffset CreatedAt { get; init; }
}
This generates:
ToTableEntity()/FromTableEntity()— mapper methods on the entityIConversationStore— async CRUD interface (UpsertAsync,GetAsync,DeleteAsync,QueryByPartitionAsync)ConversationStore— implementation backed byTableServiceClientAddConversationStore— DI registration extension method
Define a table store for effects composition:
This generates:
IHasChatStore— capability interface for runtime accessChatStoreService— aggregated service with methods for all entitiesChatStore.GetConversation<RT>()—Eff<RT, T>effect methodsAddChatStore— DI registration for the service
Compose with effect pipelines:
var program =
from conv in ChatStore.GetConversation<AppRuntime>(threadTs, phoneNumber)
from _ in guard(conv.IsSome, Error.New("Conversation not found"))
>> ChatStore.UpsertConversation<AppRuntime>(conv.Value! with { DisplayName = "Updated" })
select unit;
What's Next¶
| Page | Description |
|---|---|
| Attribute Reference | [TableEntity], [TableStore], [PartitionKey], [RowKey] — targets, properties, defaults, and constraints |
| Generated Code | Entity mappers, store interfaces, store implementations, DI registration — plain .NET with async/await |
| Effects Composition | Capability interfaces, Eff<RT, T> methods, runtime composition, and constant partition key handling |
Diagnostics¶
| ID | Severity | Description |
|---|---|---|
| DSAT01 | Error | [TableEntity] class must be partial |
| DSAT02 | Error | [TableEntity] must have a [PartitionKey] property |
| DSAT03 | Error | [TableEntity] must have a [RowKey] property |
| DSAT04 | Info | Property will be stored as JSON (non-native type) |
| DSAT10 | Error | [TableStore] class must be partial |
| DSAT11 | Warning | [TableStore] class should be static |