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


C# Expression.ChangeOperands方法代碼示例

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


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

示例1: AnalyzeOperands

 protected virtual Expression AnalyzeOperands(Expression expression, TranslationContext context)
 {
     var operands = expression.GetOperands().ToList();
       var newOperands = new List<Expression>();
       for (int operandIndex = 0; operandIndex < operands.Count; operandIndex++)
       {
       var op = operands[operandIndex];
       var newOp = Analyze(op, context);
       newOperands.Add(newOp);
       }
       return expression.ChangeOperands(newOperands, operands);
 }
開發者ID:yuanfei05,項目名稱:vita,代碼行數:12,代碼來源:ExpressionTranslator_Analyzer.cs

示例2: CutOutOperands

 /// <summary>
 /// Cuts tiers in CLR / SQL.
 /// The search for cut is top-down
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="dataRecordParameter"></param>
 /// <param name="mappingContextParameter"></param>
 /// <param name="builderContext"></param>
 /// <returns></returns>
 protected virtual Expression CutOutOperands(Expression expression,
                                             ParameterExpression dataRecordParameter, ParameterExpression mappingContextParameter,
                                             BuilderContext builderContext)
 {
     // two options: we cut and return
     if (GetCutOutOperand(expression, builderContext))
     {
         // "cutting out" means we replace the current expression by a SQL result reader
         // before cutting out, we check that we're not cutting a table
         // in this case, we convert it into its declared columns
         if (expression is TableExpression)
         {
             return GetOutputTableReader((TableExpression)expression, dataRecordParameter,
                                         mappingContextParameter, builderContext);
         }
         // for EntitySets, we have a special EntitySet builder
         if (expression is EntitySetExpression)
         {
             return GetEntitySetBuilder((EntitySetExpression) expression, dataRecordParameter,
                                        mappingContextParameter, builderContext);
             // TODO record EntitySet information, so we can initalize it with owner
         }
         // then, the result is registered
         return GetOutputValueReader(expression, dataRecordParameter, mappingContextParameter, builderContext);
     }
     // or we dig down
     var operands = new List<Expression>();
     foreach (var operand in expression.GetOperands())
     {
         operands.Add(operand == null 
             ? null
             : CutOutOperands(operand, dataRecordParameter, mappingContextParameter, builderContext));
     }
     return expression.ChangeOperands(operands);
 }
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:44,代碼來源:ExpressionDispatcher.cs

示例3: CutOutSqlTier

 protected virtual Expression CutOutSqlTier(Expression expression,
     ParameterExpression dataRecordParameter, ParameterExpression sessionParameter,
     Type expectedType,
     TranslationContext context)
 {
     expectedType = expectedType ?? expression.Type;
     // two options: we cut and return
     if (IsSqlTier(expression, context))
     {
         // "cutting out" means we replace the current expression by a SQL result reader
         // before cutting out, we check that we're not cutting a table in this case, we convert it into its declared columns
         if (expression is TableExpression)
           // RI: entity reader comes here
           return GetOutputTableReader((TableExpression)expression, dataRecordParameter,
                                         sessionParameter, context);
         // RI: single-value result goes here
         return GetOutputValueReader(expression, expectedType, dataRecordParameter, sessionParameter, context);
     }
     // RI: Anon types, custom types go here
     var newOperands = new List<Expression>();
     var operands = expression.GetOperands();
     var argTypes = expression.GetArgumentTypes();
     for(int i = 0; i < operands.Count; i++ ) {
       var op = operands[i];
       var newOp = op == null ? null : CutOutSqlTier(op, dataRecordParameter, sessionParameter, argTypes[i], context);
       newOperands.Add(newOp);
     }
     Expression newExpr;
     if (expression is MetaTableExpression)
       //Joins go here
       newExpr = ((MetaTableExpression)expression).ConvertToNew(newOperands);
     else
       newExpr =  expression.ChangeOperands(newOperands, operands);
     return newExpr;
 }
開發者ID:yuanfei05,項目名稱:vita,代碼行數:35,代碼來源:ExpressionTranslator.cs


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