CRM 2011 ActivityPointer Earlybound 类型生成不正确?
我尝试在 CRM 2011 中运行此查询:
var activity = (from a in crmService.ActivityPointerSet
where a.StateCode == ActivityPointerState.Open &&
a.ActivityTypeCode == "4201"
select a).First();
但出现此错误:
Microsoft.Crm.Metadata.EntityMetadataNotFoundException: The entity with a name = '4201' was not found in the MetadataCache
检查 FilteredActivityPointer 数据库视图后,我注意到该列被定义为 int,而不是字符串。我手动编辑了生成的类,将属性上的字符串更改为 int,并且效果很好。
早期绑定类型生成器 (CrmSvcUtil.exe) 中是否存在错误,或者我是否以某种方式创建了错误的它?
编辑:经过更多测试后,ActivityTypeCode 似乎需要字符串“appointment”。不知道为什么它在数据库中显示不同......
I tried running this Query in CRM 2011:
var activity = (from a in crmService.ActivityPointerSet
where a.StateCode == ActivityPointerState.Open &&
a.ActivityTypeCode == "4201"
select a).First();
But I got this error:
Microsoft.Crm.Metadata.EntityMetadataNotFoundException: The entity with a name = '4201' was not found in the MetadataCache
After checking with the FilteredActivityPointer database view, I noticed that that column was defined as an int, not a string. I manually edited the generated class, changing the string to an int on the property, and it worked just fine.
Is there a bug in the early bound type generator (CrmSvcUtil.exe), or did I somehow create it wrong?
EDIT: After some more testing, it looks like the ActivityTypeCode is expecting the string "appointment". Don't know why it's showing differently in the database though...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想他们这样做是因为 ObjectTypeCodes 不能保证在不同的部署中是相同的(如果您有多个部署)。
通过使用“任务”、“约会”或“电子邮件”等,不会产生歧义。
我同意这看起来有点奇怪!
I would imagine they have done this as ObjectTypeCodes are not guaranteed to be the same across different deployments (if you have more than one).
By using 'task', 'appointment' or 'email' (etc) there is no ambiguity.
I agree it seems a bit strange though!