public Task <TProperty> GetProperty <T>(InitializeContext <T, TInput> context) where T : class { return(context.HasInput && _converter.TryConvert(_inputProperty.Get(context.Input), out var result) ? Task.FromResult(result) : TaskUtil.Default <TProperty>()); }
public Task Apply(InitializeContext <TMessage, TInput> context, SendContext sendContext) { var inputPropertyValue = _inputProperty.Get(context.Input); _headerProperty.Set(sendContext, inputPropertyValue); return(TaskUtil.Completed); }
public Task Apply(InitializeContext <TMessage, TInput> context) { if (context.HasInput) { _messageProperty.Set(context.Message, _inputProperty.Get(context.Input)); } return(TaskUtil.Completed); }
void ISetCorrelationId <T> .SetCorrelationId(SendContext <T> context) { var correlationId = _property.Get(context.Message); if (correlationId != Guid.Empty) { context.CorrelationId = correlationId; } }
public bool TryGetScopeId(TMessage input, out TId id) { if (input != null) { id = _property.Get(input); return(true); } id = default; return(false); }
public async Task Apply(InitializeContext <TMessage, TInput> context) { if (context.HasInput) { var inputProperty = _inputProperty.Get(context.Input); var messageProperty = await _converter.Convert(context, inputProperty).ConfigureAwait(false); _messageProperty.Set(context.Message, messageProperty); } }
public void SetCorrelationId(SendContext <T> context) { var message = (CorrelatedBy <Guid>)context.Message; var correlationId = _property.Get(message); if (correlationId != Guid.Empty) { context.CorrelationId = correlationId; } }
public Task <TProperty> GetProperty <T>(InitializeContext <T, TInput> context) where T : class { if (context.HasInput) { var propertyValue = _inputProperty.Get(context.Input); return(_converter.Convert(context, propertyValue)); } return(Task.FromResult <TProperty>(default));
public bool TryGetCorrelationId(T message, out Guid correlationId) { Guid?id = _property.Get(message); if (id.HasValue && id.Value != Guid.Empty) { correlationId = id.Value; return(true); } return(false); }
public Task Apply(InitializeMessageContext <TMessage, TInput> context) { var inputProperty = _inputProperty.Get(context.Input); if (_converter.TryConvert(inputProperty, out var messageProperty)) { _messageProperty.Set(context.Message, messageProperty); return(TaskUtil.Completed); } throw new MassTransitException($"The input property {_inputProperty.Name} could not be converted to the message property {_messageProperty.Name}."); }
public MessageData <TValue> GetProperty(TransformContext <TInput> context) { if (context.HasInput) { MessageData <TValue> value = _property.Get(context.Input); if (value?.Address != null) { return(MessageDataFactory.Load <TValue>(_repository, value.Address, context)); } } return(new EmptyMessageData <TValue>()); }
public void FromEntity(TEntity entity, IDictionary <string, EntityProperty> entityProperties) { var propertyValue = _read.Get(entity); if (_fromEntity != null) { if (_fromEntity.TryConvert(propertyValue, out var entityProperty)) { entityProperties.Add(_name, entityProperty); } } else { var text = JsonConvert.SerializeObject(propertyValue, Formatting.None); entityProperties.Add(_name, new EntityProperty(text)); } }
public Task <TProperty> GetProperty <T>(InitializeContext <T, TInput> context) where T : class { return(Task.FromResult(context.HasInput ? _inputProperty.Get(context.Input) : default));
public bool TryGetCorrelationId(T message, out Guid correlationId) { correlationId = _property.Get(message); return(correlationId != Guid.Empty); }
public async Task <TProperty> GetProperty <T>(InitializeContext <T, TInput> context) where T : class { return(context.HasInput && _converter.TryConvert(await _inputProperty.Get(context.Input).ConfigureAwait(false), out var result) ? result : default);
public async Task <TProperty> GetProperty <T>(InitializeContext <T, TInput> context) where T : class { return(context.HasInput ? await _inputProperty.Get(context.Input).ConfigureAwait(false) : default);