Skip to main content

DYNDB104: Incompatible attribute combination

FieldValue
CodeDYNDB104
SeverityError

Message

Property '{0}' has incompatible attribute combination: {1}

Description

Certain attribute combinations are not supported together. Some attributes have conflicting semantics or implementation requirements that prevent them from being used on the same property.

Example

The following code triggers this diagnostic:

[DynamoDbTable("Products")]
public partial class Product
{
[PartitionKey]
[DynamoDbAttribute("pk")]
public string Pk { get; set; } = string.Empty;

[JsonBlob]
[BlobStorage]
[DynamoDbAttribute("data")]
public BlobData<string> Data { get; set; } = default!;
}

Fix

The corrected version:

[DynamoDbTable("Products")]
public partial class Product
{
[PartitionKey]
[DynamoDbAttribute("pk")]
public string Pk { get; set; } = string.Empty;

[BlobStorage]
[DynamoDbAttribute("data")]
public BlobData<string> Data { get; set; } = default!;
}