Attribute Reference¶
All Azure Table Storage attributes live in the Deepstaging.Cloud.Azure.Storage namespace. See also the Generated Code and Effects Composition pages for what these attributes produce.
[TableEntity]¶
Marks a partial record or partial class as an Azure Table Storage entity. The generator produces ToTableEntity() / FromTableEntity() mapper methods, a typed store interface and implementation, and DI registration.
[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; }
}
| Parameter | Type | Description |
|---|---|---|
tableName |
string |
(constructor, required) The Azure Table Storage table name |
| Requirement | Diagnostic |
|---|---|
Must be partial |
DSAT01 (Error) |
Must have a [PartitionKey] property |
DSAT02 (Error) |
Must have a [RowKey] property |
DSAT03 (Error) |
[TableStore]¶
Marks a static partial class as an assembly-level table store aggregator. The generator discovers all [TableEntity] types in the assembly and produces an aggregated service, capability interface, Eff<RT, T> effect methods, and DI registration.
No constructor parameters or properties — pure marker attribute.
| Requirement | Diagnostic |
|---|---|
Must be partial |
DSAT10 (Error) |
Should be static |
DSAT11 (Warning) |
One [TableStore] per assembly
The [TableStore] class acts as the root container for all [TableEntity] types in the assembly. All generated Eff methods are static members on this class.
[PartitionKey]¶
Marks a property as the partition key for a [TableEntity]. Every table entity must have exactly one [PartitionKey] property.
| Property | Type | Default | Description |
|---|---|---|---|
Constant |
string? |
null |
When set, the partition key is always this literal value regardless of the property. The property is excluded from the entity mapping roundtrip. |
| Requirement | Diagnostic |
|---|---|
Required on every [TableEntity] |
DSAT02 (Error) |
Constant partition key pattern¶
Use Constant when all entities share the same partition key:
[TableEntity("PhoneMappings")]
public partial record PhoneMapping
{
[PartitionKey(Constant = "PhoneMappings")] public required string PhoneNumber { get; init; }
[RowKey] public required string ThreadTs { get; init; }
public required DateTime CreatedUtc { get; init; }
}
With a constant partition key:
ToTableEntity()uses the literal"PhoneMappings"instead of reading the property valueFromTableEntity()does not assign the partition key property from the entity- Generated Eff methods omit the
partitionKeyparameter — the constant is baked in:
// Without constant — requires both keys
ChatStore.GetConversation<RT>(partitionKey, rowKey)
// With constant — partition key is automatic
ChatStore.GetPhoneMapping<RT>(rowKey)
[RowKey]¶
Marks a property as the row key for a [TableEntity]. Every table entity must have exactly one [RowKey] property.
| Property | Type | Default | Description |
|---|---|---|---|
Format |
string? |
null |
The row key format strategy |
| Requirement | Diagnostic |
|---|---|
Required on every [TableEntity] |
DSAT03 (Error) |
Rules and Constraints¶
- Every
[TableEntity]must bepartialso the generator can extend it with mapper methods. - Every
[TableEntity]needs exactly one[PartitionKey]and one[RowKey]property. - The
[TableStore]class must bepartial(error if not) and should bestatic(warning if not). - Properties with non-native types trigger an informational diagnostic (DSAT04) indicating they will be JSON-serialized.