private static void Setup_SelectByKeyValueArray(SpecialLinqCommand command) { var member = command.Key.ExpandedKeyMembers[0].Member; var listType = typeof(IList <>).MakeGenericType(member.DataType); var listPrm = Expression.Parameter(listType, "@list"); var entType = command.Key.Entity.EntityType; var pred = ExpressionMaker.MakeListContainsPredicate(member, listPrm); var entSet = member.Entity.EntitySetConstant; var entSetFiltered = ExpressionMaker.MakeCallWhere(entSet, pred); var entSetOrdered = ExpressionMaker.AddOrderBy(entSetFiltered, command.OrderBy); command.Lambda = Expression.Lambda(entSetOrdered, listPrm); }
private static void Setup_SelectByValueArrayManyToMany(SpecialLinqCommand command) { var listInfo = command.ListInfoManyToMany; var fkMember = listInfo.ParentRefMember.ReferenceInfo.FromKey.ExpandedKeyMembers[0].Member; var listType = typeof(IList <>).MakeGenericType(fkMember.DataType); var listPrm = Expression.Parameter(listType, "@list"); var entType = listInfo.LinkEntity.EntityType; var wherePred = ExpressionMaker.MakeListContainsPredicate(fkMember, listPrm); var linkEntSet = fkMember.Entity.EntitySetConstant; var entSetFiltered = ExpressionMaker.MakeCallWhere(linkEntSet, wherePred); var targetRefMember = listInfo.OtherEntityRefMember; var entSetOrdered = AddOrderByManyToMany(entSetFiltered, listInfo.LinkEntity, listInfo.OtherEntityRefMember, command.OrderBy); var newTupleLambda = ExpressionMaker.MakeNewLinkTupleLambda(listInfo.OtherEntityRefMember); var selectTuple = ExpressionMaker.MakeCallSelect(entSetOrdered, newTupleLambda); command.Lambda = Expression.Lambda(selectTuple, listPrm); }