protected internal override Expression VisitLiteReference(LiteReferenceExpression lite) { var reference = Visit(lite.Reference); var toStr = Visit(lite.CustomToStr); return(Lite.ToLiteFatInternalExpression(reference, toStr ?? Expression.Constant(null, typeof(string)))); }
protected internal override Expression VisitLiteReference(LiteReferenceExpression lite) { var oldInLite = inLite; inLite = true; var result = base.VisitLiteReference(lite); inLite = oldInLite; return(result); }
protected internal virtual Expression VisitLiteReference(LiteReferenceExpression lite) { var newRef = Visit(lite.Reference); var newToStr = Visit(lite.CustomToStr); if (newRef != lite.Reference || newToStr != lite.CustomToStr) { return(new LiteReferenceExpression(lite.Type, newRef, newToStr, lite.LazyToStr, lite.EagerEntity)); } return(lite); }
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 VisitLiteReference(LiteReferenceExpression lite) { if (lite.EagerEntity) { return(base.VisitLiteReference(lite)); } var id = lite.Reference is ImplementedByAllExpression || lite.Reference is ImplementedByExpression ib && ib.Implementations.Select(imp => imp.Value.ExternalId.ValueType.Nullify()).Distinct().Count() > 1 ? (Expression)binder.GetIdString(lite.Reference) : (Expression)binder.GetId(lite.Reference); var typeId = binder.GetEntityType(lite.Reference); var toStr = LiteToString(lite, typeId); //var toStr2 = Visit(toStr); //AdditionalBinding in embedded requires it, but makes problems in many other lites in Nominator return(new LiteValueExpression(lite.Type, typeId, id, toStr)); }