有没有办法通过C#获取动态crm中的关系描述?
我查看了OnetoManyMetadata对象但无法在任何地方找到它。
答案 0 :(得分:1)
https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.messages.retrieveentityrequest.aspx
var cl = new CrmServiceClient(...);
var q = new RetrieveEntityRequest {
EntityFilters = EntityFilters.Relationships,
LogicalName = "..."
};
var r = (cl.Execute(q) as RetrieveEntityResponse).EntityMetadata;
var OtM = r.OneToManyRelationships;
var MtM = r.ManyToManyRelationships;
var MtO = r.ManyToOneRelationships;