コード例 #1
0
        /// <summary>
        ///     Translate a message into a series of other messages.
        /// </summary>
        public static IMessageHandlingStrategyConfiguration <TR, TProjection> Translate <TMessage, TProjection, TR>(
            this IMessageHandlingStrategyConfiguration <TMessage, TProjection> source,
            Func <TMessage, IEnumerable <TR> > translate
            ) where TProjection : class, new()
        {
            var container = new MessageHandlingStrategyFactoryContainer <TR, TProjection>();

            ((IContainMessageHandlingStrategyFactory <TMessage, TProjection>)source).SetFactory(() =>
            {
                IMessageHandlingStrategy <TR> strategy = container.Create();
                return(new TranslateStrategy <TMessage, TR>(translate, strategy));
            });
            return(container);
        }
コード例 #2
0
 private void EnsureStrategy()
 {
     EnsureStrategyFactory();
     _strategy = _strategy ?? _factoryContainer.Create();
 }