Esempio n. 1
0
        /// <summary>
        /// static method to create enumerable dynamic
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="injectionScope"></param>
        /// <param name="scope"></param>
        /// <param name="disposalScope"></param>
        /// <param name="consider"></param>
        /// <param name="injectionContext"></param>
        /// <returns></returns>
        public static object EnumerableCreateMethod <T>(IInjectionScope injectionScope, IExportLocatorScope scope,
                                                        IDisposalScope disposalScope, ActivationStrategyFilter consider, IInjectionContext injectionContext)

        {
            var all = injectionScope.InternalLocateAll <T>(scope, disposalScope, typeof(T), injectionContext, consider, null);

            if (injectionScope.ScopeConfiguration.Behaviors.CustomEnumerableCreator != null)
            {
                return(injectionScope.ScopeConfiguration.Behaviors.CustomEnumerableCreator.CreateEnumerable(scope, all.ToArray()));
            }

            return(all);
        }
Esempio n. 2
0
        /// <summary>
        /// Locate all instances of a specific type
        /// </summary>
        /// <param name="type">type ot locate</param>
        /// <param name="extraData">extra data to be used while locating</param>
        /// <param name="consider">strategy filter</param>
        /// <param name="comparer">comparer to use to sort collection</param>
        /// <returns>list of objects</returns>
        public override List <object> LocateAll(Type type, object extraData = null, ActivationStrategyFilter consider = null, IComparer <object> comparer = null)
        {
            var context = _injectionScope.CreateContext(extraData);

            return(_injectionScope.InternalLocateAll(this, this, type, context, consider, comparer));
        }
Esempio n. 3
0
 /// <summary>
 /// Static method to create an a dynamic array
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="injectionScope"></param>
 /// <param name="scope"></param>
 /// <param name="disposalScope"></param>
 /// <param name="consider"></param>
 /// <param name="injectionContext"></param>
 /// <returns></returns>
 public static object ArrayCreateMethod <T>(IInjectionScope injectionScope, IExportLocatorScope scope,
                                            IDisposalScope disposalScope, ActivationStrategyFilter consider,
                                            IInjectionContext injectionContext)
 {
     return(injectionScope.InternalLocateAll <T>(scope, disposalScope, typeof(T), injectionContext, consider, null).ToArray());
 }