【发布时间】:2014-10-29 02:15:06
【问题描述】:
我在“预验证”中注册了一个 Dynamics 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();
当插件触发的记录为 INACTIVE 时,我在上述查询中收到以下错误:
PreValidateEntity1Delete 插件错误: System.Reflection.TargetInvocationException:已引发异常 通过调用的目标。 ---> System.ArgumentNullException: 值不能为空。参数名称:g
我不确定为什么会出现上述错误,以及非活动子记录和父记录之间的链接是否在 LINQ 查询中损坏或有其他原因。
【问题讨论】:
标签: dynamics-crm-2011 dynamics-crm-2013