CRM 插件奇怪的报错

CRM插件,数据库方式注册。报错

找不到方法:“Void Microsoft.Xrm.Sdk.Entity..ctor(System.String, System.Guid)”。

这个错误让人摸不着头脑到底是那里错了,经过一行一行调试,发现要使用如下构造函数,不管代码执行不执行就会报这个错误

   var myEntity = (EntityReference)context.InputParameters["EntityMoniker"]; 

target = new Entity(myEntity.LogicalName, myEntity.Id);

改成如下则不报错

   var myEntity = (EntityReference)context.InputParameters["EntityMoniker"];

 target = new Entity();
target.Id = myEntity.Id;
 target.LogicalName = myEntity.LogicalName;

原文地址:https://www.cnblogs.com/hellohongfu/p/6567830.html