Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass parameters into ForEach function #400

Open
abf7d opened this issue Feb 21, 2021 · 1 comment
Open

Pass parameters into ForEach function #400

abf7d opened this issue Feb 21, 2021 · 1 comment

Comments

@abf7d
Copy link

abf7d commented Feb 21, 2021

I'm looking to iterate over a collection of objects with the .net neo4j client. Currently I pass a collectino in with unwind. ForEach only takes a string. How can I pass an array into ForEach?

@cskardon
Copy link
Member

I've answered on the Stack Overflow - and copying here. It'd probably be a good PR if you want to have a go at it?

//From Stack Overflow
You can't, and (despite the other question) I don't think you've ever been able to. I can't find that overload anywhere in the codebase, even in April 2016 it doesn't seem to be there.

The only way at the moment would be to do:

var myArray = new [] {1,2,3};
client.Cypher
    .ForEach("(val IN $myParam | ...)")
    .WithParam("myParam", myArray)
    /// etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants