My.RolePermission.Model/SearchParam/OrderByExt.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/****************************************************************************
 *Copyright (c) 2016 All Rights Reserved.
 *CLR版本: 4.0.30319.42000
 *机器名称:DESKTOP-V7CFIC3
 *公司名称:
 *命名空间:My.RolePermission.Model.SearchParam
 *文件名:  OrderByExt
 *版本号:  V1.0.0.0
 *唯一标识:21209dab-6d36-4214-a131-0d05dd8205bd
 *当前的用户域:DESKTOP-V7CFIC3
 *创建人:  zouqi
 *电子邮箱:zouyujie@126.com
 *创建时间:2016/6/25 9:44:18

 *描述:
 *
 *=====================================================================
 *修改标记
 *修改时间:2016/6/25 9:44:18
 *修改人: zouqi
 *版本号: V1.0.0.0
 *描述:
 *
 *****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace My.RolePermission.Model.SearchParam
{
    public static class OrderByExt
    {
        public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property)
        {
            return ApplyOrder<T>(source, property, "OrderBy");
        }

        public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> source, string property)
        {
            return ApplyOrder<T>(source, property, "OrderByDescending");
        }

        public static IOrderedQueryable<T> ThenBy<T>(this IOrderedQueryable<T> source, string property)
        {
            return ApplyOrder<T>(source, property, "ThenBy");
        }

        public static IOrderedQueryable<T> ThenByDescending<T>(this IOrderedQueryable<T> source, string property)
        {
            return ApplyOrder<T>(source, property, "ThenByDescending");
        }

        static IOrderedQueryable<T> ApplyOrder<T>(IQueryable<T> source, string property, string methodName)
        {
            string[] props = property.Split('.');
            Type type = typeof(T); ParameterExpression arg = Expression.Parameter(type, "x");
后面还有 18 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。