public static DapperSql ParseToDapperSql <T>(this BaseSearch <T> search, ISqlDialect dialect, string tableAlias = null)
        {
            if (search == null)
            {
                return(null);
            }

            tableAlias = string.IsNullOrEmpty(tableAlias) ? "" : tableAlias + ".";

            List <string> sqls = new List <string>();
            Dictionary <string, object> allParameters = new Dictionary <string, object>();

            foreach (PropertyInfo p in search.GetType().GetProperties())
            {
                (string sql, Dictionary <string, object> parameters) = ParseProperty(search, p, dialect, tableAlias);
                if (sql != null)
                {
                    sqls.Add(sql);
                    allParameters.TryConcat(parameters);
                }
            }

            var allSql = string.Join(" AND ", sqls.ToArray());

            return(new DapperSql(allSql, allParameters));
        }
        public static Expression <Func <T, bool> > GetExpression <T>(this BaseSearch <T> self)
        {
            if (self == null)
            {
                return(null);
            }

            var parameter = Expression.Parameter(typeof(T));
            Expression <Func <T, bool> > expression = null;

            foreach (PropertyInfo p in self.GetType().GetProperties())
            {
                var exp = GetPropertyExpression(self, p, parameter);
                if (expression == null)
                {
                    expression = exp;
                }
                else if (exp != null)
                {
                    expression = Expression.Lambda <Func <T, bool> >(Expression.AndAlso(expression.Body, exp.Body), parameter);
                }
            }
            return(expression);
        }