Class ProjectionVersionConvention
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Applies a projection's declared generation to the destination name its provider resolved.
public static class ProjectionVersionConvention
- Inheritance
-
ProjectionVersionConvention
- Inherited Members
Remarks
Every provider that addresses a per-projection destination composes its name through this one function, so the rule for where a generation appears -- and, more importantly, the rule for when it does not appear at all -- exists in a single place. A provider that re-derived it would be free to disagree, and the disagreement would show up as a read model that folded from zero on an upgrade nobody meant to be a cutover.
Providers call this at the point where they have already resolved the destination name they would have used otherwise -- after any configured name override and any prefix -- and pass the separator their own identifiers permit.
Methods
Qualify(string, Type, char)
Applies projectionType's declared generation to a resolved destination name.
public static string Qualify(string destinationName, Type projectionType, char separator)
Parameters
destinationNamestringThe destination name the provider resolved without regard to the generation -- the index, container, collection or table it would address for generation 1.
projectionTypeTypeThe read-model type whose declared generation is read.
separatorcharThe character joining the generation segment to the name. Pass the one the provider's own identifiers allow: a hyphen for a search index, an underscore for a SQL identifier.
Returns
- string
destinationNameunchanged for generation 1 or for a type declaring no generation; otherwise that name followed by the separator and the generation, such asorders-v2.
Exceptions
- ArgumentException
Thrown when
destinationNameis blank.- ArgumentNullException
Thrown when
projectionTypeis null.