Exemplo n.º 1
0
        void Validate()
        {
            if (string.IsNullOrWhiteSpace(PropertyName))
            {
                throw new ArgumentException($"Reflected saga data correlation property name from {SagaDataType} is empty! This is most likely because the expression passed to the correlation configuration could not be properly reflected - it's the part indicated by !!! here: config.Correlate<TMessage>(m => m.SomeField, d => !!!) - please be sure that you are pointing to a simple property of the saga data");
            }

            var sagaDataProperty = SagaDataType.GetProperty(PropertyName);

            if (sagaDataProperty == null)
            {
                throw new ArgumentException($"Could not find correlation property '{PropertyName}' on saga data of type {SagaDataType}!");
            }

            var propertyType = sagaDataProperty.PropertyType;

            if (AllowedCorrelationPropertyTypes.Contains(propertyType))
            {
                return;
            }

            var allowedTypes = string.Join(", ", AllowedCorrelationPropertyTypes.Select(t => t.Name));

            throw new ArgumentException($"Cannot correlate with the '{PropertyName}' property on the '{SagaDataType.Name}' saga data type - only allowed types are: {allowedTypes}");
        }
Exemplo n.º 2
0
    void Validate()
    {
        var propertyType = SagaDataType.GetProperty(PropertyName).PropertyType;

        if (AllowedCorrelationPropertyTypes.Contains(propertyType))
        {
            return;
        }

        throw new ArgumentException($"Cannot correlate with the '{PropertyName}' property on the '{SagaDataType.Name}' saga data type - only allowed types are: {string.Join(", ", AllowedCorrelationPropertyTypes.Select(t => t.Name))}");
    }