當前位置: 首頁>>代碼示例>>C#>>正文


C# Expression.QueryableSelect方法代碼示例

本文整理匯總了C#中System.Linq.Expressions.Expression.QueryableSelect方法的典型用法代碼示例。如果您正苦於以下問題:C# Expression.QueryableSelect方法的具體用法?C# Expression.QueryableSelect怎麽用?C# Expression.QueryableSelect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Linq.Expressions.Expression的用法示例。


在下文中一共展示了Expression.QueryableSelect方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SelectOpenProperty

 private static Expression SelectOpenProperty(Expression queryExpression, string propertyName)
 {
     ParameterExpression expression = Expression.Parameter(queryExpression.ElementType(), "element");
     LambdaExpression selector = Expression.Lambda(Expression.Call(null, OpenTypeMethods.GetValueOpenPropertyMethodInfo, expression, Expression.Constant(propertyName)), new ParameterExpression[] { expression });
     return queryExpression.QueryableSelect(selector);
 }
開發者ID:nickchal,項目名稱:pash,代碼行數:6,代碼來源:RequestUriProcessor.cs

示例2: SelectLateBoundProperty

 private static Expression SelectLateBoundProperty(Expression queryExpression, ResourceProperty property)
 {
     ParameterExpression expression = Expression.Parameter(queryExpression.ElementType(), "element");
     LambdaExpression selector = Expression.Lambda(Expression.Convert(Expression.Call(null, DataServiceProviderMethods.GetValueMethodInfo, expression, Expression.Constant(property)), property.Type), new ParameterExpression[] { expression });
     return queryExpression.QueryableSelect(selector);
 }
開發者ID:nickchal,項目名稱:pash,代碼行數:6,代碼來源:RequestUriProcessor.cs

示例3: SelectElement

 private static Expression SelectElement(Expression queryExpression, ResourceProperty property)
 {
     ParameterExpression expression = Expression.Parameter(queryExpression.ElementType(), "element");
     Expression expression2 = Expression.Property(expression, property.Name);
     if ((property.TypeKind == ResourceTypeKind.Collection) && (expression2.Type != property.Type))
     {
         expression2 = Expression.Convert(expression2, property.Type);
     }
     LambdaExpression selector = Expression.Lambda(expression2, new ParameterExpression[] { expression });
     return queryExpression.QueryableSelect(selector);
 }
開發者ID:nickchal,項目名稱:pash,代碼行數:11,代碼來源:RequestUriProcessor.cs

示例4: SelectLateBoundProperty

        private static Expression SelectLateBoundProperty(Expression queryExpression, ResourceProperty property)
        {
            Debug.Assert(queryExpression != null, "queryExpression != null");
            Debug.Assert(property != null && !property.CanReflectOnInstanceTypeProperty, "property != null && !property.CanReflectOnInstanceTypeProperty");

            ParameterExpression parameter = Expression.Parameter(queryExpression.ElementType(), "element");
            Expression body = Expression.Call(null /*instance*/, DataServiceProviderMethods.GetValueMethodInfo, parameter, Expression.Constant(property));
            body = Expression.Convert(body, property.Type);
            LambdaExpression selector = Expression.Lambda(body, parameter);
            return queryExpression.QueryableSelect(selector);
        }
開發者ID:AlineGuan,項目名稱:odata.net,代碼行數:11,代碼來源:RequestUriProcessor.cs

示例5: SelectOpenProperty

        private static Expression SelectOpenProperty(Expression queryExpression, string propertyName)
        {
            Debug.Assert(queryExpression != null, "queryExpression != null");
            Debug.Assert(propertyName != null, "propertyName != null");

            ParameterExpression parameter = Expression.Parameter(queryExpression.ElementType(), "element");
            Expression body = Expression.Call(null /* instance */, OpenTypeMethods.GetValueOpenPropertyMethodInfo, parameter, Expression.Constant(propertyName));
            LambdaExpression selector = Expression.Lambda(body, parameter);
            return queryExpression.QueryableSelect(selector);
        }
開發者ID:AlineGuan,項目名稱:odata.net,代碼行數:10,代碼來源:RequestUriProcessor.cs

示例6: SelectElement

        private static Expression SelectElement(Expression queryExpression, ResourceProperty property)
        {
            Debug.Assert(queryExpression != null, "queryExpression != null");
            Debug.Assert(property.Kind != ResourcePropertyKind.ResourceSetReference, "property != ResourcePropertyKind.ResourceSetReference");

            ParameterExpression parameter = Expression.Parameter(queryExpression.ElementType(), "element");
            Expression body = Expression.Property(parameter, property.Name);

            // If the property is a collection its instance type is always IEnumerable<T>, but the actual type of the property
            //   might be type a type implementing the IEnumerable<T> (Like List<T>). We need to add an explicit cast here
            //   so that our expression types match and we will be able to call the lambda later.
            if (property.TypeKind == ResourceTypeKind.Collection && body.Type != property.Type)
            {
                body = Expression.Convert(body, property.Type);
            }

            LambdaExpression selector = Expression.Lambda(body, parameter);
            return queryExpression.QueryableSelect(selector);
        }
開發者ID:AlineGuan,項目名稱:odata.net,代碼行數:19,代碼來源:RequestUriProcessor.cs


注:本文中的System.Linq.Expressions.Expression.QueryableSelect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。