Class MetadataExtensions
- Namespace
- Savvyio
- Assembly
- Savvyio.Core.dll
Extension methods for the IMetadata interface.
public static class MetadataExtensions
- Inheritance
-
objectMetadataExtensions
Methods
GetCausationId<T>(T)
Gets the string representation of the causation identifier from the request.
public static string GetCausationId<T>(this T request) where T : IMetadata
Parameters
requestTThe IMetadata to extend.
Returns
- string
The string representation of the causation identifier from the
request.
Type Parameters
TThe model that implements the IMetadata interface.
GetCorrelationId<T>(T)
Gets the string representation of the correlation identifier from the request.
public static string GetCorrelationId<T>(this T request) where T : IMetadata
Parameters
requestTThe IMetadata to extend.
Returns
- string
The string representation of the correlation identifier from the
request.
Type Parameters
TThe model that implements the IMetadata interface.
GetMemberType<T>(T)
Gets the string representation of the underlying member type of request.
public static string GetMemberType<T>(this T request) where T : IMetadata
Parameters
requestTThe IMetadata to extend.
Returns
- string
The string representation of the member type from the
request.
Type Parameters
TThe model that implements the IMetadata interface.
Remarks
The underlying Type of a model expressed as a string representation (fully qualified name of the type, including its namespace, comma delimited with the simple name of the assembly).
GetRequestId<T>(T)
Gets the string representation of the request identifier from the request.
public static string GetRequestId<T>(this T request) where T : IMetadata
Parameters
requestTThe IMetadata to extend.
Returns
- string
The string representation of the request identifier from the
request.
Type Parameters
TThe model that implements the IMetadata interface.
MergeMetadata<TSource, TDestination>(TDestination, TSource)
Copies model from the source to the destination if not already existing.
public static TDestination MergeMetadata<TSource, TDestination>(this TDestination destination, TSource source) where TSource : IMetadata where TDestination : IMetadata
Parameters
destinationTDestinationThe IMetadata to extend. Receives model from
source.sourceTSourceThe model that will give metadata to
destination.
Returns
- TDestination
A reference to
destinationafter the operation has completed.
Type Parameters
TSourceThe giving type of the model that implements the IMetadata interface.
TDestinationThe receiving type of the model that implements the IMetadata interface.
SaveMetadata<T>(T, string, object)
Add or update a set of model to the request.
public static T SaveMetadata<T>(this T request, string key, object value) where T : IMetadata
Parameters
requestTThe IMetadata to extend.
keystringThe key of the element to add or update.
valueobjectThe value of the element to add or update.
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
Exceptions
- ArgumentNullException
requestcannot be null -or-keycannot be null.
SetCausationId<T>(T, string)
Assigns a new causationId to the request.
public static T SetCausationId<T>(this T request, string causationId) where T : IMetadata
Parameters
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
SetCorrelationId<T>(T, string)
Assigns a new correlationId to the request.
public static T SetCorrelationId<T>(this T request, string correlationId) where T : IMetadata
Parameters
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
SetEventId<T>(T, string)
Assigns a new eventId to the request.
public static T SetEventId<T>(this T request, string eventId) where T : IMetadata
Parameters
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
SetMemberType<T>(T, Type)
Assigns a new type to the request.
public static T SetMemberType<T>(this T request, Type type) where T : IMetadata
Parameters
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
Remarks
The type is converted to its equivalent string representation (fully qualified name of the type, including its namespace, comma delimited with the simple name of the assembly).
SetRequestId<T>(T, string)
Assigns a new requestId to the request.
public static T SetRequestId<T>(this T request, string requestId) where T : IMetadata
Parameters
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
SetTimestamp<T>(T, DateTime?)
Assigns a new timestamp (UtcNow value) to the request.
public static T SetTimestamp<T>(this T request, DateTime? utcTimestamp = null) where T : IMetadata
Parameters
requestTThe IMetadata to extend.
utcTimestampDateTime?The optional DateTime value expressed as the Coordinated Universal Time (UTC).
Returns
- T
A reference to
requestafter the operation has completed.
Type Parameters
TThe model that implements the IMetadata interface.
Exceptions
- ArgumentException
utcTimestamp(when set) was not expressed as the Coordinated Universal Time (UTC).