最近在做一个功能,通过拼接lamdba表达试来实现的功能,但测试时总是出现一个错误,如下图所示,网上也找不到答案,差点都放弃了。。

如上图图所示,我是想通过一个lamdba表达式(上图的IdField属性)来拼接一个新的lamdba表达式(上图的GetById方法中的exp),当然上面只是演示效果,并不是我实际功能的代码。

总是出现异常,我还特意创建另一个lamdba变量exp2,表达式跟exp一样,然后用exp2就不出错,exp跟exp2我比对过,都是一模一样的,真是百思不得其姐。

当然后面我还是解决了,怎么解决呢,如下图

加了一个临时变量,引用IdField属性,然后创建lamdba表达式时用这个临时变量,就不出错了,根据它的报错的翻译,是作用域的问题引用的,具体的我还不懂,先记录下,给同样遇到我这个错误的朋友一点帮助。

variable '' of type '' referenced from scope '', but it is not defined 异常解决方法的更多相关文章

  1. Linq查询条件里有可空字段比较时报错variable '<>h__TransparentIdentifier2' of type referenced from scope '', but it is not defined

    当我运行下面的linq查询时报了这个错,   1: var result = (from so in svcContext.new_sales_orderSet 2: join soitem in s ...

  2. The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法

    Linux下基于JSP的报表集成到项目中后,显示不出来,查看tomcat的日志.有例如以下报错信息: The return type is incompatible with JspSourceDep ...

  3. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 解决方法

    在VS2012中生成时出错:error C4430: missing type specifier - int assumed. Note: C++ does not support default- ...

  4. Type.GetType()在跨程序集反射时返回null的解决方法

    在开发中,经常会遇到这种情况,在程序集A.dll中需要反射程序集B.dll中的类型.如果使用稍有不慎,就会产生运行时错误.例如使用Type.GetType("BNameSpace.Class ...

  5. Dynamics CRM2015 The plug-in type does not exist in the specified assembly问题的解决方法

    在用插件工具PluginProfiler调试时,报"The plug-in type  xxxx  does not exist in the specified assembly" ...

  6. 关于在调用JAVAFX相关包时遇到Access restriction: The type 'Application' is not API (restriction on required library)的解决方法

    点击工具栏的Project->Properties->Java Build Path->Libraries-> 双击第一项 点击Add添加允许javafx 然后就不会报错了

  7. 【java】关于Cannot refer to the non-final local variable list defined in an enclosing scope解决方法

    今天学习中遇到了一个问题: Cannot refer to the non-final local variable list defined in an enclosing scope 这里的new ...

  8. 出现UnboundLocalError: local variable 'a' referenced before assignment异常的情况与解决方法

    出现UnboundLocalError: local variable ‘a’ referenced before assignment异常的情况与解决方法字面意思:局部变量赋值前被引用原因:局部变量 ...

  9. javax.servlet.ServletException cannot be resolved to a type错误解决方法

    在页面中使用全局路径时${pageContext.request.contextPath}出现javax.servlet.ServletException cannot be resolved to ...

随机推荐

  1. 【在 Nervos CKB 上做开发】Nervos CKB 脚本编程简介[3]:自定义代币

    原文作者:Xuejie 原文链接:https://xuejie.space/2019_09_06_introduction_to_ckb_script_programming_udt/ Nervos ...

  2. 挑战10个最难的Java面试题(附答案)【下】

    查看挑战10个最难的Java面试题(附答案)[上] 在本文中,我们将从初学者和高级别进行提问, 这对新手和具有多年 Java 开发经验的高级开发人员同样有益. 关于Java序列化的10个面试问题 大多 ...

  3. Spring MVC中的Controller是Serlvet吗?

    1. Controller不是Servlet DispatcherServler是Spring MVC中的唯一Servlet,(这点可通过查看FrameworkServlet的子类确认) Servle ...

  4. 带你从头到尾捋一遍MySQL索引结构(1)

    从一个简单的表开始 create table user( id int primary key, age int, height int, weight int, name varchar(32) ) ...

  5. 机器学习python*(深度学习)核心技术实战

    Python实战及机器学习(深度学习)技术 一,时间地点:2020年01月08日-11日 北京(机房上课,每人一台电脑进行实际案例操作,赠送 U盘拷贝资料及课件和软件)二.课程目标:1.python基 ...

  6. 学习go第一天-编写第一个go程序

    开发环境构建 GOPATH 在1.8版本前必须设置这个环境变量 1.8以及更高版本如果没有设置,则使用默认值在Mac上GOPATH可以通过修改 -/.bash_profile来设置 程序基本结构 pa ...

  7. [TimLinux] django CentOS7中django+httpd+mod_wsgi中文UnicodeEncodeError错误

    1. 错误 web端访问页面,页面内的view函数要写一个含有中文名字的文件,出现了这个错误.在PyCharm开发调皮环境中不存在这样的错误,把系统部署到http, mod_wsgi时出现. 2. 定 ...

  8. Cesium专栏-大量gltf三维模型加载

    Cesium 是一款面向三维地球和地图的,世界级的JavaScript开源产品.它提供了基于JavaScript语言的开发包,方便用户快速搭建一款零插件的虚拟地球Web应用,并在性能,精度,渲染质量以 ...

  9. POJ3261 Milks patterns(后缀数组)

    Farmer John has noticed that the quality of milk given by his cows varies from day to day. On furthe ...

  10. BZOJ 3107 [cqoi2013]二进制a+b (DP)

    3107: [cqoi2013]二进制a+b Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 995  Solved: 444[Submit][Stat ...