XrmServiceContext xrmSvc = null;
xrmSvc = new XrmServiceContext("http://mycrmwebdev/CRMDev")
Connection cnctn = xrmSvc.ConnectionSet.Where(c => c.ConnectionId == "3D2BC21F-6D8F-E211-9F0F-1CC1DE248972").First();
if (cnctn != null) {
CrmEntityReference rec1RoleId = new CrmEntityReference {
LogicalName = ConnectionRole.EntityLogicalName,
Name = "Record1RoleId",
Id = new Guid("B818399C-E766-E111-A1B1-00155D0A6B13")
};
CrmEntityReference rec2RoleId = new CrmEntityReference {
LogicalName = ConnectionRole.EntityLogicalName,
Name = "Record2RoleId",
Id = new Guid("B818399C-E766-E111-A1B1-00155D0A6B13")
};
cnctn.Record1RoleId = rec1RoleId;
cnctn.Record2RoleId = rec2RoleId;
xrmSvc.UpdateObject(cnctn);
//Error occurs here
xrmSvc.SaveChanges();
}
当我尝试保存时,出现错误“连接角色不相关”。我没有看到太多关于这个错误的信息。有任何想法吗?