/// <inheritdoc /> public override string Format(IColumnContext context, object value) { var destinationValue = value == null ? (object)null : formatter((TDestination)value); var sourceValue = columnDefinition.Format(context, destinationValue); return(sourceValue); }
public string Format(object value) { object[] rawValues = writer.Write((TEntity)value); string formatted = column.Format(rawValues); return(formatted); }
public string Format(object value) { object[] values = new object[workCount]; writer((TEntity)value, values); string formatted = column.Format(values); return(formatted); }
private static string FormatWithoutContext(IColumnDefinition definition, int position, object value) { try { return(definition.Format(null, value)); } catch (Exception exception) { throw new ColumnProcessingException(definition, position, value, exception); } }
/// <summary> /// Formats the given values assuming that they are in the same order as the column definitions. /// </summary> /// <param name="metadata">The current metadata for the process.</param> /// <param name="values">The values to format.</param> /// <returns>The formatted values.</returns> protected string[] FormatValuesBase(IProcessMetadata metadata, object[] values) { string[] formattedValues = new string[definitions.Count]; for (int columnIndex = 0, valueIndex = 0; columnIndex != definitions.Count; ++columnIndex) { IColumnDefinition definition = definitions[columnIndex]; if (definition is IMetadataColumn metaColumn) { object value = metaColumn.GetValue(metadata); string formattedValue = definition.Format(value); formattedValues[columnIndex] = formattedValue; ++valueIndex; } else if (!definition.IsIgnored) { object value = values[valueIndex]; string formattedValue = definition.Format(value); formattedValues[columnIndex] = formattedValue; ++valueIndex; } } return(formattedValues); }
private static string Format(IColumnContext columnContext, IColumnDefinition definition, int position, object value) { try { return(definition.Format(columnContext, value)); } catch (Exception exception) when(columnContext == null) { throw new ColumnProcessingException(definition, position, value, exception); } catch (Exception exception) { throw new ColumnProcessingException(columnContext, value, exception); } }
/// <summary> /// Formats the given values assuming that they are in the same order as the column definitions. /// </summary> /// <param name="values">The values to format.</param> /// <returns>The formatted values.</returns> protected string[] FormatValuesBase(object[] values) { string[] formattedValues = new string[definitions.Count]; for (int columnIndex = 0, valueIndex = 0; columnIndex != definitions.Count; ++columnIndex) { IColumnDefinition definition = definitions[columnIndex]; if (!definition.IsIgnored) { object value = values[valueIndex]; string formattedValue = definition.Format(value); formattedValues[columnIndex] = formattedValue; ++valueIndex; } } return(formattedValues); }