Reputation: 4305
I am getting an error on the following code that says:
Here is the code, I need this method to return the Max Value? is it an IEnumerable or an int?
public IEnumerable<int> GraphGetMaxVersion(IEnumerable<Node<VersionNode>> nodeId)
{
IEnumerable<int> nodes = null;
clientConnection = graphOperations.GraphGetConnection();
var query = clientConnection
.Cypher
.Start(new
{
n = nodeId
})
.Return((maxVersion) => new
{
MaxVersion = Return.As<int>("max.Version")
});
nodes = query.Results;
return nodes;
}
Here is the query I would like to perform:
START n=node(2,3,4)
RETURN max(n.property)
Upvotes: 0
Views: 1037
Reputation: 4305
No errors are thrown when I made these changes to the method after reading this post.
public int GraphGetMaxVersion(int nodeId)
{
int nodes = 0;
clientConnection = graphOperations.GraphGetConnection();
var query = clientConnection
.Cypher
.Start(new
{
n = nodeId
})
.Return((maxVersion) => new
{
MaxVersion = Return.As<int>("max(n.Version)")
})
.Results
.Single();
nodes = query.MaxVersion;
return nodes;
}
Upvotes: 0
Reputation: 2614
You should so the following:
// Return Max follwoer node ID:
public float ReturnMaxFollowerID(IGraphClient Client)
{
return Client.Cypher
.Match("(n:User)")
.Return(() => Return.As<float>("max(n.userID)"))
.Results
.Single();
}
Upvotes: 0
Reputation: 4290
You want this:
public int GraphGetMaxVersion(IEnumerable<NodeReference<VersionNode>> nodes)
{
return graphClient.Cypher
.Start(new { n = nodes })
.Return(() => Return.As<int>("max(n.Version)"))
.Results
.Single();
}
Return(() => new { Foo = All.Count() })
into Return(() => All.Count())
.Return((somePointlessIdentityHere) => All.Count())
.Start(new { n = nodes })
to .Start(new { n = nodes.ToArray() })
.Upvotes: 1