我想了解实体引用的使用(在crm 2011中)我在网上找到许多实体引用的例子,主要是查找字段,但我需要一个absoulte descreption。实体引用仅用于查找字段的使用情况吗?我可以使用简单的实体来获取我的数据吗?实体可以替换实体引用吗? 我的问题不仅是关于entityreference和entity之间的区别,还关于entityreference的定义以及为什么/在哪里使用它。 有人可以请这个问题清楚。什么是实体参考定义
-2
A
回答
7
动态CRM开发记录被称为实体,由属性组成。当属性是查找(即对另一个实体的引用)时,它属于EntityReference
类型。 EntityReference
类型是必需的,因为它必须传达实体的逻辑名称和特定记录的id
(一个Guid
)。
IOrganizationService service = GetService(); //TODO: Implement GetService()
//From: https://msdn.microsoft.com/en-us/library/gg328149.aspx
Entity contact = new Entity("contact");
contact.Attributes["firstname"] = "ContactFirstName";
contact.Attributes["lastname"] = "ContactLastName";
Guid contactId = service.Create(contact);
Entity account = new Entity("account");
account["name"] = "Test Account1";
EntityReference primaryContactId = new EntityReference("contact", contactId);
account["primarycontactid"] = primaryContactId;
一个Entity
对象不能被用作EntityReference
因为类型不同。 Entity
有一个方法返回EntityReference
,Entity.ToEntityReference()
。
重要
有关EntityReference
关键的东西是,它同时包含逻辑名称和记录的ID。
Dynamics CRM中有几个区域,例如使用Customer数据类型时,Lookup可能引用多个实体类型。在这些情况下,Dynamics CRM无法仅依靠Guid
作为记录标识符。
相关问题
- 1. 为什么NHibernate更新参考实体?
- 2. 什么时候是参考Rvalue参考?
- 3. “System.Data.Entity.Infrastructure”的参考是什么?
- 4. 什么是悬挂参考?
- 5. 什么是JPA参考
- 6. WebServiceSecurity参考。它是什么?
- 7. 什么是跟踪参考?
- 8. jQuery的$是什么。参考?
- 9. 什么是参考指针?
- 10. 为什么总是说“未定义的参考”?
- 11. 是什么意思定义引用作为另一参考
- 12. 什么是WPF自定义控件的最佳参考资料
- 13. 什么是未定义参考`的WinMain @ 16
- 14. 在Doctrine 2中定义实体的最佳实践是什么
- 15. 为什么没有JournalEntry实体参考更新正确?
- 16. 为什么EF需要实体的ID以及参考
- 17. XML字符实体参考
- 18. 自我参考实体
- 19. 实体参考和视图:如何实现“参考实体”关系
- 20. 未定义参考
- 21. 未定义参考
- 22. 未定义参考
- 23. 未定义参考
- 24. 未定义参考
- 25. 未定义参考
- 26. 未定义参考
- 27. 实体集和实体之间有什么区别?这是定义标准吗?
- 28. 什么是实体框架相当于NHibernate的参考(x => x.ResidenceCountry).Column(“ResidingInCountryId”)?
- 29. arguments_参考什么?
- 30. 实体框架'密钥未定义',当它明确是什么?
[Convert EntityReference to Entity](https://stackoverflow.com/questions/15277597/convert-entityreference-to-entity) –
@ArunVinoth在发布我的问题之前,我看到了答案,它不是清楚,我不认为我的问题是重复的。 – Damkulul