当前位置: 首页>>代码示例>>C#>>正文


C# DbVariableReferenceExpression类代码示例

本文整理汇总了C#中DbVariableReferenceExpression的典型用法代码示例。如果您正苦于以下问题:C# DbVariableReferenceExpression类的具体用法?C# DbVariableReferenceExpression怎么用?C# DbVariableReferenceExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DbVariableReferenceExpression类属于命名空间,在下文中一共展示了DbVariableReferenceExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Visit

        public override Expression Visit(DbVariableReferenceExpression expression)
        {
            string name = expression.VariableName;
            Variable context = this.currentVariables.GetVariable(name);

            return context.Expression;
        }
开发者ID:DeadlyEmbrace,项目名称:effort,代码行数:7,代码来源:TransformVisitor.VariableReference.cs

示例2: DbGroupExpressionBinding

 internal DbGroupExpressionBinding(
     DbExpression input, DbVariableReferenceExpression inputRef, DbVariableReferenceExpression groupRef)
 {
     _expr = input;
     _varRef = inputRef;
     _groupVarRef = groupRef;
 }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:DbGroupExpressionBinding.cs

示例3: DbExpressionBinding

        internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef)
        {
            DebugCheck.NotNull(input);
            DebugCheck.NotNull(varRef);

            _expr = input;
            _varRef = varRef;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:DbExpressionBinding.cs

示例4: DbExpressionBinding

        internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef)
        {
            Debug.Assert(input != null, "DbExpressionBinding input cannot be null");
            Debug.Assert(varRef != null, "DbExpressionBinding variable cannot be null");

            _expr = input;
            _varRef = varRef;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:8,代码来源:DbExpressionBinding.cs

示例5: ReplaceParentVar

        /// <summary>
        ///     Replace existing var at the head of the property chain with the new <paramref name="parentVarRef" />.
        /// </summary>
        internal void ReplaceParentVar(DbVariableReferenceExpression parentVarRef)
        {
            //
            // No parent var adjustment is allowed while adjusted to group var (see AdjustToGroupVar(...) for more info).
            //
            Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null");
            Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null");

            if (_propRefs == null)
            {
                Debug.Assert(_varBasedExpression is DbVariableReferenceExpression, "_varBasedExpression is DbVariableReferenceExpression");
                _varBasedExpression = parentVarRef;
            }
            else
            {
                Debug.Assert(_propRefs.Count > 0, "_propRefs.Count > 0");
                _propRefs.RemoveAt(_propRefs.Count - 1);
                AddParentVar(parentVarRef);
            }
        }
开发者ID:junxy,项目名称:entityframework,代码行数:23,代码来源:SourceScopeEntry.cs

示例6: AddParentVar

        /// <summary>
        ///     Prepend <paramref name="parentVarRef" /> to the property chain.
        /// </summary>
        internal SourceScopeEntry AddParentVar(DbVariableReferenceExpression parentVarRef)
        {
            //
            // No parent var adjustment is allowed while adjusted to group var (see AdjustToGroupVar(...) for more info).
            //
            Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null");
            Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null");

            if (_propRefs == null)
            {
                Debug.Assert(_varBasedExpression is DbVariableReferenceExpression, "_varBasedExpression is DbVariableReferenceExpression");
                _propRefs = new List<string>(2);
                _propRefs.Add(((DbVariableReferenceExpression)_varBasedExpression).VariableName);
            }

            _varBasedExpression = parentVarRef;
            for (var i = _propRefs.Count - 1; i >= 0; --i)
            {
                _varBasedExpression = _varBasedExpression.Property(_propRefs[i]);
            }
            _propRefs.Add(parentVarRef.VariableName);

            return this;
        }
开发者ID:junxy,项目名称:entityframework,代码行数:27,代码来源:SourceScopeEntry.cs

示例7: SourceScopeEntry

 internal SourceScopeEntry(DbVariableReferenceExpression varRef)
     : this(varRef, null)
 {
 }
开发者ID:junxy,项目名称:entityframework,代码行数:4,代码来源:SourceScopeEntry.cs

示例8: RollbackAdjustmentToGroupVar

        /// <summary>
        ///     Rolls back the <see cref="AdjustToGroupVar" />(...) adjustment, clears the <see
        ///      cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" />.
        /// </summary>
        internal void RollbackAdjustmentToGroupVar(DbVariableReferenceExpression pregroupParentVarRef)
        {
            Debug.Assert(_groupVarBasedExpression != null, "_groupVarBasedExpression != null");

            _groupVarBasedExpression = null;
            _groupAggBasedExpression = null;
            ReplaceParentVar(pregroupParentVarRef);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:12,代码来源:SourceScopeEntry.cs

示例9: AdjustToGroupVar

        /// <summary>
        ///     Rebuild the current scope entry expression as the property chain off the <paramref name="parentVarRef" /> expression.
        ///     Also build 
        ///     - <see cref="IGroupExpressionExtendedInfo.GroupVarBasedExpression" /> off the <paramref name="parentGroupVarRef" /> expression;
        ///     - <see cref="IGroupExpressionExtendedInfo.GroupAggBasedExpression" /> off the <paramref name="groupAggRef" /> expression.
        ///     This adjustment is reversable by <see cref="RollbackAdjustmentToGroupVar" />(...).
        /// </summary>
        internal void AdjustToGroupVar(
            DbVariableReferenceExpression parentVarRef, DbVariableReferenceExpression parentGroupVarRef,
            DbVariableReferenceExpression groupAggRef)
        {
            // Adjustment is not reentrant.
            Debug.Assert(_groupVarBasedExpression == null, "_groupVarBasedExpression == null");
            Debug.Assert(_groupAggBasedExpression == null, "_groupAggBasedExpression == null");

            //
            // Let's assume this entry represents variable "x" in the following query:
            //      select x, y, z from {1, 2} as x join {2, 3} as y on x = y join {3, 4} as z on y = z
            // In this case _propRefs contains x._##join0._##join1 and the corresponding input expression looks like this:
            //     |_Input : '_##join1'
            //     | |_InnerJoin
            //     |   |_Left : '_##join0'
            //     |   | |_InnerJoin
            //     |   |   |_Left : 'x'
            //     |   |   |_Right : 'y'
            //     |   |_Right : 'z'
            // When we start processing a group by, like in this query:
            //      select k1, k2, k3 from {1, 2} as x join {2, 3} as y on x = y join {3, 4} as z on y = z group by x as k1, y as k2, z as k3
            // we are switching to the following input expression:
            //     |_Input : '_##geb2', '_##group3'
            //     | |_InnerJoin
            //     |   |_Left : '_##join0'
            //     |   | |_InnerJoin
            //     |   |   |_Left : 'x'
            //     |   |   |_Right : 'y'
            //     |   |_Right : 'z'
            // where _##join1 is replaced by _##geb2 for the regular expression and by _##group3 for the group var based expression.
            // So the switch, or the adjustment, is done by 
            //      a. replacing _##join1 with _##geb2 in _propRefs and rebuilding the regular expression accordingly to get
            //         the following property chain: _##geb2._##join1.x
            //      b. building a group var based expression using _##group3 instead of _##geb2 to get
            //         the following property chain: _##group3._##join1.x
            //

            //
            // Rebuild ScopeEntry.Expression using the new parent var.
            //
            ReplaceParentVar(parentVarRef);

            //
            // Build the GroupVarBasedExpression and GroupAggBasedExpression, 
            // take into account that parentVarRef has already been added to the _propRefs in the AdjustToParentVar(...) call, so ignore it.
            //
            _groupVarBasedExpression = parentGroupVarRef;
            _groupAggBasedExpression = groupAggRef;
            if (_propRefs != null)
            {
                for (var i = _propRefs.Count - 2 /*ignore the parentVarRef*/; i >= 0; --i)
                {
                    _groupVarBasedExpression = _groupVarBasedExpression.Property(_propRefs[i]);
                    _groupAggBasedExpression = _groupAggBasedExpression.Property(_propRefs[i]);
                }
            }
        }
开发者ID:junxy,项目名称:entityframework,代码行数:64,代码来源:SourceScopeEntry.cs

示例10: Visit

 /// <summary>
 ///     Visitor pattern method for <see cref="DbVariableReferenceExpression" />.
 /// </summary>
 /// <param name="expression"> The DbVariableReferenceExpression that is being visited. </param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="expression" />
 ///     is null
 /// </exception>
 public override void Visit(DbVariableReferenceExpression expression)
 {
     // #433613: PreSharp warning 56506: Parameter 'expression' to this public method must be validated: A null-dereference can occur here.
     Check.NotNull(expression, "expression");
 }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:13,代码来源:BasicExpressionVisitor.cs

示例11: Visit

 public override void Visit(DbVariableReferenceExpression expression) { }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:1,代码来源:DbExpressionVisitorTests.cs

示例12: Visit

 public override void Visit(DbVariableReferenceExpression e)
 {
     _key.Append("Var(");
     VisitVariableName(e.VariableName);
     _key.Append(")");
 }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:6,代码来源:ExpressionKeyGen.cs

示例13: Visit

 public override void Visit(DbVariableReferenceExpression expression)
 {
     Contract.Requires(expression != null);
 }
开发者ID:junxy,项目名称:entityframework,代码行数:4,代码来源:DbExpressionVisitor.cs

示例14: CreateVariables

        private static DbVariableReferenceExpression[] CreateVariables(MethodInfo lambdaMethod, params TypeUsage[] argumentTypes)
        {
            Debug.Assert(lambdaMethod != null, "Lambda function method must not be null");
            var paramNames = DbExpressionBuilder.ExtractAliases(lambdaMethod);

            Debug.Assert(paramNames.Length == argumentTypes.Length, "Lambda function method parameter count does not match argument count");
            var result = new DbVariableReferenceExpression[argumentTypes.Length];
            for (var idx = 0; idx < paramNames.Length; idx++)
            {
                Debug.Assert(argumentTypes[idx] != null, "DbLambda.Create allowed null type argument");
                result[idx] = argumentTypes[idx].Variable(paramNames[idx]);
            }
            return result;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:14,代码来源:DbLambda.cs

示例15: Visit

 public override void Visit(DbVariableReferenceExpression e)
 {
     Dictionary<string, object> attrs = new Dictionary<string, object>();
     attrs.Add("VariableName", e.VariableName);
     Begin(e, attrs);
     End(e);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ExpressionDumper.cs


注:本文中的DbVariableReferenceExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。