/// <summary> /// For Csv file generation grammars, mark this cell as being included in the CSV file /// generation with a default value if the column is not explicitly included in the specification /// </summary> /// <param name="expression"></param> /// <param name="defaultValueSource">A lambda to build default data per row</param> /// <returns></returns> public static ICellExpression UseDefaultIfNotExplicitlyExpressed(this ICellExpression expression, Func <StepValues, string> defaultValueSource) { expression.DefaultValue("NULL"); expression.Metadata(CsvRequiredKey, CsvRequired.UseDefaultIfNotExplicitlyExpressed); return(expression.Metadata(CsvValueBuilderKey, defaultValueSource)); }
/// <summary> /// For Csv file generation grammars, mark this cell as being included in the CSV file /// generation with a default value if the column is not explicitly included in the specification /// </summary> /// <param name="expression"></param> /// <param name="defaultValue"></param> /// <returns></returns> public static ICellExpression UseDefaultIfNotExplicitlyExpressed(this ICellExpression expression, string defaultValue) { expression.Metadata(CsvRequiredKey, CsvRequired.UseDefaultIfNotExplicitlyExpressed); return(expression.DefaultValue(defaultValue)); }
public static ICellExpression DefaultIsEmpty(this ICellExpression expression) { return(expression.DefaultValue("EMPTY")); }
/// <summary> /// For Csv file generation grammars, mark this cell as being completely omitted /// from the generated file if the column is not explicitly included in the specification /// </summary> /// <param name="expression"></param> /// <returns></returns> public static ICellExpression OmitIfInactive(this ICellExpression expression) { expression.DefaultValue("NULL"); return(expression.Metadata(CsvRequiredKey, CsvRequired.OmitIfInactive)); }
/// <summary> /// Shorthand for DefaultValue("NULL") /// </summary> /// <param name="expression"></param> /// <returns></returns> public static ICellExpression DefaultIsNull(this ICellExpression expression) { return(expression.DefaultValue("NULL")); }