Esempio n. 1
0
 public static Version?GetMotorVersion <TData>(this MotorCloudEvent <TData> cloudEvent) where TData : class
 {
     return(CloudEventValidation.CheckNotNull(cloudEvent, nameof(cloudEvent))[MotorVersionAttribute]
            is not string versionString
         ? null
         : System.Version.Parse(versionString));
 }
 public static byte?GetRabbitMQPriority <TData>(this MotorCloudEvent <TData> cloudEvent) where TData : class
 {
     return(CloudEventValidation.CheckNotNull(cloudEvent, nameof(cloudEvent))[RabbitMQPriorityAttribute] switch
     {
         int and(< 0 or > 255) => null,
         int priority => (byte)priority,
         _ => null
     });
Esempio n. 3
0
 public static MotorCloudEvent <TData> SetMotorVersion <TData>(this MotorCloudEvent <TData> cloudEvent)
     where TData : class
 {
     CloudEventValidation.CheckNotNull(cloudEvent, nameof(cloudEvent));
     cloudEvent[MotorVersionAttribute] =
         CurrentVersion ?? throw new InvalidOperationException("Motor.NET version is undefined.");
     return(cloudEvent);
 }
 public static MotorCloudEvent <TData> SetRabbitMQBinding <TData>(this MotorCloudEvent <TData> cloudEvent,
                                                                  string?exchange, string?routingKey) where TData : class
 {
     CloudEventValidation.CheckNotNull(cloudEvent, nameof(cloudEvent));
     cloudEvent[RabbitMQExchangeAttribute]   = exchange;
     cloudEvent[RabbitMQRoutingKeyAttribute] = routingKey;
     return(cloudEvent);
 }
 public static MotorCloudEvent <TData> SetRabbitMQPriority <TData>(this MotorCloudEvent <TData> cloudEvent, byte?value) where TData : class
 {
     CloudEventValidation.CheckNotNull(cloudEvent, nameof(cloudEvent));
     cloudEvent[RabbitMQPriorityAttribute] = (int?)value;
     return(cloudEvent);
 }
 public static string?GetRabbitMQRoutingKey <TData>(this MotorCloudEvent <TData> cloudEvent) where TData : class
 {
     return(CloudEventValidation.CheckNotNull(cloudEvent, nameof(cloudEvent))[RabbitMQRoutingKeyAttribute] as
            string);
 }