/// <inheritdoc /> public Expression GetExpression(IContainerContext containerContext, ResolutionContext resolutionContext, Type resolveType) { if (this.IsDecorator || this.metaInformation.IsOpenGenericType) { return(this.ConstructExpression(containerContext, resolutionContext, resolveType)); } var expression = resolutionContext.GetCachedExpression(this.RegistrationNumber); if (expression != null) { return(expression); } expression = this.ConstructExpression(containerContext, resolutionContext, resolveType); resolutionContext.CacheExpression(this.RegistrationNumber, expression); return(expression); }
private protected static Expression GetExpressionForRegistration(ExpressionBuilder expressionBuilder, ServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type requestedType) { if (!IsRegistrationOutputCacheable(serviceRegistration, resolutionContext)) { return(expressionBuilder.BuildExpressionForRegistration(serviceRegistration, resolutionContext, requestedType)); } var expression = resolutionContext.GetCachedExpression(serviceRegistration.RegistrationId); if (expression != null) { return(expression); } expression = expressionBuilder.BuildExpressionForRegistration(serviceRegistration, resolutionContext, requestedType); resolutionContext.CacheExpression(serviceRegistration.RegistrationId, expression); return(expression); }