Class UniqueAttributeExtensions
- Namespace
- Cratis.Chronicle.Events.Constraints
- Assembly
- Cratis.Chronicle.dll
Extension methods for working with UniqueAttribute.
public static class UniqueAttributeExtensions
- Inheritance
-
UniqueAttributeExtensions
- Inherited Members
Methods
GetConstraintEventSequences(MemberInfo)
Get the event sequences declared by the UniqueAttribute on a member.
public static IEnumerable<EventSequenceId> GetConstraintEventSequences(this MemberInfo member)
Parameters
memberMemberInfoMember to get for that has UniqueAttribute.
Returns
- IEnumerable<EventSequenceId>
The EventSequenceId values declared, empty for every event sequence.
GetConstraintMessage(MemberInfo)
Get the constraint message for a type adorned with UniqueAttribute, defaults to type name if not explicitly defined.
public static ConstraintViolationMessage GetConstraintMessage(this MemberInfo member)
Parameters
memberMemberInfoType to get for that has UniqueAttribute.
Returns
- ConstraintViolationMessage
Message for constraint, if defined, default if not.
GetConstraintMode(MemberInfo)
Get the retention mode declared on a unique property constraint.
public static UniqueConstraintMode GetConstraintMode(this MemberInfo member)
Parameters
memberMemberInfoMember to inspect.
Returns
- UniqueConstraintMode
The declared mode, defaulting to one value per event source.
GetConstraintName(MemberInfo)
Get the constraint name for a type adorned with UniqueAttribute, defaults to type name if not explicitly defined.
public static ConstraintName GetConstraintName(this MemberInfo member)
Parameters
memberMemberInfoType to get for that has UniqueAttribute.
Returns
- ConstraintName
Name of constraint.
GetRemoveConstraints(Type)
Get all RemoveConstraintAttribute instances applied to an event type.
public static IEnumerable<RemoveConstraintAttribute> GetRemoveConstraints(this Type type)
Parameters
typeTypeEvent type to inspect.
Returns
- IEnumerable<RemoveConstraintAttribute>
All RemoveConstraintAttribute instances on the type.