本文整理汇总了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;
}
示例2: DbGroupExpressionBinding
internal DbGroupExpressionBinding(
DbExpression input, DbVariableReferenceExpression inputRef, DbVariableReferenceExpression groupRef)
{
_expr = input;
_varRef = inputRef;
_groupVarRef = groupRef;
}
示例3: DbExpressionBinding
internal DbExpressionBinding(DbExpression input, DbVariableReferenceExpression varRef)
{
DebugCheck.NotNull(input);
DebugCheck.NotNull(varRef);
_expr = input;
_varRef = varRef;
}
示例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;
}
示例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);
}
}
示例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;
}
示例7: SourceScopeEntry
internal SourceScopeEntry(DbVariableReferenceExpression varRef)
: this(varRef, null)
{
}
示例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);
}
示例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]);
}
}
}
示例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");
}
示例11: Visit
public override void Visit(DbVariableReferenceExpression expression) { }
示例12: Visit
public override void Visit(DbVariableReferenceExpression e)
{
_key.Append("Var(");
VisitVariableName(e.VariableName);
_key.Append(")");
}
示例13: Visit
public override void Visit(DbVariableReferenceExpression expression)
{
Contract.Requires(expression != null);
}
示例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;
}
示例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);
}