Skip to main content

DYNDB010: Entity must be partial

FieldValue
CodeDYNDB010
SeverityError

Message

Entity class '{0}' must be declared as 'partial' to support source generation

Description

DynamoDB entity classes must be declared as partial to allow the source generator to add implementation code. The generator creates mapping methods, key builders, and interface implementations in a separate partial class file.

Example

The following code triggers this diagnostic:

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

[DynamoDbAttribute("status")]
public string Status { get; set; } = string.Empty;
}

Fix

The corrected version:

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

[DynamoDbAttribute("status")]
public string Status { get; set; } = string.Empty;
}