コード例 #1
0
        public static IEnumerable <Order> BoundFunction(Db.OeBoundFunctionParameter <Customer, Order> boundParameter, IEnumerable <String> orderNames)
        {
            OrderContext orderContext = boundParameter.CreateDataContext <OrderContext>();

            IQueryable <Customer> customers = boundParameter.ApplyFilter(orderContext.Customers, orderContext);
            IQueryable <Order>    orders    = customers.SelectMany(c => c.Orders).Where(o => orderNames.Contains(o.Name));
            IQueryable            result    = boundParameter.ApplySelect(orders, orderContext);
            List <Order>          orderList = boundParameter.Materialize(result).ToList().GetAwaiter().GetResult();

            boundParameter.CloseDataContext(orderContext);
            return(orderList);
        }
コード例 #2
0
ファイル: Order.cs プロジェクト: voronov-maxim/OdataToEntity
        public static IEnumerable <Order> BoundFunction(Db.OeBoundFunctionParameter <Customer, Order> boundParameter, IEnumerable <String> orderNames)
        {
            using (var orderContext = new OdataToEntityDB())
            {
                IQueryable <Customer> customers = boundParameter.ApplyFilter(orderContext.Customers, orderContext);
                IQueryable <Order>    orders    = customers.SelectMany(c => c.Orders).Where(o => orderNames.Contains(o.Name));

                IQueryable   result    = boundParameter.ApplySelect(orders, orderContext);
                List <Order> orderList = boundParameter.Materialize(result).ToListAsync().GetAwaiter().GetResult();
                return(orderList);
            }
        }