public Aggregate(ExpressionHolder expressionHolder) : base(expressionHolder) { if (expressionHolder != null) { this.expr = (ExpressionReturnValue <T>)expressionHolder.Expr; } else { this.expr = null; } }
/// <summary> /// TODO /// </summary> /// <param name="name"> /// The name of the object that is having the value of one of its properties resolved. /// </param> /// <param name="definition"> /// The definition of the named object. /// </param> /// <param name="argumentName"> /// The name of the property the value of which is being resolved. /// </param> /// <param name="argumentValue"> /// The value of the property that is being resolved. /// </param> private object ResolvePropertyValue(string name, IObjectDefinition definition, string argumentName, object argumentValue) { object resolvedValue = null; // we must check the argument value to see whether it requires a runtime // reference to another object to be resolved. // if it does, we'll attempt to instantiate the object and set the reference. if (RemotingServices.IsTransparentProxy(argumentValue)) { resolvedValue = argumentValue; } else if (argumentValue is ICustomValueReferenceHolder) { resolvedValue = ((ICustomValueReferenceHolder)argumentValue).Resolve(objectFactory, name, definition, argumentName, argumentValue); } else if (argumentValue is ObjectDefinitionHolder) { // contains an IObjectDefinition with name and aliases... ObjectDefinitionHolder holder = (ObjectDefinitionHolder)argumentValue; resolvedValue = ResolveInnerObjectDefinition(name, holder.ObjectName, argumentName, holder.ObjectDefinition, definition.IsSingleton); } else if (argumentValue is IObjectDefinition) { // resolve plain IObjectDefinition, without contained name: use dummy name... IObjectDefinition def = (IObjectDefinition)argumentValue; resolvedValue = ResolveInnerObjectDefinition(name, "(inner object)", argumentName, def, definition.IsSingleton); } else if (argumentValue is RuntimeObjectReference) { RuntimeObjectReference roref = (RuntimeObjectReference)argumentValue; resolvedValue = ResolveReference(definition, name, argumentName, roref); } else if (argumentValue is ExpressionHolder) { ExpressionHolder expHolder = (ExpressionHolder)argumentValue; object context = null; IDictionary <string, object> variables = null; if (expHolder.Properties != null) { PropertyValue contextProperty = expHolder.Properties.GetPropertyValue("Context"); context = contextProperty == null ? null : ResolveValueIfNecessary(name, definition, "Context", contextProperty.Value); PropertyValue variablesProperty = expHolder.Properties.GetPropertyValue("Variables"); object vars = (variablesProperty == null ? null : ResolveValueIfNecessary(name, definition, "Variables", variablesProperty.Value)); if (vars is IDictionary <string, object> ) { variables = (IDictionary <string, object>)vars; } if (vars is IDictionary) { IDictionary temp = (IDictionary)vars; variables = new Dictionary <string, object>(temp.Count); foreach (DictionaryEntry entry in temp) { variables.Add((string)entry.Key, entry.Value); } } else { if (vars != null) { throw new ArgumentException("'Variables' must resolve to an IDictionary"); } } } if (variables == null) { variables = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); } // add 'this' objectfactory reference to variables variables.Add(Expression.ReservedVariableNames.CurrentObjectFactory, objectFactory); resolvedValue = expHolder.Expression.GetValue(context, variables); } else if (argumentValue is IManagedCollection) { resolvedValue = ((IManagedCollection)argumentValue).Resolve(name, definition, argumentName, ResolveValueIfNecessary); } else if (argumentValue is TypedStringValue) { TypedStringValue tsv = (TypedStringValue)argumentValue; try { Type resolvedTargetType = ResolveTargetType(tsv); if (resolvedTargetType != null) { resolvedValue = TypeConversionUtils.ConvertValueIfNecessary(tsv.TargetType, tsv.Value, null); } else { resolvedValue = tsv.Value; } } catch (Exception ex) { throw new ObjectCreationException(definition.ResourceDescription, name, "Error converted typed String value for " + argumentName, ex); } } else { // no need to resolve value... resolvedValue = argumentValue; } return(resolvedValue); }
public StrMax(ExpressionHolder expressionHolder) : base(expressionHolder) { }
public IntMax(ExpressionHolder expressionHolder) : base(expressionHolder) { }
public Min(ExpressionHolder expressionHolder) : base(expressionHolder) { }
public ExpressionToStringWrapper(ExpressionHolder expressionHolder) : base(expressionHolder) { this.expr = (ExpressionReturnValue <T>)expressionHolder.Expr; }