//Finds a collection of entities with the specified query. public virtual async Task <IEnumerable <TEntity> > Where(Expression <Func <TEntity, bool> > query) { string name = query.Parameters[0].Name; TEntity entity = (TEntity)Activator.CreateInstance(query.Parameters[0].Type); Expression <Func <TEntity, bool> > newQuery = PredicateManager.Rewrite(query, "e"); return(await client.Cypher .Match("(e:" + entity.Label + ")") .Where(newQuery) .Return(e => e.As <TEntity>()) .ResultsAsync); }
public virtual async Task <IEnumerable <TEntity2> > GetRelated <TEntity2, TRelationship>(Expression <Func <TEntity, bool> > query1, Expression <Func <TEntity2, bool> > query2, TRelationship relationship) where TEntity2 : Neo4jEntity, new() where TRelationship : Neo4jRelationship, new() { string name1 = query1.Parameters[0].Name; TEntity entity1 = (TEntity)Activator.CreateInstance(query1.Parameters[0].Type); string name2 = query2.Parameters[0].Name; TEntity2 entity2 = (TEntity2)Activator.CreateInstance(query2.Parameters[0].Type); Expression <Func <TEntity2, bool> > newQuery = PredicateManager.Rewrite(query2, "e"); return(await client.Cypher .Match("(" + name1 + ":" + entity1.Label + ")-[:" + relationship.Name + "]->(" + name2 + ":" + entity2.Label + ")") .Where(query1) .AndWhere(query2) .Return(e => e.As <TEntity2>()) .ResultsAsync); }