public IReadOnlyCollection <IConsoleCommand> FindCommands()
        {
            var commands = _resolutionRoot.GetAll <IConsoleCommand>().ToList();

            commands.AddRange(_resolutionRoot.GetAll <IConsoleModeCommand>().Select(c => (IConsoleCommand)c));

            return(commands);
        }
Example #2
0
 public IEnumerable <object> GetServices(Type serviceType)
 {
     if (_resolver == null)
     {
         throw new ObjectDisposedException("this", "This scope has been disposed");
     }
     return(_resolver.GetAll(serviceType, new IParameter[0]));
 }
 public System.Collections.Generic.IEnumerable <object> GetServices(Type serviceType)
 {
     if (resolver == null)
     {
         throw new ObjectDisposedException("this", "This scope has been disposed");
     }
     return(resolver.GetAll(serviceType));
 }
 public IEnumerable <object> GetServices(Type serviceType)
 {
     if (resolver == null)
     {
         throw new ObjectDisposedException("this", "This scope has already been disposed");
     }
     return(resolver.GetAll(serviceType));
 }
 public IEnumerable<object> GetServices(Type serviceType)
 {
     if (resolver == null)
     {
         throw new ObjectDisposedException("this", "scope is disposed");
     }
     return resolver.GetAll(serviceType);
 }
        public IEnumerable <object> GetServices(Type serviceType)
        {
            if (resolver == null)
            {
                throw new Exception("This scope has been disposable");
            }

            return(resolver.GetAll(serviceType));
        }
        public IEnumerable <object> GetServices(Type serviceType)
        {
            if (_resolver == null)
            {
                throw new ObjectDisposedException("this", ErrDisposed);
            }

            return(_resolver.GetAll(serviceType));
        }
Example #8
0
        public IEnumerable <object> GetServices(Type serviceType)
        {
            if (resolutionRoot == null)
            {
                throw new ObjectDisposedException("resolutionRoot", "Dependency scope already disposed");
            }

            return(resolutionRoot.GetAll(serviceType));
        }
        /// <summary>
        /// The get services.
        /// </summary>
        /// <param name="serviceType">
        /// The service type.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        /// <exception cref="Exception">
        /// </exception>
        public IEnumerable <object> GetServices(Type serviceType)
        {
            if (this.resolutionRoot == null)
            {
                throw new Exception("The resolver of Ioc is null");
            }

            return(resolutionRoot.GetAll(serviceType));
        }
Example #10
0
            public bool NeedsExplicitTargetGoal(string commandName)
            {
                var cmd = localRoot.GetAll <ICommand>().FirstOrDefault(c => c.Name == commandName);

                if (cmd != null)
                {
                    return(cmd.NeedsExplicitTargetGoal);
                }

                return(true);
            }
