Esempio 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));
        }
Esempio 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);
        }
Esempio n. 3
0
 public override IDependencySource ToDependencySource(Type pluginType)
 {
     return(EnumerableInstance.IsEnumerable(pluginType)
         ? (IDependencySource) new AllPossibleValuesDependencySource(pluginType)
         : new DefaultDependencySource(pluginType));
 }