System.Data.Common.CommandTrees.DbExpression.Not()

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

16 Examples 7

1. Example

View license
protected override DbExpression NotExprAsCql(DomainNotExpr expression)
            {
                DbExpression cqt = expression.Child.Accept(this);
                return cqt.Not();
            }

2. Example

Project: referencesource
Source File: Translator.cs
View license
protected override DbExpression TypedTranslate(ExpressionConverter parent, System.Linq.Expressions.UnaryExpression linq)
            {
                DbExpression operand = parent.TranslateExpression(linq.Operand);
                if (TypeSemantics.IsBooleanType(operand.ResultType))
                {
                    return operand.Not();
                }
                return parent.CreateCanonicalFunction(ExpressionConverter.BitwiseNot, linq, operand);
            }

3. Example

View license
protected override CqtExpression TranslateUnary(ExpressionConverter parent, CqtExpression operand,
                    MethodCallExpression call)
                {
                    // "Any" is equivalent to "exists".
                    return operand.IsEmpty().Not();
                }

4. Example

Project: referencesource
Source File: NegatedConstant.cs
View license
internal DbExpression AsCqt(DbExpression row, IEnumerable<Constant> constants, MemberPath outputMember, bool skipIsNotNull)
        {
            DbExpression cqt = null;

            AsCql(
                // trueLiteral action
                () => cqt = DbExpressionBuilder.True,
                // varIsNotNull action
                () => cqt = outputMember.AsCqt(row).IsNull().Not(),
                // varNotEqualsTo action
                (constant) =>
                {
                    DbExpression notEqualsExpr = outputMember.AsCqt(row).NotEqual(constant.AsCqt(row, outputMember));
                    if (cqt != null)
                    {
                        cqt = cqt.And(notEqualsExpr);
                    }
                    else
                    {
                        cqt = notEqualsExpr;
                    }
                },
                constants, outputMember, skipIsNotNull);

            return cqt;
        }

5. Example

Project: referencesource
Source File: Translator.cs
View license
protected override DbExpression TranslateIntoLogicExpression(ExpressionConverter parent, System.Linq.Expressions.BinaryExpression linq, DbExpression left, DbExpression right)
            {
                //No direct translation, we translate into ((left && !right) || (!left && right))
                DbExpression firstExpression = left.And(right.Not());
                DbExpression secondExpression = left.Not().And(right);
                DbExpression result = firstExpression.Or(secondExpression);
                return result;
            }

6. Example

Project: referencesource
Source File: CTreeGenerator.cs
View license
public override DbExpression Visit(ExistsOp op, Node n)
        {
            //
            // Exists requires a RelOp input set
            //
            DbExpression inputExpr = VisitNode(n.Child0);

            //
            // Information about the Vars published by the RelOp argument does not need to be maintained
            // since they may not now be used higher in the CQT.
            //
            ConsumeRelOp(inputExpr);

            //
            // Exists --> Not(IsEmpty(Input set)) via DbExpressionBuilder.Exists
            //
            return inputExpr.IsEmpty().Not();
        }

7. Example

Project: referencesource
Source File: SlotInfo.cs
View license
internal DbExpression AsCqt(DbExpression row)
        {
            DbExpression cqt = m_slotValue.AsCqt(row, m_outputMember);
            if (m_enforceNotNull)
            {
                cqt = cqt.And(cqt.IsNull().Not());
            }
            return cqt;
        }

8. Example

View license
private DbExpression ImplementEqualityConstantAndUnknown(
            System.Data.Common.CommandTrees.DbConstantExpression constant, DbExpression unknown, EqualsPattern pattern)
        {
            switch (pattern)
            {
                case EqualsPattern.Store:
                case EqualsPattern.PositiveNullEqualityNonComposable: // for Joins                    
                    return constant.Equal(unknown); // either both are non-null, or one is null and the predicate result is undefined
                case EqualsPattern.PositiveNullEqualityComposable:
                    if (!_funcletizer.RootContext.ContextOptions.UseCSharpNullComparisonBehavior)
                    {
                        return constant.Equal(unknown); // same as EqualsPattern.PositiveNullEqualityNonComposable
                    }
                    return constant.Equal(unknown).And(unknown.IsNull().Not()); // add more logic to avoid undefined result for true clr semantics
                default:
                    Debug.Fail("unknown pattern");
                    return null;
            }
        }

9. Example

Project: referencesource
Source File: CTreeGenerator.cs
View license
public override DbExpression Visit(ConditionalOp op, Node n)
        {
            //
            ///n ..... /n //View Source file for more details /n }

10. Example

View license
internal override DbExpression AsCqt(DbExpression row, bool skipIsNotNull)
        {
            DbE/n ..... /n //View Source file for more details /n }

11. Example

View license
private DbExpression GeneratePredicate(StorageConditionPropertyMapping condition, DbExpression row)
        {
            Debug.Assert(condition.EdmProperty == null, "C-side conditions are not supported in function mappings.");
            DbExpression columnRef = GenerateColumnRef(row, condition.ColumnProperty);

            if (condition.IsNull.HasValue)
            {
                return condition.IsNull.Value ? (DbExpression)columnRef.IsNull() : (DbExpression)columnRef.IsNull().Not();
            }
            else
            {
                return columnRef.Equal(columnRef.ResultType.Constant(condition.Value));
            }
        }

12. Example

View license
private DbExpression ImplementEqualityUnknownArguments(DbExpression left, DbExpression right, EqualsPattern pattern)
        {
            switch (pattern)
            {
                case EqualsPattern.Store: // left EQ right
                    return left.Equal(right);
                case EqualsPattern.PositiveNullEqualityNonComposable: // for Joins
                    return left.Equal(right).Or(left.IsNull().And(right.IsNull()));
                case EqualsPattern.PositiveNullEqualityComposable:
                    {
                        var bothNotNull = left.Equal(right);
                        var bothNull = left.IsNull().And(right.IsNull());
                        if (!_funcletizer.RootContext.ContextOptions.UseCSharpNullComparisonBehavior)
                        {
                            return bothNotNull.Or(bothNull); // same as EqualsPattern.PositiveNullEqualityNonComposable
                        }
                        // add more logic to avoid undefined result for true clr semantics, ensuring composability
                        // (left EQ right AND NOT (left IS NULL OR right IS NULL)) OR (left IS NULL AND right IS NULL)
                        var anyOneIsNull = left.IsNull().Or(right.IsNull());
                        return (bothNotNull.And(anyOneIsNull.Not())).Or(bothNull);
                    }
                default:
                    Debug.Fail("unexpected pattern");
                    return null;
            }
        }

13. Example

View license
internal static DbExpression TranslateContains(ExpressionConverter parent, Expression sourceExpressi/n ..... /n //View Source file for more details /n }

14. Example

View license
private DbExpression TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionK/n ..... /n //View Source file for more details /n }

15. Example

View license
internal GeneratedView GetGeneratedView(EntitySetBase extent, MetadataWorkspace workspace, StorageMa/n ..... /n //View Source file for more details /n }

16. 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 }