NotEqualNullable() 공개 정적인 메소드

public static NotEqualNullable ( Expression e1, Expression e2 ) : Expression
e1 System.Linq.Expressions.Expression
e2 System.Linq.Expressions.Expression
리턴 System.Linq.Expressions.Expression
예제 #1
0
        private Expression?LiteToString(LiteReferenceExpression lite, Expression typeId)
        {
            if (lite.CustomToStr != null)
            {
                return(Visit(lite.CustomToStr));
            }

            if (lite.Reference is ImplementedByAllExpression)
            {
                return(null);
            }

            if (lite.LazyToStr)
            {
                return(null);
            }

            if (IsCacheable(typeId))
            {
                return(null);
            }

            if (lite.Reference is EntityExpression entityExp)
            {
                if (entityExp.AvoidExpandOnRetrieving)
                {
                    return(null);
                }

                return(binder.BindMethodCall(Expression.Call(entityExp, EntityExpression.ToStringMethod)));
            }

            if (lite.Reference is ImplementedByExpression ibe)
            {
                if (ibe.Implementations.Any(imp => imp.Value.AvoidExpandOnRetrieving))
                {
                    return(null);
                }

                return(ibe.Implementations.Values.Select(ee =>
                                                         new When(SmartEqualizer.NotEqualNullable(ee.ExternalId, QueryBinder.NullId(ee.ExternalId.ValueType)),
                                                                  binder.BindMethodCall(Expression.Call(ee, EntityExpression.ToStringMethod)))
                                                         ).ToCondition(typeof(string)));
            }

            return(binder.BindMethodCall(Expression.Call(lite.Reference, EntityExpression.ToStringMethod)));
        }
            protected internal override Expression VisitMListElement(MListElementExpression mle)
            {
                Type type = mle.Type;

                var bindings = new List <MemberAssignment>
                {
                    Expression.Bind(type.GetProperty("RowId"), Visit(mle.RowId.UnNullify())),
                    Expression.Bind(type.GetProperty("Parent"), Visit(mle.Parent)),
                };

                if (mle.Order != null)
                {
                    bindings.Add(Expression.Bind(type.GetProperty("Order"), Visit(mle.Order)));
                }

                bindings.Add(Expression.Bind(type.GetProperty("Element"), Visit(mle.Element)));

                var init = Expression.MemberInit(Expression.New(type), bindings);

                return(Expression.Condition(SmartEqualizer.NotEqualNullable(Visit(mle.RowId.Nullify()), NullId),
                                            init,
                                            Expression.Constant(null, init.Type)));
            }