Microsoft dynamic sdk中join应该注意的问题.

Posted longdb

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Microsoft dynamic sdk中join应该注意的问题.相关的知识,希望对你有一定的参考价值。

                            QueryExpression queryNextSeq = new QueryExpression { EntityName = "ep_prodoperationsequence" };
                            queryNextSeq.Criteria.AddCondition("ep_prodroutingno", ConditionOperator.Equal, ePOS.ep_ProdRoutingNo.Id);
                            queryNextSeq.Criteria.AddCondition("ep_sequenceno1", ConditionOperator.NotEqual, ePOS.ep_SequenceNo1);
                            queryNextSeq.ColumnSet.AddColumns("ep_prodoperationsequenceid", "ep_sequenceno1", "ep_operationsequence");
                            queryNextSeq.AddOrder("ep_sequenceno1", OrderType.Ascending);

                            queryNextSeq.LinkEntities.Add(new LinkEntity("ep_prodoperationsequence", "ep_operationsequence", "ep_opera                            tionsequence", "ep_operationsequenceid", JoinOperator.Inner));
                            queryNextSeq.LinkEntities[0].Columns.AddColumns("ep_operationsequenceid", "ep_dailywork");//被link实体ep_op                             erationsequence的列
                            queryNextSeq.LinkEntities[0].LinkCriteria.AddCondition("ep_dailywork", ConditionOperator.Equal, true);//给                                     被link实体添加条件

                            EntityCollection ecPrdSeq = service.RetrieveMultiple(queryNextSeq);

 foreach (ep_prodoperationsequence item in ecPrdSeq.Entities)
{
  //取被join实体中的列,字典中必须是实体名称+1,还有就是列数据为null时,要先判断字典中是否包含该键值(就是该列),否则会抛出异常.explain by ldb
  if (item.Attributes.ContainsKey("ep_operationsequence1.ep_dailywork") && item["ep_operationsequence1.ep_dailywork"] != null)
   {
      bool daily  = Convert.ToBeanbool(((AliasedValue)item["ep_operationsequence1.ep_dailywork"]).Value);

   } 
}

 

以上是关于Microsoft dynamic sdk中join应该注意的问题.的主要内容,如果未能解决你的问题,请参考以下文章

Force SDK to create Appointment programmatically in crm 2013 onPremise

从 Microsoft Dynamics CRM 4.0 server迁移到 Microsoft Dynamics CRM 2013 Server

在 Microsoft Dynamics 365 Online中如何调试Plugins in

在Microsoft Dynamic 365/2016环境使用LinqPad查询数据(不使用linqpad Microsoft Dynamic 365 Driver)

Microsoft Dynamics 与 Magnolia 的集成

Microsoft Dynamics CRM OAuth 集成