Example #11
0
 public IEnumerable <object> GetServices(Type serviceType)
 {
     if (kernel == null)
     {
         return(resolutionRoot.GetAll(serviceType));
     }
     else
     {
         return(kernel.GetAll(serviceType));
     }
 }
        /// <summary>
        /// Gets an instance using the specified resolution root.
        /// </summary>
        /// <typeparam name="TService">The type of the service.</typeparam>
        /// <param name="resolutionRoot">The resolution root.</param>
        /// <param name="convertFunction">The convert function</param>
        /// <param name="type">The type to resolve.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The newly created instance.</returns>
        private static TService Get <TService>(
            IResolutionRoot resolutionRoot,
            Func <IEnumerable <object>, TService> convertFunction,
            Type type,
            params IParameter[] parameters)
        {
            if (convertFunction != null)
            {
                return(convertFunction(resolutionRoot.GetAll(type, parameters)));
            }

            return(resolutionRoot.Get <TService>(parameters));
        }
        public object GetAllAsList(IResolutionRoot resolutionRoot, Type type, IResolutionParameters resolutionParameters)
        {
            var listType = typeof(List<>).MakeGenericType(type).GetTypeInfo();
            var list = listType.DeclaredConstructors.Single(x => !x.GetParameters().Any()).Invoke(new object[0]);
            var addMethod = listType.GetDeclaredMethod("Add");

            IEnumerable<object> values = resolutionRoot.GetAll(type, resolutionParameters.Constraint, resolutionParameters.Parameters.ToArray());

            foreach (var value in values)
            {
                addMethod.Invoke(list, new[] { value });
            }

            return list;
        }
        /// <summary>
        /// Gets the services.
        /// </summary>
        /// <param name="serviceType">The service type.</param>
        /// <returns>The actual service implentations.</returns>
        /// <exception cref="System.ObjectDisposedException">Thrown if the scope has already been disposed.</exception>
        public IEnumerable <object> GetServices(Type serviceType)
        {
            if (resolver == null)
            {
                throw new ObjectDisposedException("this", "This scope has already been disposed");
            }

            try
            {
                return(resolver.GetAll(serviceType));
            }
            catch (ActivationException ex)
            {
                if (!TypeIsSystemAssembly(serviceType))
                {
                    Trace.WriteLine(ex.Message, "Ninject");
                    Trace.Flush();
                }

                return(new object[0]);
            }
        }
Example #15
0
 public object GetService(Type serviceType)
 {
     return(_kernel.GetAll(serviceType));
 }
Example #16
0
 public IEnumerable <T> GetAll <T>()
 {
     return(_resolution.GetAll <T>());
 }
Example #17
0
 public IEnumerable <object> BuildAll(Type typeToBuild)
 {
     return(resolutionRoot.GetAll(typeToBuild));
 }
Example #18
0
 public IEnumerable <object> GetServices(Type serviceType)
 {
     return(Container.GetAll(serviceType));
 }
Example #19
0
 public IEnumerable <object> GetServices(Type serviceType)
 {
     return(resolver.GetAll(serviceType));
 }
 public IEnumerable <T> CreateAll <T>() where T : IViewModel
 {
     return(_resolutionRoot.GetAll <T>());
 }
 public override IEnumerable <object> GetServices(Type serviceType)
 {
     return(_resolutionRoot.GetAll(serviceType).Concat(base.GetServices(serviceType)));
 }
Example #22
0
 public IEnumerable <TResolvedTo> ResolveAll <TResolvedTo>() where TResolvedTo : class
 {
     return(_container.GetAll <TResolvedTo>());
 }
Example #23
0
 /// <summary>
 /// Gets all nodes matching the requested type.
 /// </summary>
 /// <typeparam name="TNode">Type of the nodes to return.</typeparam>
 /// <returns>Enumerable of nodes matching the requested type.</returns>
 public override IEnumerable <TNode> GetAllNodes <TNode>()
 {
     return(_resolver.GetAll <TNode>());
 }
 public IEnumerable <object> GetServices(Type serviceType)
 {
     return(_kernel.GetAll(serviceType));
 }
Example #25
0
 /// <summary>
 /// Retrieves a collection of services from the scope.
 /// </summary>
 /// <returns>
 /// The retrieved collection of services.
 /// </returns>
 /// <param name="serviceType">The collection of services to be retrieved.</param>
 public IEnumerable <object> GetServices(Type serviceType)
 {
     return(_resolutionRoot.GetAll(serviceType, new IParameter[0]));
 }
Example #26
0
 public System.Collections.Generic.IEnumerable <object> GetServices(Type serviceType)
 {
     return(resolver.GetAll(serviceType));
 }
Example #27
0
 public IEnumerable <TService> ResolveAll <TService>()
 {
     return(_kernel.GetAll <TService>());
 }
 public IEnumerable <object> GetServices(Type serviceType)
 {
     return(_resolutionRoot.GetAll(serviceType));
 }
 public IEnumerable <TResolvedTo> ResolveAll <TResolvedTo>()
 {
     return(_container.GetAll <TResolvedTo>());
 }