我有一個在「預驗證」中註冊的Dynamics CRM插件並在刪除時觸發。 我在裏面有一個LINQ查詢,它檢索特定父記錄的子記錄的日期字段的最大值。動態CRM插件 - 預先驗證中的LINQ查詢
這裏是我的代碼:
var q = (from e1 in serviceContext.CreateQuery<entity1>()
join e2 in serviceContext.CreateQuery<entity2>() on e1.typeid.Id equals e2.codeId
where e1.statecode == 0 && e1.ParentId.Id.Equals(new Guid(ParentGuidStr))
orderby e1.dt descending
select new {e1.dt, e2.code}).ToList();
我收到上述查詢以下錯誤,當該插件觸發上的記錄是無效的:
PreValidateEntity1Delete PlugIn Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null. Parameter name: g
我不知道爲什麼我我正在獲取上述錯誤,並且如果LINQ查詢中存在非活動子記錄和父記錄之間的鏈接,或者存在其他原因。