Example #1
0
 public AutofacMessageDispatchScope(TransactionScope tx, ILifetimeScope envelopeScope, Func <Type, Type, MethodInfo> hint, IMethodContextManager context)
 {
     _tx            = tx;
     _envelopeScope = envelopeScope;
     _hint          = hint;
     _context       = context;
 }
Example #2
0
 public AutofacDispatchStrategy(ILifetimeScope scope, Func <TransactionScope> scopeFactory, Func <Type, Type, MethodInfo> hint, IMethodContextManager context)
 {
     _scope        = scope;
     _scopeFactory = scopeFactory;
     _hint         = hint;
     _context      = context;
 }
 public AutofacMessageDispatchScope(TransactionScope tx, ILifetimeScope envelopeScope, Func<Type, Type, MethodInfo> hint, IMethodContextManager context)
 {
     _tx = tx;
     _envelopeScope = envelopeScope;
     _hint = hint;
     _context = context;
 }
 public AutofacDispatchStrategy(ILifetimeScope scope, Func<TransactionScope> scopeFactory, Func<Type, Type, MethodInfo> hint, IMethodContextManager context)
 {
     _scope = scope;
     _scopeFactory = scopeFactory;
     _hint = hint;
     _context = context;
 }
        /// <summary>
        /// Allows to specify custom context factory to expose transport-level
        /// information to message handlers via IoC. By default this is configured
        /// as <see cref="Func{T}"/> returning <see cref="MessageContext"/>
        /// </summary>
        /// <typeparam name="TContext">The type of the context to return.</typeparam>
        /// <param name="contextFactory">The context factory.</param>
        public void ContextFactory <TContext>(Func <ImmutableEnvelope, ImmutableMessage, TContext> contextFactory)
            where TContext : class
        {
            if (contextFactory == null)
            {
                throw new ArgumentNullException("contextFactory");
            }
            var instance = new MethodContextManager <TContext>(contextFactory);

            _contextManager = instance;
        }