コード例 #1
0
            public RelevantSagaInfo(ISagaData sagaData, IEnumerable <CorrelationProperty> correlationProperties, Saga saga)
            {
                SagaData = sagaData;

                // only keep necessary correlation properties, i.e.
                CorrelationProperties = correlationProperties
                                        .GroupBy(p => p.PropertyName)
                                        .Select(g => g.First())
                                        .ToList();

                Saga = saga;
            }
コード例 #2
0
 static Dictionary <Type, CorrelationProperty[]> GetCorrelationProperties(Saga saga)
 {
     return(saga.GenerateCorrelationProperties()
            .ToLookup(p => p.MessageType)
            .ToDictionary(kvp => kvp.Key, kvp => kvp.ToArray()));
 }
コード例 #3
0
 /// <summary>
 /// Creates a new instance of the saga's saga data
 /// </summary>
 public ISagaData CreateNewSagaData(Saga saga)
 {
     return(saga.CreateNewSagaData());
 }
コード例 #4
0
        /// <summary>
        /// Gets (most likely from a cache) the set of correlation properties relevant for the given saga handler.
        /// </summary>
        public SagaDataCorrelationProperties GetCorrelationProperties(object message, Saga saga)
        {
            var sagaType     = saga.GetType();
            var sagaDataType = saga.GetSagaDataType();
            var key          = $"{sagaType.FullName}/{sagaDataType.FullName}";

            var correlationPropertiesForThisSagaDataType = _cachedCorrelationProperties
                                                           .GetOrAdd(key, _ => GetCorrelationProperties(saga));

            return(new SagaDataCorrelationProperties(correlationPropertiesForThisSagaDataType, sagaDataType));
        }
コード例 #5
0
ファイル: SagaHelper.cs プロジェクト: zlepper/Rebus
 /// <summary>
 /// Creates a new instance of the saga's saga data
 /// </summary>
 public ISagaData CreateNewSagaData(Saga saga) => saga.CreateNewSagaData();
コード例 #6
0
        /// <summary>
        /// Gets (most likely from a cache) the set of correlation properties relevant for the given saga handler.
        /// </summary>
        public SagaDataCorrelationProperties GetCorrelationProperties(object message, Saga saga)
        {
            var sagaDataType = saga.GetSagaDataType();

            var correlationPropertiesForThisSagaDataType = _cachedCorrelationProperties
                                                           .GetOrAdd(sagaDataType, type => GetCorrelationProperties(saga));

            return(new SagaDataCorrelationProperties(correlationPropertiesForThisSagaDataType, sagaDataType));
        }