private static string ToSql(UnaryExpression Body, ComparationType linkingType) { string sResult = null; if (Body.Operand is MethodCallExpression) { sResult = ToSql(Body.Operand as MethodCallExpression); sResult = sResult .Replace(" IN (", " NOT IN (") .Replace(" LIKE N", " NOT LIKE N"); } else if (Body.Operand is BinaryExpression) { sResult = $"NOT ({ToSql(Body.Operand as BinaryExpression)})"; } else if (Body.Operand is MemberExpression) { sResult = $"NOT ({ToSql(Body.Operand as MemberExpression)})"; } else if (Body.Operand is UnaryExpression) { sResult = $"NOT ({ToSql(Body.Operand as UnaryExpression, linkingType)})"; } else { throw new InvalidOperationException("No se admite el tipo de negaciĆ³n"); } return(sResult); }
public static ISwitchFork Create(string id, ComparationType comparation, object value) { var isf = ScriptableObject.CreateInstance <ISwitchFork>(); isf.comparationType = comparation; isf.id = id; isf.Value = value; return(isf); }
private static string GetOperator(ComparationType type, string value) { switch (type) { case ComparationType.Equal: return(value != "null" ? "=" : "IS"); case ComparationType.NotEqual: return(value != "null" ? "<>" : "IS NOT"); case ComparationType.LessThan: return("<"); case ComparationType.GreaterThan: return(">"); case ComparationType.LessThanOrEqual: return("<="); case ComparationType.GreaterThanOrEqual: return(">="); case ComparationType.AndAlso: case ComparationType.And: return("AND"); case ComparationType.Or: case ComparationType.OrElse: return("OR"); case ComparationType.Default: return(string.Empty); default: throw new NotImplementedException(); } }