Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# C中Lambda的重复场有多明显#_C#_Asp.net Mvc - Fatal编程技术网

C# C中Lambda的重复场有多明显#

C# C中Lambda的重复场有多明显#,c#,asp.net-mvc,C#,Asp.net Mvc,我有下面的查询方法,我需要在这个方法中添加另一个“if”来区分带有重复字段“FormCaption”的查询 public virtual List<UMS.Common.DataEntity.Permission> Get(Expression<Func<UMS.Common.DataEntity.Permission, bool>> filter = null, Func<IQueryable<UMS.Common.DataEntity.

我有下面的查询方法,我需要在这个方法中添加另一个“if”来区分带有重复字段“FormCaption”的查询

    public virtual List<UMS.Common.DataEntity.Permission> Get(Expression<Func<UMS.Common.DataEntity.Permission, bool>> filter = null, Func<IQueryable<UMS.Common.DataEntity.Permission>, IOrderedQueryable<UMS.Common.DataEntity.Permission>> orderBy = null, int? count = null)
    {
        try
        {
            var query = this.DA.Get();

            // Filter data
            if (filter != null)
            {
                query = query.Where(filter);
            }

            // Sort data
            if (orderBy != null)
            {
                query = orderBy(query);
            }

            if (count.HasValue)
            {
                query = query.Take(count.Value);
            }

            return query.ToList();
        }
        catch (Exception ex)
        {
            Exception newEx = ExceptionHandler.HandleException(ex);
            if (newEx != null)
            {
                throw newEx;
            }
        }
        return null;
    }
公共虚拟列表Get(表达式filter=null,Func orderBy=null,int?count=null) { 尝试 { var query=this.DA.Get(); //过滤数据 if(过滤器!=null) { query=query.Where(过滤器); } //排序数据 if(orderBy!=null) { query=orderBy(查询); } if(count.HasValue) { query=query.Take(count.Value); } 返回query.ToList(); } 捕获(例外情况除外) { Exception newEx=ExceptionHandler.HandleException(ex); if(newEx!=null) { 扔掉纽克斯; } } 返回null; }
是否要返回
FormCaption
的不同集合,还是要返回按
FormCaption
分组的
权限
集合?我要返回按FormCaptionOk分组的权限集合在这种情况下,您需要返回类似于
Dictionary
的内容,或者对
权限
的其他属性执行聚合。如果可能,两个属性都可以。非常感谢。现在还不清楚你想在这里实现什么;我可以提供一个解决方案,但我会做出假设。重复值有什么问题?