Exemple #1
0
 /// <summary>
 ///   Adds <paramref name = "types" /> as additional services to be exposed by this component.
 /// </summary>
 /// <param name = "types">The types to forward.</param>
 /// <returns></returns>
 public ComponentRegistration <TService> Forward(IEnumerable <Type> types)
 {
     foreach (var type in types)
     {
         ComponentServicesUtil.AddService(potentialServices, type);
     }
     return(this);
 }
Exemple #2
0
        /// <summary>
        ///   Add service to be exposed by this <see cref = "ComponentModel" />
        /// </summary>
        /// <param name = "type"></param>
        public void AddService(Type type)
        {
            if (type == null)
            {
                return;
            }

            ComponentServicesUtil.AddService(services, type);
        }
Exemple #3
0
        /// <summary>
        ///   Adds <paramref name="types" /> as additional services to be exposed by this component.
        /// </summary>
        /// <param name="types">The types to forward.</param>
        /// <returns>Current component registration</returns>
        public PropertyResolvingComponentRegistration <TService> Forward(IEnumerable <Type> types)
        {
            Type[] arr = types.ToArray();

            foreach (Type type in arr)
            {
                ComponentServicesUtil.AddService(m_potentialServices, type);
            }

            return(this);
        }
Exemple #4
0
        /// <summary>
        ///   Add service to be exposed by this <see cref = "ComponentModel" />
        /// </summary>
        /// <param name = "type"></param>
        public void AddService(Type type)
        {
            if (type == null)
            {
                return;
            }
            if (type.IsValueType)
            {
                throw new ArgumentException("Type {0} is a value type and can not be used as a service.");
            }

            ComponentServicesUtil.AddService(services, type);
        }
Exemple #5
0
        /// <summary>
        ///   Add service to be exposed by this <see cref="ComponentModel" />
        /// </summary>
        /// <param name="type"> </param>
        public void AddService(Type type)
        {
            if (type == null)
            {
                return;
            }
            if (type.IsPrimitiveType())
            {
                throw new ArgumentException(
                          string.Format("Type {0} can not be used as a service. only classes, and interfaces can be exposed as a service.",
                                        type));
            }

            ComponentServicesUtil.AddService(services, type);
        }