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