예제 #1
0
        /*----------------------------------------------------------------------------------------*/
        /// <summary>
        /// Initializes a new instance of the <see cref="AutoControllerModule"/> class.
        /// </summary>
        /// <param name="assemblyNames">The names of assemblies which should be scanned for controllers.</param>
        public AutoControllerModule(params string[] assemblyNames)
        {
#if !MONO
            _assemblies = assemblyNames.Convert(s => Assembly.Load(s));
#else
            _assemblies = ExtensionsForIEnumerable.Convert(assemblyNames, s => Assembly.Load(s));
#endif
        }
예제 #2
0
        /*----------------------------------------------------------------------------------------*/
        /// <summary>
        /// Returns a value indicating whether the specified member should be injected during activation.
        /// </summary>
        /// <param name="binding">The binding that points at the type whose activation plan being manipulated.</param>
        /// <param name="plan">The activation plan that is being manipulated.</param>
        /// <param name="candidates">The candidates that are available.</param>
        /// <param name="member">The member in question.</param>
        /// <returns><see langword="True"/> if the member should be injected, otherwise <see langword="false"/>.</returns>
        public bool ShouldInject(IBinding binding, IActivationPlan plan, IEnumerable <MethodInfo> candidates, MethodInfo member)
        {
            var registry = binding.Components.BindingRegistry;

            ParameterInfo[] parameters = member.GetParameters();
#if !MONO
            return(parameters.Length > 0 && parameters.Convert(p => p.ParameterType).All(registry.HasBinding));
#else
            return(parameters.Length > 0 &&
                   ExtensionsForIEnumerable.All(
                       ExtensionsForIEnumerable.Convert(parameters, p => p.ParameterType),
                       registry.HasBinding));
#endif
        }
        /*----------------------------------------------------------------------------------------*/
        #region EDSL Members
        /// <summary>
        /// Continues the conditional chain, converting all items in the input series.
        /// </summary>
        /// <typeparam name="TOutput">The type of item to convert to.</typeparam>
        /// <param name="converter">The converter callback to execute.</param>
        public EnumerableConditionBuilder <TRoot, TSubject, IEnumerable <TOutput>, TOutput> Convert <TOutput>(Func <TItem, TOutput> converter)
        {
#if !MONO
            return(new EnumerableConditionBuilder <TRoot, TSubject, IEnumerable <TOutput>, TOutput>(this, e => e.Convert(converter)));
#else
            return(new EnumerableConditionBuilder <TRoot, TSubject, IEnumerable <TOutput>, TOutput>(this, e => ExtensionsForIEnumerable.Convert(e, converter)));
#endif
        }