Here are the examples of the csharp api class System.Data.Common.CommandTrees.DbExpression.IsOf(System.Data.Metadata.Edm.TypeUsage) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

1. Example

Project: referencesource
Source File: Translator.cs
View license
protected override DbExpression TypedTranslate(ExpressionConverter parent, TypeBinaryExpression linq)
                DbExpression operand = parent.TranslateExpression(linq.Expression);
                TypeUsage fromType = operand.ResultType;
                TypeUsage toType = parent.GetIsOrAsTargetType(fromType, ExpressionType.TypeIs, linq.TypeOperand, linq.Expression.Type);
                return operand.IsOf(toType);

2. Example

Project: referencesource
Source File: CTreeGenerator.cs
View license
public override DbExpression Visit(IsOfOp op, Node n)
            // Direct conversion to DbIsOfExpression (with DbExpressionKind.IsOf) with the same Type and converted argument DbExpression
            if (op.IsOfOnly)
                return VisitChild(n, 0).IsOfOnly(op.IsOfType);
                return VisitChild(n, 0).IsOf(op.IsOfType);

3. Example

Project: referencesource
Source File: ITreeGenerator.cs
View license
private DbFilterExpression CreateIsOfFilterExpression(DbExpression input, IsOfFilter typeFilter)
            // Create a filter expression based on the IsOf/IsOfOnly operations specified by typeFilter
            DbExpressionBinding resultBinding = input.Bind();
            List<DbExpression> predicates = new List<DbExpression>(
                typeFilter.ToEnumerable().Select(tf => tf.Value ? resultBinding.Variable.IsOfOnly(tf.Key) : resultBinding.Variable.IsOf(tf.Key)).ToList()
            DbExpression predicate = Helpers.BuildBalancedTreeInPlace(predicates, (left, right) => left.And(right));
            DbFilterExpression result = resultBinding.Filter(predicate);

            // Track the fact that this IsOfFilter was created by the ITreeGenerator itself and should
            // simply be converted to an ITree Node when it is encountered again by the visitor pass.
            return result;

4. Example

Project: referencesource
Source File: OrderByLifter.cs
View license
internal virtual DbExpression OfType(TypeUsage type)
                    // s.OfType<T> is normally translated to s.Filter(e => e is T).Project(e => e as T)
                    DbExpressionBinding rootBinding = _root.BindAs(_aliasGenerator.Next());
                    DbExpression filter = this.Filter(rootBinding.Filter(rootBinding.Variable.IsOf(type)));
                    OrderByLifterBase filterLifter = GetLifter(filter, _aliasGenerator);
                    DbExpressionBinding filterBinding = filter.BindAs(_aliasGenerator.Next());
                    DbExpression project = filterLifter.Project(filterBinding.Project(filterBinding.Variable.TreatAs(type)));
                    return project;

5. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
View license
private static Dictionary<AST.BuiltInKind, BuiltInExprConverter> CreateBuiltInExprConverter()
/n ..... /n //View Source file for more details /n }