本文整理汇总了C#中System.Linq.Expressions.TypeBinaryExpression类的典型用法代码示例。如果您正苦于以下问题:C# TypeBinaryExpression类的具体用法?C# TypeBinaryExpression怎么用?C# TypeBinaryExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeBinaryExpression类属于System.Linq.Expressions命名空间,在下文中一共展示了TypeBinaryExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypeEqual
internal static TypeEqual TypeEqual(TypeBinaryExpression expression)
{
return new TypeEqual()
{
Expression = Serialize(expression.Expression),
TypeOperand = TypeRef.Serialize(expression.TypeOperand),
}.Apply(n => n.Type = TypeRef.Serialize(expression.Type));
}
示例2: SerializableTypeBinaryExpression
/// <summary>
/// Constructor with an <see cref="TypeBinaryExpression"/> and an <see cref="ExpressionConverter"/>.
/// </summary>
/// <param name="expression">The original, not serializable <see cref="Expression"/>.</param>
/// <param name="expConverter">The <see cref="ExpressionConverter"/> to convert contained <see cref="Expression">Expressions</see>.</param>
public SerializableTypeBinaryExpression(TypeBinaryExpression expression, ExpressionConverter expConverter)
: base(expression, expConverter)
{
Expression = expression.Expression.MakeSerializable(expConverter);
#if !NETFX_CORE
TypeOperand = InterLinqTypeSystem.Instance.GetInterLinqVersionOf<InterLinqType>(expression.TypeOperand);
#else
TypeOperand = InterLinqTypeSystem.Instance.GetInterLinqVersionOf<InterLinqType>(expression.TypeOperand.GetTypeInfo());
#endif
}
示例3: ParseExpression
static Node ParseExpression(TypeBinaryExpression e)
{
switch (e.NodeType)
{
case ExpressionType.TypeIs:
return new BinaryNode
{
Left = Parse(e.Expression),
Operator = "is",
Right = new ConstantNode() { Text = NameOfType(e.TypeOperand) },
Value = GetValue(e)
};
default:
throw new NotImplementedException(string.Format(CultureInfo.CurrentCulture,
"Can't handle TypeBinaryExpression of type {0}",
e.NodeType));
}
}
示例4: VisitTypeIs
protected virtual System.Linq.Expressions.Expression VisitTypeIs(TypeBinaryExpression b)
{
System.Linq.Expressions.Expression expr = Visit(b.Expression);
if(expr != b.Expression)
{
return System.Linq.Expressions.Expression.TypeIs(expr, b.TypeOperand);
}
return b;
}
示例5: VisitTypeBinary
/// <summary>
/// Visits a TypeBinaryExpression.
/// </summary>
/// <param name="node">The TypeBinaryExpression.</param>
/// <returns>The TypeBinaryExpression.</returns>
protected override Expression VisitTypeBinary(TypeBinaryExpression node)
{
throw new NotImplementedException();
}
示例6: TypeBinaryExpressionMutator
public TypeBinaryExpressionMutator(TypeBinaryExpression expression)
{
TypeBinaryExpression = expression;
}
示例7: VisitTypeBinary
private static string VisitTypeBinary(TypeBinaryExpression node)
{
throw new NotImplementedException();
}
示例8: UpdateTypeIs
protected TypeBinaryExpression UpdateTypeIs(TypeBinaryExpression binary, Expression expression, Type typeOperand)
{
if (expression != binary.Expression || typeOperand != binary.TypeOperand)
{
return Expression.TypeIs(expression, typeOperand);
}
return binary;
}
示例9: VisitTypeIs
/// <summary>
/// Serializes an TypeBinaryExpression to a string
/// </summary>
/// <param name="b">TypeBinaryExpression to serialize</param>
/// <returns>serialized expression</returns>
internal override Expression VisitTypeIs(TypeBinaryExpression b)
{
this.builder.Append(UriHelper.ISOF);
this.builder.Append(UriHelper.LEFTPAREN);
if (!this.IsImplicitInputReference(b.Expression))
{
this.Visit(b.Expression);
this.builder.Append(UriHelper.COMMA);
this.builder.Append(UriHelper.SPACE);
}
this.builder.Append(UriHelper.QUOTE);
this.builder.Append(UriHelper.GetTypeNameForUri(b.TypeOperand, this.context));
this.builder.Append(UriHelper.QUOTE);
this.builder.Append(UriHelper.RIGHTPAREN);
return b;
}
示例10: VisitTypeBinaryExpression
protected override Expression VisitTypeBinaryExpression(TypeBinaryExpression expression)
{
return expression;
}
示例11: BuildTypeIsQuery
private IMongoQuery BuildTypeIsQuery(TypeBinaryExpression typeBinaryExpression)
{
var nominalType = typeBinaryExpression.Expression.Type;
var actualType = typeBinaryExpression.TypeOperand;
var discriminatorConvention = BsonSerializer.LookupDiscriminatorConvention(nominalType);
var discriminator = discriminatorConvention.GetDiscriminator(nominalType, actualType);
if (discriminator == null)
{
return new QueryDocument(); // matches everything
}
if (discriminator.IsBsonArray)
{
discriminator = discriminator.AsBsonArray[discriminator.AsBsonArray.Count - 1];
}
return Query.EQ(discriminatorConvention.ElementName, discriminator);
}
示例12: VisitTypeIs
internal override Expression VisitTypeIs(TypeBinaryExpression b)
{
if (ClientType.CheckElementTypeIsEntity(b.Expression.Type) || IsCollectionProducingExpression(b.Expression))
{
throw new NotSupportedException(Strings.ALinq_ExpressionNotSupportedInProjection(this.type, b.ToString()));
}
return base.VisitTypeIs(b);
}
示例13: VisitTypeBinary
/// <summary>
/// Visits a TypeBinaryExpression.
/// </summary>
/// <param name="node">The TypeBinaryExpression.</param>
/// <returns>The TypeBinaryExpression.</returns>
protected override Expression VisitTypeBinary(TypeBinaryExpression node)
{
_sb.Append("<TypeBinaryExpression>");
return node;
}
示例14: VisitTypeBinary
protected override Expression VisitTypeBinary(TypeBinaryExpression b)
{
var f = GetField(b.Expression);
FieldReference fr = f as FieldReference;
if (fr != null)
{
if (b.TypeOperand.IsAssignableFrom(fr.FieldType))
{
sb.Append(fr.Name.SqlEscape() + " IS NOT NULL");
}
else
throw new InvalidOperationException("A {0} will never be {1}".FormatWith(fr.FieldType.TypeName(), b.TypeOperand.TypeName()));
return b;
}
FieldImplementedBy fib = f as FieldImplementedBy;
if (fib != null)
{
var imp = fib.ImplementationColumns.Where(kvp => b.TypeOperand.IsAssignableFrom(kvp.Key));
if (imp.Any())
sb.Append(imp.ToString(kvp => kvp.Value.Name.SqlEscape() + " IS NOT NULL", " OR "));
else
throw new InvalidOperationException("No implementation ({0}) will never be {1}".FormatWith(fib.ImplementationColumns.Keys.ToString(t=>t.TypeName(), ", "), b.TypeOperand.TypeName()));
return b;
}
throw new NotSupportedException("'is' only works with ImplementedBy or Reference fields");
}
示例15: CompareTypeIs
protected virtual bool CompareTypeIs(TypeBinaryExpression a, TypeBinaryExpression b)
{
return a.TypeOperand == b.TypeOperand
&& this.Compare(a.Expression, b.Expression);
}