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

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

12 Examples 7

1. Example

Project: referencesource
Source File: CTreeGenerator.cs
View license
public override DbExpression Visit(ConstantPredicateOp op, Node n)
        {
            //
            // Create a "true=true" for "true" predicates,
            // Create a "true=false" expression for false predicates
            //
            return DbExpressionBuilder.True.Equal(op.IsTrue ? DbExpressionBuilder.True : DbExpressionBuilder.False);
        }

2. Example

Project: referencesource
Source File: JoinCqlBlock.cs
View license
internal DbExpression AsCqt(DbExpression leftRow, DbExpression rightRow)
                {
                    return m_leftSlot.AsCqt(leftRow, m_leftSlotOutputMember).Equal(m_rightSlot.AsCqt(rightRow, m_rightSlotOutputMember));
                }

3. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
View license
private static DbExpression ConvertSimpleInExpression(SemanticResolver sr, DbExpression left, DbExpression right)
        {
            // Only handle cases when the right-side is a new instance expression
            Debug.Assert(right.ExpressionKind == DbExpressionKind.NewInstance, "right.ExpressionKind == DbExpressionKind.NewInstance");
            DbNewInstanceExpression rightColl = (DbNewInstanceExpression)right;

            if (rightColl.Arguments.Count == 0)
            {
                return DbExpressionBuilder.False;
            }

            var predicates = rightColl.Arguments.Select(arg => left.Equal(arg));
            List<DbExpression> args = new List<DbExpression>(predicates);
            DbExpression orExpr = Utils.Helpers.BuildBalancedTreeInPlace(args, (prev, next) => prev.Or(next));

            return orExpr;
        }

4. Example

View license
private DbExpression ImplementEquality(DbExpression left, DbExpression right, EqualsPattern pattern)/n ..... /n //View Source file for more details /n }

5. Example

Project: referencesource
Source File: UpdateCompiler.cs
View license
private DbExpression GenerateEqualityExpression(DbExpressionBinding target, EdmProperty property, PropagatorResult value)
        {
            Debug.Assert(null != target && null != property && null != value);

            DbExpression propertyExpression = GeneratePropertyExpression(target, property);
            DbExpression valueExpression = GenerateValueExpression(property, value);
            if (valueExpression.ExpressionKind == DbExpressionKind.Null)
            {
                return propertyExpression.IsNull();
            }
            return propertyExpression.Equal(valueExpression);
        }

6. 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;
            }
        }

7. Example

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

8. 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));
            }
        }

9. 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;
            }
        }

10. Example

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

11. Example

Project: referencesource
Source File: ObjectContext.cs
View license
private int BatchRefreshEntitiesByKey(RefreshMode refreshMode, Dictionary<EntityKey, EntityEntry&/n ..... /n //View Source file for more details /n }

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