System.Data.Common.CommandTrees.DbExpression.IsOfOnly(System.Data.Metadata.Edm.TypeUsage)

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

4 Examples 7

1. Example

Project: referencesource
Source File: TypeRestriction.cs
internal override DbExpression AsCqt(DbExpression row, bool skipIsNotNull)
        {
            DbExpression cqt = this.RestrictedMemberSlot.MemberPath.AsCqt(row);

            if (Helper.IsRefType(this.RestrictedMemberSlot.MemberPath.EdmType))
            {
                cqt = cqt.Deref();
            }

            if (this.Domain.Count == 1)
            {
                // Single value
                cqt = cqt.IsOfOnly(TypeUsage.Create(((TypeConstant)this.Domain.Values.Single()).EdmType));
            }
            else
            {
                // Multiple values: build list of var IsOnOnly(t1), var = IsOnOnly(t1), ..., then OR them all.
                List<DbExpression> operands = this.Domain.Values.Select(t => (DbExpression)cqt.IsOfOnly(TypeUsage.Create(((TypeConstant)t).EdmType))).ToList();
                cqt = Helpers.BuildBalancedTreeInPlace(operands, (prev, next) => prev.Or(next));
            }

            return cqt;
        }

2. Example

Project: referencesource
Source File: CTreeGenerator.cs
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);
            else
                return VisitChild(n, 0).IsOf(op.IsOfType);
        }

3. Example

Project: referencesource
Source File: ITreeGenerator.cs
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.
            _processedIsOfFilters.Add(result);
            return result;
        }

4. Example

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