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=>这段表达式不是很长的话,上面改动是正确无误的)

  • 相关阅读:
    HDU 2955 Robberies(01背包)
    HDU 2602 Bone Collector(01背包)
    HUST 1352 Repetitions of Substrings(字符串)
    HUST 1358 Uiwurerirexb jeqvad(模拟解密)
    HUST 1404 Hamming Distance(字符串)
    HDU 4520 小Q系列故事――最佳裁判(STL)
    HDU 2058 The sum problem(枚举)
    【破解】修改程序版权、添加弹窗
    HDU 1407 测试你是否和LTC水平一样高(枚举)
    HDU 1050 Moving Tables(贪心)
  • 原文地址:https://www.cnblogs.com/chriskwok/p/14665791.html
Copyright © 2011-2022 走看看