zoukankan      html  css  js  c++  java
  • 关于2021/03/02本地服务总线作业调度没起来问题分析

    问题描述:事件查看器报如下错误(显示该C#系统自带字符串方法无法翻译为DB的表达式去查询数据库,实际上是取到数据的):

    “WcfServiceHelper.CreateServerContext
    (C:Program Files (x86)JetSun30BinCore.dll:2021-04-15 16:12:30[Core:2021-04-15 16:12:30])
    LINQ to Entities does not recognize the method 'Boolean IsNullOrWhiteSpace(System.String)' method, and this method cannot be translated into a store expression.(NotSupportedException)
    ---异常堆栈---
    at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.DefaultTranslator.Translate(... ...
    at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.Convert()
    at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
    at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
    at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
    at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
    at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
    at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at JetSun.Infrastructure.ServiceModel.ObjectContext`1.JetSun.Infrastructure.ServiceModel.IDataProvider.GetData(Expression filter, String orderKeys, Int32 maxCount, String[] includePaths)
    at JetSun.Infrastructure.Advanced.WcfServiceHelper.GetDictionary(ServerContext serverContext, Type dtoType, Dbs dbs, Expression filter, Boolean getByClient, DtoDictionary setting)

    后来,将代码由 !string.IsNullOrWhiteSpace(a.FullName) 改为 a.FullName != null && a.FullName.Trim() != string.Empty 正常情况下这个改动确实避免了上面报错的发生;然而如果LAMBDA表达式过于冗长就会发生莫名其妙的问题(估计是超长部分被截断了,但是又没有报错),所以下面代码查询不到数据(dto为null就返回了)导致应该起来的作业调度没有如期启动。

    只好把它改为原来的方式,一切正常(注意 a=>这段表达式不是很长的话,上面改动是正确无误的)

  • 相关阅读:
    mysql limit关键字
    Android入门篇2-activity调用跟数据传递
    Android入门篇1-Hello World
    flask表单提交的两种方式
    ajax异步举例
    Android平台的一些常用命令
    python设计模式1:创建型模式
    python设计模式1:导言
    Python的高级特性12:类的继承
    django复习笔记3:实战
  • 原文地址:https://www.cnblogs.com/chriskwok/p/14665791.html
Copyright © 2011-2022 走看看