1. 程式人生 > >Microsoft dynamic sdk中join應該註意的問題.

Microsoft dynamic sdk中join應該註意的問題.

per order 問題 bean lec note exp amp collect

                            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應該註意的問題.