Dynamics 365中的关系元数据

时间:2018-05-23 10:42:52

标签: c# dynamics-crm dynamics-365

有没有办法通过C#获取动态crm中的关系描述?

我查看了OnetoManyMetadata对象但无法在任何地方找到它。

1 个答案:

答案 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;