Esempio n. 1
0
        private object DoBuildUp(Type t, object existing, string name, IEnumerable<ResolverOverride> resolverOverrides)
        {
            IBuilderContext context = null;

            try
            {
                context =
                    new BuilderContext(
                        GetStrategies(),
                        lifetimeContainer,
                        policies,
                        new NamedTypeBuildKey(t, name),
                        existing);
                context.AddResolverOverrides(resolverOverrides);

                if(t.IsGenericTypeDefinition)
                {
                    throw new ArgumentException(
                        string.Format(CultureInfo.CurrentCulture,
                        Resources.CannotResolveOpenGenericType,
                        t.FullName), "t");
                }

                return context.Strategies.ExecuteBuildUp(context);
            }
            catch (Exception ex)
            {
                throw new ResolutionFailedException(t, name, ex, context);
            }
        }
Esempio n. 2
0
        public object NewBuildUp(NamedTypeBuildKey newBuildKey, Action<IBuilderContext> childCustomizationBlock)
        {
            Guard.ArgumentNotNull(childCustomizationBlock, "childCustomizationBlock");

            ChildContext =
                new BuilderContext(chain, lifetime, persistentPolicies, policies, newBuildKey, null);

            ChildContext.AddResolverOverrides(Sequence.Collect(resolverOverrides));

            childCustomizationBlock(ChildContext);

            object result = ChildContext.Strategies.ExecuteBuildUp(ChildContext);

            ChildContext = null;

            return result;
        }
Esempio n. 3
0
        public object NewBuildUp(NamedTypeBuildKey newBuildKey)
        {
            ChildContext =
                new BuilderContext(chain, lifetime, persistentPolicies, policies, newBuildKey, null);

            ChildContext.AddResolverOverrides(Sequence.Collect(resolverOverrides));

            object result = ChildContext.Strategies.ExecuteBuildUp(ChildContext);

            ChildContext = null;

            return result;
        }