Ejemplo n.º 1
0
        protected override object build(Type pluginType, BuildSession session)
        {
            if (EnumerableInstance.IsEnumerable(pluginType))
            {
                var enumerable = new EnumerableInstance(pluginType, null);
                return(enumerable.Build(pluginType, session));
            }

            return(session.GetInstance(pluginType));
        }
Ejemplo n.º 2
0
        private Argument findByAll(Type argumentType, string name)
        {
            if (argumentType == null)
            {
                return(null);
            }

            var argument = _dependencies.LastOrDefault(x => x.Name == name && x.Type == argumentType);

            if (argument == null && EnumerableInstance.IsEnumerable(argumentType))
            {
                var elementType = EnumerableInstance.DetermineElementType(argumentType);
                argument = _dependencies
                           .LastOrDefault(x => x.Type == typeof(IEnumerable <>).MakeGenericType(elementType) && x.Name == name);
            }

            return(argument);
        }
Ejemplo n.º 3
0
 public override IDependencySource ToDependencySource(Type pluginType)
 {
     return(EnumerableInstance.IsEnumerable(pluginType)
         ? (IDependencySource) new AllPossibleValuesDependencySource(pluginType)
         : new DefaultDependencySource(pluginType));
 }