Maps services to build plans.
Inheritance: IServiceMappings
Ejemplo n.º 1
0
        /// <summary>
        /// Resolve all found implementations.
        /// </summary>
        /// <param name="service">Service to find</param>
        /// <returns>objects which implements the service (or an empty list).</returns>
        public IEnumerable <object> ResolveAll(Type service)
        {
            IList <IBuildPlan> bps;

            if (!ServiceMappings.TryGetValue(service, out bps))
            {
                return(new object[0]);
            }

            var services = new object[bps.Count];

            for (var i = 0; i < services.Length; i++)
            {
                services[i] = GetInstance(bps[i], service);
            }

            return(services);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resolve all found implementations.
        /// </summary>
        /// <typeparam name="T">Requested service</typeparam>
        /// <returns>objects which implements the service (or an empty list).</returns>
        public IEnumerable <T> ResolveAll <T>() where T : class
        {
            IList <IBuildPlan> bps;

            if (!ServiceMappings.TryGetValue(typeof(T), out bps))
            {
                return(new T[0]);
            }

            var services = new T[bps.Count];

            for (var i = 0; i < services.Length; i++)
            {
                services[i] = (T)GetInstance(bps[i], typeof(T));
            }

            return(services);
        }