public static IRawBuilder Append(this IRawBuilder builder, bool condition, Func <string> sqlFunc, Func <SqlBuilderParameter> paramsFunc) { builder = builder ?? throw new ArgumentNullException(nameof(builder)); if (condition) { if (paramsFunc != null) { return(builder.Append(sqlFunc?.Invoke(), paramsFunc.Invoke())); } else { return(builder.Append(sqlFunc?.Invoke())); } } else { return(builder); } }
public static IRawBuilder Append(this IRawBuilder builder, bool condition, Func <string> func) { builder = builder ?? throw new ArgumentNullException(nameof(builder)); func = func ?? throw new ArgumentNullException(nameof(func)); if (condition) { return(builder.Append(func.Invoke())); } else { return(builder); } }