Esempio n. 1
0
        public static IInvokerConfigElement <object> Invokes <TTarget>(this IInvokerConfigElement <object> invokerConfiguration, string name = null)
            where TTarget : class
        {
            var child = new InvokerElement <TTarget>(name ?? typeof(TTarget).Name, parent: invokerConfiguration);

            if (invokerConfiguration.Children == null)
            {
                invokerConfiguration.Children = new IInvokerConfigElement <object>[] { };
            }

            invokerConfiguration.Children = invokerConfiguration.Children.Append(child).ToArray();
            return(child);
        }
Esempio n. 2
0
        public static IInvokerConfigElement <object> InvokesMultiple(this IInvokerConfigElement <object> invokerConfiguration, params IInvokerConfigElement <object>[] children)
        {
            var parentList = children.Select(leaf =>
            {
                var parent = leaf.Clone() as IInvokerConfigElement <object>;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                return(parent);
            }).ToList();

            invokerConfiguration.Children            = parentList.ToArray();
            parentList.ForEach(child => child.Parent = invokerConfiguration);
            return(invokerConfiguration);
        }
Esempio n. 3
0
 public InvokerElement(string name = null, IInvokerConfigElement <object> parent = null, params IInvokerConfigElement <object>[] children) : this(name)
 {
     this.Parent   = parent;
     this.Children = children;
 }
Esempio n. 4
0
 public static IContainer RegisterInvoker <TRequest, TResponse>(this IContainer container, IInvokerConfigElement <object> invokerConfiguration)
 {
     return(RegisterInvoker <TRequest, TResponse>(container, null, invokerConfiguration));
 }
Esempio n. 5
0
        public static IContainer RegisterInvoker <TRequest>(this IContainer container, string name, IInvokerConfigElement <object> invokerConfiguration)
        {
            var stack = RegisterDependencies(container, name, invokerConfiguration);

            return(RegisterInvoker <TRequest>(container, name, stack));
        }