/// <summary> Gets a string field list with the specified separator. /// The fields match the specified match predicate delegate and their names are transformed by /// the specified string transformation action delegate. /// </summary> /// <param name="match">A match predicate delegate.</param> /// <param name="transformation">A string transformation action delegate.</param> /// <param name="separator">The string that separates fields.</param> /// <returns>A string field list with the transformed fields name separated by the specified separator.</returns> private string GetFieldList(Predicate <FieldInfo> match, FieldTransformation transformation, string separator) { string fieldList = ""; int fieldIndex = 0; List <FieldInfo> fields; //Public member match if (match != null) { fields = GetFields().FindAll(match); } else { fields = GetFields(); } //Public filtered members iteration foreach (FieldInfo fieldInfo in fields) { string fieldName; object fieldValue = fieldInfo.GetValue(this); DbField field = (DbField)fieldValue; //Transform the field name if (transformation != null) { fieldName = transformation(field); } else { fieldName = fieldInfo.Name; } //Build the SQL text if (fieldIndex == 0) { fieldList = fieldName; } else { fieldList = fieldList + separator + fieldName; } fieldIndex++; } return(fieldList); }
/// <summary> Gets a string field list. /// The fields match the specified match predicate delegate and their names are transformed by /// the specified string transformation action delegate. /// </summary> /// <param name="match">A match predicate delegate.</param> /// <param name="transformation">A string transformation action delegate.</param> /// <returns>A string field list with the transformed fields name separated by commas.</returns> private string GetFieldList(Predicate <FieldInfo> match, FieldTransformation transformation) { return(GetFieldList(match, transformation, ",")); }