コード例 #1
0
        public IFieldSetterSelector <TClass> FV <TValue>(string field, TValue value, bool ignoreFormat = false)
        {
            var fieldValue = SqlBuilderHelper.CreateStringValueFromGenericValue(value, ignoreFormat);

            FieldsList.Add(new Field(field, fieldValue, false));
            return(this);
        }
コード例 #2
0
        public IFieldSetterSelector <TClass> FP(string field, string param)
        {
            param = SqlBuilderHelper.CheckParamNameAndUseFieldNameIfEmpty(field, param);

            FieldsList.Add(new Field(field, param, true));
            return(this);
        }
コード例 #3
0
        public IWhereFieldSelector <TClass> WV <TValue>(string field, TValue value, OP whereOperator = OP.EQ, bool ignoreFormat = false)
        {
            var sendValue = SqlBuilderHelper.CreateStringValueFromGenericValue(value, ignoreFormat);

            Wheres.Add(CreateWhereFieldStringForValue(field, whereOperator, sendValue));

            return(this);
        }
コード例 #4
0
 public IWhereFieldSelector <TClass> WV <T, TValue>(
     Expression <Func <TClass, T> > field,
     TValue value,
     OP whereOperator  = OP.EQ,
     bool ignoreFormat = false)
 {
     return(WV(SqlBuilderHelper.GetNameFromExpression(field), value, whereOperator, ignoreFormat));
 }
コード例 #5
0
        public IWhereFieldSelector <TClass> WP(string field, string paramName = null, OP whereOperator = OP.EQ)
        {
            paramName = SqlBuilderHelper.CheckParamNameAndUseFieldNameIfEmpty(field, paramName);

            Wheres.Add(CreateWhereFieldStringForParameter(field, paramName, whereOperator));

            return(this);
        }
コード例 #6
0
        public ISelectFieldSelector <TClass> F(string field, string alias = null, string tablealias = null)
        {
            var tableAlias = SqlBuilderHelper.GetAliasForType <TClass>(tablealias);

            AddTableAlias(tableAlias);

            if (string.IsNullOrEmpty(alias))
            {
                FieldsList.Add($"{tableAlias}.{field}");
            }
            else
            {
                FieldsList.Add($"{tableAlias}.{field} as {alias}");
            }

            return(this);
        }
コード例 #7
0
        protected virtual string CreateWhereFieldStringForValue(string field, OP whereOperator, params string[] value)
        {
            if (whereOperator == OP.NULL_OR_DI)
            {
                return(string.Format(
                           "({0} IS NULL OR {0} {1} {2})",
                           field,
                           SqlBuilderHelper.GetStringForOperator(whereOperator),
                           value));
            }
            if (whereOperator == OP.NOT_IN && value.Length == 0)
            {
                return("/* NOT IN () */ 1 = 1");
            }

            if (whereOperator == OP.IN && value.Length == 0)
            {
                return("/* IN () */ 1 = 0");
            }

            return
                ($"{field} {SqlBuilderHelper.GetStringForOperator(whereOperator)} {(value != null ? GetStringValueByOperator(whereOperator, value) : GetNullStringValueByOperator(whereOperator))}");
        }
コード例 #8
0
 protected override string CreateWhereFieldStringForParameter(string field, string paramName, OP whereOperator)
 {
     return($"{GetAliasForType()}.{field} {SqlBuilderHelper.GetStringForOperator(whereOperator)} {DbConfigConfig.WithParameters(paramName)}");
 }
コード例 #9
0
 public IFieldSetterSelector <TClass> FV <T, TValue>(Expression <Func <TClass, T> > field, TValue value, bool ignoreFormat = false)
 {
     return(FV(SqlBuilderHelper.GetNameFromExpression(field), value, ignoreFormat));
 }
コード例 #10
0
 public IFieldSetterSelector <TClass> FP <T>(Expression <Func <TClass, T> > field, string param = null)
 {
     return(FP(SqlBuilderHelper.GetNameFromExpression(field), param));
 }
コード例 #11
0
 private string GetAliasForType()
 {
     return(Prefix ?? SqlBuilderHelper.GetAliasForType <TClass>());
 }
コード例 #12
0
 public ISelectFieldSelector <TClass> F <T>(Expression <Func <TClass, T> > field, string alias = null, string tablealias = null)
 {
     return(F(SqlBuilderHelper.GetNameFromExpression(field), alias, tablealias));
 }
コード例 #13
0
 private string GetParameterPrefix()
 {
     return(SqlBuilderHelper.GetParameterPrefixIfNull(DbConfigConfig?.GetParameterPrefix()));
 }
コード例 #14
0
 protected virtual string CreateWhereFieldStringForParameter(string field, string paramName, OP whereOperator)
 {
     return($"{field} {SqlBuilderHelper.GetStringForOperator(whereOperator)} {DbConfig.WithParameters(paramName)}");
 }
コード例 #15
0
 public IWhereFieldSelector <TClass> WP <T>(Expression <Func <TClass, T> > field, string[] paramNames, OP whereOperator = OP.IN)
 {
     return(WP <T>(SqlBuilderHelper.GetNameFromExpression(field), paramNames, whereOperator));
 }