private string toOrderClause(Ordering clause) { var locator = _mapping.JsonLocator(clause.Expression); return(clause.OrderingDirection == OrderingDirection.Asc ? locator : locator + " desc"); }
protected override Expression VisitMember(MemberExpression expression) { if (expression.Type == typeof(bool)) { var locator = _mapping.JsonLocator(expression); var @where = new WhereFragment($"{locator} = False"); _callback(@where); } return(base.VisitMember(expression)); }
public void ConfigureAggregate(CommandBuilder sql, string @operator) { var locator = _mapping.JsonLocator(Model.SelectClause.Selector); var field = @operator.ToFormat(locator); sql.Append("select "); sql.Append(field); sql.Append(" from "); sql.Append(_mapping.Table.QualifiedName); sql.Append(" as d"); AppendWhere(sql); }
/// <summary> /// Returns a locator for the member being queried upon /// </summary> /// <param name="mapping"></param> /// <param name="expression"></param> /// <returns></returns> protected virtual string GetLocator(IQueryableDocument mapping, MethodCallExpression expression) { if (!expression.Method.IsStatic && expression.Object != null && expression.Object.NodeType != ExpressionType.Constant) { // x.member.Equals(...) return(mapping.JsonLocator(expression.Object)); } if (expression.Arguments[0].NodeType == ExpressionType.Constant) { // string.Equals("value", x.member) return(mapping.JsonLocator(expression.Arguments[1])); } // string.Equals(x.member, "value") return(mapping.JsonLocator(expression.Arguments[0])); }
protected override Expression VisitMember(MemberExpression expression) { if (expression.Type == typeof(bool)) { var locator = _mapping.JsonLocator(expression); var whereFragments = new List <IWhereFragment> { new WhereFragment($"{locator} IS NULL"), new WhereFragment($"{locator} != ?", true) }; var @where = new CompoundWhereFragment("or", whereFragments.ToArray()); _callback(@where); } return(base.VisitMember(expression)); }
public static string ToOrderClause(this Ordering clause, IQueryableDocument mapping) { var locator = mapping.JsonLocator(clause.Expression); return(clause.OrderingDirection == OrderingDirection.Asc ? locator : locator + " desc"); }
protected override Expression VisitMember(MemberExpression expression) { if (expression.Type == typeof(bool)) { var locator = _mapping.JsonLocator(expression); var where = new WhereFragment("{0} = True".ToFormat(locator), true); _register.Peek()(where); return(null); } return(base.VisitMember(expression)); }
/// <summary> /// Returns a locator for the member being queried upon /// </summary> /// <param name="mapping"></param> /// <param name="expression"></param> /// <returns></returns> protected virtual string GetLocator(IQueryableDocument mapping, MethodCallExpression expression) { if (!expression.Method.IsStatic && expression.Object != null && expression.Object.NodeType != ExpressionType.Constant) { // x.member.Equals(...) return mapping.JsonLocator(expression.Object); } if (expression.Arguments[0].NodeType == ExpressionType.Constant) { // string.Equals("value", x.member) return mapping.JsonLocator(expression.Arguments[1]); } // string.Equals(x.member, "value") return mapping.JsonLocator(expression.Arguments[0]); }