private QueryBuilderResult BuildSelect()
        {
            QueryBuilderResult result     = new QueryBuilderResult();
            StringBuilder      sqlBuilder = new StringBuilder();

            #region -> Generate Select SQL
            if (SelectColumns != null && SelectColumns.Count > 0)
            {
                // select specific
                sqlBuilder.Append($"select {string.Join(",", SelectColumns)} from {EntityName}");
            }
            else
            {
                // select all columns
                sqlBuilder.Append($"select * from {EntityName}");
            }
            #endregion

            #region -> Condition SQL
            BuildCondition(sqlBuilder, result.Parameters);
            #endregion

            #region -> Order By
            if (OrderBy != null)
            {
                sqlBuilder.Append($" order by {OrderBy.Column} {OrderBy.OrderBy} ");
            }
            #endregion

            #region -> For Group By
            if (GroupBy != null && GroupBy.Count > 0)
            {
                sqlBuilder.Append($" group by {string.Join(",", GroupBy)} ");
            }
            #endregion

            #region -> Extra SQL
            if (!string.IsNullOrEmpty(ExtraSql))
            {
                sqlBuilder.Append($" {ExtraSql} ");
            }
            #endregion

            #region -> Generate
            result.Sql = sqlBuilder.ToString().Trim();
            if (EnableSnakeCase)
            {
                result.Sql = result.Sql.ToSnakeCase();
            }
            #endregion

            return(result);
        }
        private QueryBuilderResult BuildUpdate()
        {
            QueryBuilderResult result     = new QueryBuilderResult();
            StringBuilder      sqlBuilder = new StringBuilder();

            sqlBuilder.Append($"update {EntityName} ");

            #region -> For Set
            if (_updateColumns.Count > 0)
            {
                List <string> setConditions = new List <string>();
                foreach (var value in _updateColumns)
                {
                    string columnName = value.Key;
                    if (EnableSnakeCase)
                    {
                        columnName = columnName.ToSnakeCase();
                    }
                    setConditions.Add($"{columnName}=@{columnName}");
                    result.Parameters.Add(columnName, value.Value);
                }
                // set value
                sqlBuilder.Append(" SET " + string.Join(",", setConditions));
            }

            #endregion

            #region -> Condition SQL
            BuildCondition(sqlBuilder, result.Parameters);
            #endregion

            #region -> Extra SQL
            if (!string.IsNullOrEmpty(ExtraSql))
            {
                sqlBuilder.Append($" {ExtraSql} ");
            }
            #endregion

            #region -> Generate
            result.Sql = sqlBuilder.ToString().Trim();
            if (EnableSnakeCase)
            {
                result.Sql = result.Sql.ToSnakeCase();
            }
            #endregion

            return(result);
        }
        public QueryBuilderResult Build(BuildType buildType)
        {
            QueryBuilderResult result = null;

            switch (buildType)
            {
            case BuildType.Insert: { return(BuildInsert()); }

            case BuildType.Update: { return(BuildUpdate()); }

            case BuildType.Delete: { return(BuildDelete()); }

            case BuildType.Select: { return(BuildSelect()); }
            }
            return(result);
        }
        private QueryBuilderResult BuildDelete()
        {
            QueryBuilderResult result     = new QueryBuilderResult();
            StringBuilder      sqlBuilder = new StringBuilder();

            sqlBuilder.Append($"delete from {EntityName} ");

            #region -> Condition SQL
            BuildCondition(sqlBuilder, result.Parameters);
            #endregion

            #region -> Generate
            result.Sql = sqlBuilder.ToString().Trim();
            if (EnableSnakeCase)
            {
                result.Sql = result.Sql.ToSnakeCase();
            }
            #endregion

            return(result);
        }