protected override Expression VisitMethodCall(MethodCallExpression node) { switch (node.Method.Name) { case "Contains": { var property = FieldPathResolver.ResolveExpression((MemberExpression)node.Arguments[0]); var value = TypedCollectionWrapper <object> .Evaluate(node.Arguments[1]); Query = Query.WhereArrayContains(property, value); break; } case "Equals": { var property = FieldPathResolver.ResolveExpression((MemberExpression)node.Object); var value = TypedCollectionWrapper <object> .Evaluate(node.Arguments[0]); Query = Query.WhereEqualTo(property, value); break; } } return(base.VisitMethodCall(node)); }
protected override Expression VisitBinary(BinaryExpression node) { if (node.NodeType == ExpressionType.OrElse) { throw new NotSupportedException("OR are not supported in firebase"); } if (node.NodeType == ExpressionType.AndAlso) { //_query.WhereArrayContains() } if (node.Left is MemberExpression) { var propertyName = FieldPathResolver.ResolveExpression((MemberExpression)node.Left); var valueExpression = TypedCollectionWrapper <object> .Evaluate(node.Right); switch (node.NodeType) { case ExpressionType.Equal: Query = Query.WhereEqualTo(propertyName, valueExpression); break; case ExpressionType.GreaterThan: Query = Query.WhereGreaterThan(propertyName, valueExpression); break; case ExpressionType.GreaterThanOrEqual: Query = Query.WhereGreaterThanOrEqualTo(propertyName, valueExpression); break; case ExpressionType.LessThan: Query = Query.WhereLessThan(propertyName, valueExpression); break; case ExpressionType.LessThanOrEqual: Query = Query.WhereLessThanOrEqualTo(propertyName, valueExpression); break; default: throw new NotSupportedException($"Operator {node.NodeType} not supported"); } } return(base.VisitBinary(node)); }
public TMember GetValue <TMember>(Expression <Func <T, TMember> > selector) { return(DocumentSnapshot.GetValue <TMember>(FieldPathResolver <T> .Resolve(selector))); }
public void With <TMember>(Expression <Func <T, TMember> > selector, TMember value) { _transaction.Update(_typedDocumentReference.DocumentReference, FieldPathResolver <T> .Resolve(selector), value); }
public Query WhereLessThanOrEqualTo <TMember>(Expression <Func <TEntity, TMember> > selector, TMember value) { var propertyName = FieldPathResolver <TEntity> .Resolve(selector); return(Query.WhereLessThanOrEqualTo(propertyName, value)); }
public Query WhereArrayContains <TMember>(Expression <Func <TEntity, TMember[]> > selector, TMember value) { var propertyName = FieldPathResolver <TEntity> .Resolve(selector); return(Query.WhereArrayContains(propertyName, value)); }
public TypedQueryWrapper <TEntity> OrderByDescending <TMember>(Expression <Func <TEntity, TMember> > selector) { return(new TypedQueryWrapper <TEntity>( Query.OrderByDescending(FieldPathResolver <TEntity> .Resolve(selector)))); }