我想了解實體引用的使用(在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