Class ReadModelSubjectResolver
- Namespace
- Cratis.Chronicle.ReadModels
- Assembly
- Cratis.Chronicle.dll
Resolves a Subject from a read model instance by checking for a property or constructor
parameter decorated with SubjectAttribute that has a value, falling back to a property named Id.
public static class ReadModelSubjectResolver
- Inheritance
-
ReadModelSubjectResolver
- Inherited Members
Methods
ResolveFrom(object?)
Attempt to derive a Subject from a read model instance.
Resolution order:
- A property decorated with SubjectAttribute that has a value.
- A constructor parameter decorated with SubjectAttribute that has a value (record shorthand).
- Property named
Id(case-insensitive).
An attributed property that is null, empty, or NotSet does not stop resolution;
the Id fallback is attempted next.
public static Subject? ResolveFrom(object? instance)
Parameters
instanceobjectThe read model instance to inspect, or null for a read model that does not exist (never created or removed).