private string AssignFilterParameterValue(string qualifiedName) { char prefix = qualifiedName[0]; string name = qualifiedName.Substring(1); if ((prefix.Equals('@') || prefix.Equals(':')) && !(_currentCommand.Parameters.Contains(qualifiedName))) { object result = null; if ((_parameters != null) && _parameters.ContainsKey(qualifiedName)) { result = _parameters[qualifiedName]; } else { IActionHandler handler = _config.CreateActionHandler(); if (handler == null) { throw new Exception(String.Format("View \'{0}\' uses a filter with \'{2}\' parameter. Business rules class of the contro" + "ller must provide a value for this parameter. The filter is defined as {1}.", _viewId, _viewFilter, name)); } result = handler.GetType().InvokeMember(name, (System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.GetField), null, handler, new object[0]); } IEnumerable <object> enumerable = null; if (typeof(IEnumerable <object>).IsInstanceOfType(result)) { enumerable = ((IEnumerable <object>)(result)); } if (enumerable != null) { StringBuilder sb = new StringBuilder(); sb.Append("("); int parameterIndex = 0; foreach (object o in enumerable) { DbParameter p = _currentCommand.CreateParameter(); _currentCommand.Parameters.Add(p); p.ParameterName = (qualifiedName + parameterIndex.ToString()); p.Value = o; if (parameterIndex > 0) { sb.Append(","); } sb.Append(p.ParameterName); parameterIndex++; } sb.Append(")"); return(sb.ToString()); } else { DbParameter p = _currentCommand.CreateParameter(); _currentCommand.Parameters.Add(p); p.ParameterName = qualifiedName; p.Value = result; } } return(qualifiedName); }