Class SubjectAttribute
- Namespace
- Cratis.Chronicle
- Assembly
- Cratis.Chronicle.dll
Marks a property or record parameter as the Subject used for compliance operations.
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class SubjectAttribute : Attribute
- Inheritance
-
SubjectAttribute
- Inherited Members
- Extension Methods
Remarks
On an event type, Chronicle derives the append subject from this value when the caller does not supply an explicit Subject. On a read model, Release<TReadModel>(TReadModel) uses this value to select the encryption key for an instance that needs manual release.
[EventType]
public record ShippingAddressChanged(
OrderId Order,
[Subject] CustomerId Customer,
[PII] string City);
Appending without an explicit subject automatically uses the Customer property as the
subject, so PII fields are encrypted under the customer's key rather than the order's key.
A read model's attribute does not override the ownership metadata maintained by Chronicle's projection
pipeline; managed projection reads use the provenance of each projected value.
Constructors
SubjectAttribute()
public SubjectAttribute()