当前位置: 首页>>代码示例>>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;未经允许,请勿转载。