Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">Autofac context</param>
        public EventAggregator(IComponentContext context)
            : base()
        {
            context.NotNull(nameof(context));

            _context = context;
        }
        /// <summary>
        /// Retrieves a list of services of type TService from the context
        /// </summary>
        /// <typeparam name="TService">Type of service</typeparam>
        /// <param name="context">The context from which to resolve the list of services</param>
        /// <returns>The list of component instances that provide the service</returns>
        public static IEnumerable <TService> ResolveAll <TService>(
            this IComponentContext context)
            where TService : class
        {
            context.NotNull(nameof(context));

            return(context.Resolve <IEnumerable <TService> >());
        }
        /// <summary>
        /// Sets config JobActivator to use AutofacJobActivator instance
        /// </summary>
        /// <param name="config">The job host configuration</param>
        /// <param name="context">The Autofac context</param>
        public static void UseAutofacActivator(
            this JobHostConfiguration config, IComponentContext context)
        {
            config.NotNull(nameof(config));
            context.NotNull(nameof(context));

            config.JobActivator = new AutofacJobActivator(context);
        }
        /// <summary>
        /// Retrieves a list of services of a given type from the context
        /// </summary>
        /// <param name="context">The context from which to resolve the list of services</param>
        /// <param name="type">Type of service</param>
        /// <returns>The list of component instances that provide the service</returns>
        public static IEnumerable ResolveAll(
            this IComponentContext context,
            Type type)
        {
            context.NotNull("container");
            type.NotNull("type");

            return((IEnumerable)context.Resolve(typeof(IEnumerable <>).MakeGenericType(type)));
        }
Example #5
0
        /// <summary>
        /// Retrieves a list of services of a given type from the context
        /// </summary>
        /// <param name="context">The context from which to resolve the list of services</param>
        /// <param name="type">Type of service</param>
        /// <returns>The list of component instances that provide the service</returns>
        public static IEnumerable ResolveAll(
            this IComponentContext context,
            Type type)
        {
            context.NotNull(nameof(context));
            type.NotNull(nameof(type));

            return((IEnumerable)context.ResolveOptional(typeof(IEnumerable <>).MakeGenericType(type)));
        }
Example #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="executionContext">The current execution context</param>
        /// <param name="context">The Autofac context</param>
        public ExecutionContextInitialiser(
            IExecutionContext executionContext,
            IComponentContext context)
            : base(executionContext)
        {
            context.NotNull(nameof(context));

            _context = context;
        }
Example #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The Autofac context</param>
        public HandlerFactory(IComponentContext context)
        {
            context.NotNull(nameof(context));

            _context = context;
        }
Example #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The Autofac context</param>
        public ValidatorFactory(IComponentContext context)
        {
            context.NotNull(nameof(context));

            _context = context;
        }
Example #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The Autofac context</param>
        public EventPublisher(IComponentContext context)
        {
            context.NotNull(nameof(context));

            _context = context;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The Autofac context</param>
        public AutofacJobActivator(IComponentContext context)
        {
            context.NotNull(nameof(context));

            _context = context;
        }
Example #11
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">The Autofac context</param>
        public ValidatorFactory(IComponentContext context)
        {
            context.NotNull(nameof(context));

            _context = context;
        }