Beispiel #1
0
        private Expression GetExpressionForDefault(ServiceRegistration serviceRegistration, ResolutionContext resolutionContext)
        {
            if (resolutionContext.WeAreInCircle(serviceRegistration.RegistrationId))
            {
                throw new CircularDependencyException(serviceRegistration.ImplementationType);
            }

            resolutionContext.PullOutCircularDependencyBarrier(serviceRegistration.RegistrationId);
            var result = this.PrepareDefaultExpression(serviceRegistration, resolutionContext);

            resolutionContext.LetDownCircularDependencyBarrier();
            return(result);
        }
Beispiel #2
0
        private Expression GetExpressionForFactory(ServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type resolveType)
        {
            if (resolutionContext.WeAreInCircle(serviceRegistration.RegistrationId))
            {
                throw new CircularDependencyException(serviceRegistration.ImplementationType);
            }

            resolutionContext.PullOutCircularDependencyBarrier(serviceRegistration.RegistrationId);

            var parameters = GetFactoryParameters(serviceRegistration, resolutionContext);
            var expression = ConstructFactoryExpression(serviceRegistration, parameters);
            var result     = this.expressionFactory.ConstructBuildUpExpression(serviceRegistration, resolutionContext, expression, resolveType);

            resolutionContext.LetDownCircularDependencyBarrier();
            return(result);
        }