Example #1
0
        /// <summary>
        /// Apply an "in" constraint to the named property (Dapper.Net)
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="expression"></param>
        /// <param name="values"></param>
        /// <param name="paramName"></param>
        /// <returns></returns>
        public static WhereClip DapperIn <TEntity, T>(Expression <Func <TEntity, object> > expression, IEnumerable <T> values, string paramName = null) where TEntity : class
        {
            string propertyName = SqlQueryUtils.GetPropertyName(expression);

            return(DapperIn(propertyName, values, paramName));
        }
Example #2
0
        /// <summary>
        /// Apply a "between" constraint to the named property
        /// </summary>
        /// <param name="expression">The name of the Property in the class.</param>
        /// <param name="lo">The low value for the Property.</param>
        /// <param name="hi">The high value for the Property.</param>
        /// <returns>A <see cref="WhereClip" />.</returns>
        public static WhereClip Between <TEntity>(Expression <Func <TEntity, object> > expression, object lo, object hi, string paramName = null) where TEntity : class
        {
            string propertyName = SqlQueryUtils.GetPropertyName(expression);

            return(Between(propertyName, lo, hi, paramName));
        }
Example #3
0
        /// <summary>
        /// 不为空
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public static WhereClip IsNotNull <TEntity>(Expression <Func <TEntity, object> > expression) where TEntity : class
        {
            string propertyName = SqlQueryUtils.GetPropertyName(expression);

            return(IsNotNull(propertyName));
        }
Example #4
0
        /// <summary>
        /// Apply a "greater than or equal" constraint to the named property
        /// </summary>
        /// <param name="expression">The name of the Property in the class.</param>
        /// <param name="value">The value for the Property.</param>
        public static WhereClip Ge <TEntity>(Expression <Func <TEntity, object> > expression, object value, string paramName = null) where TEntity : class
        {
            string propertyName = SqlQueryUtils.GetPropertyName(expression);

            return(Ge(propertyName, value, paramName));
        }
Example #5
0
        internal OrderByClip OrderBy <TEntity>(Expression <Func <TEntity, object> > expression, SortDirection sortDirection = SortDirection.Ascending)
        {
            string propertyName = SqlQueryUtils.GetPropertyName(expression);

            return(OrderBy(propertyName, sortDirection));
        }