Interface IAggregateRoot<TKey>
Generic interface for aggregates with strongly-typed keys.
public interface IAggregateRoot<TKey> : IAggregateRoot where TKey : notnull
Type Parameters
TKeyThe type of the aggregate identifier.
- Inherited Members
Examples
public class OrderAggregate : AggregateRoot<Guid>
{
// Id property is of type Guid
}
Remarks
Use this interface when your aggregate requires a non-string key type (e.g., Guid, int). The base Id property returns the string representation of the key.
Properties
Id
Gets the strongly-typed unique identifier of the aggregate.
TKey Id { get; }
Property Value
- TKey
The unique identifier of the aggregate.