码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-09-01 09:57:02      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:retrieve   cond   collect   work   抛出异常   trie   数据   ldb   ice   

                            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应该注意的问题.

标签:retrieve   cond   collect   work   抛出异常   trie   数据   ldb   ice   

原文地址:http://www.cnblogs.com/longdb/p/7461533.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!