コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }