public bool TryCreate(Expression leftOperand, Expression rightOperand, out IMapExpressionBuilder builder) { builder = null; var conditionalNode = rightOperand as ConditionalExpression; if (conditionalNode == null) { return(false); } var ifTrueIsIgnore = ignoreNodeChecker.IsIgnoreNode(conditionalNode.IfTrue); var ifFalseIsIgnore = ignoreNodeChecker.IsIgnoreNode(conditionalNode.IfFalse); if (!ifTrueIsIgnore && !ifFalseIsIgnore) { return(false); } if (ifTrueIsIgnore && ifFalseIsIgnore) { builder = new EmptyMapExpressionBuilder(); return(true); } if (ifFalseIsIgnore) { builder = new ConditionalAssignMapExpressionBuilder(conditionalNode.Test, leftOperand, conditionalNode.IfTrue); return(true); } builder = new ConditionalAssignMapExpressionBuilder(Expression.IsFalse(conditionalNode.Test), leftOperand, conditionalNode.IfFalse); return(true); }
public bool TryCreate(Expression leftOperand, Expression rightOperand, out IMapExpressionBuilder builder) { if (ignoreNodeChecker.IsIgnoreNode(rightOperand)) { builder = new EmptyMapExpressionBuilder(); return(true); } builder = null; return(false); }