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

Allow props setting use case #183

Closed
devcrafting opened this issue Jun 13, 2017 · 4 comments
Closed

Allow props setting use case #183

devcrafting opened this issue Jun 13, 2017 · 4 comments
Labels

Comments

@devcrafting
Copy link

Hello,

I was trying to set multiple properties on a node using a "props" parameter (as it is done here http://neo4j.com/docs/developer-manual/current/cypher/syntax/parameters/#cypher-parameters-create-node-with-properties).
I tried with the following anonymous parameter:

var props = new { id = ..., name = ... }
var parameters = new { props }
session.Run("...", parameters)

The Run with "object" parameters does not support this use case since the ToDictionary extension (from Internal/Extensions/CollectionsExtensions.cs) transform only the first level and do not go deeper (in the "props" anonymous object).

I agree it is probably useful only in the setting props use case, but would be could great to be able to do this easily. Or we could have a Props class that manage this use case and a new Run overload?

Thanks
Clément

@zhenlineo zhenlineo added the bug label Jun 13, 2017
@zhenlineo
Copy link
Contributor

zhenlineo commented Jun 13, 2017

Hi

You could provide multiple levels of property parameters if you use Run(string, IDictionary<string, object>)

var parameters = new IDictionary<string, object>{
    {"props", new IDictionary<string, object> { "id", ... }, {"name", ... } }
}

Dose this solve your problem?

Zhen

@devcrafting
Copy link
Author

Yes that's what I did, but it is a bit more verbose than anonymous objects.
I even mixed both:

new { props = new Dictionary<string, object> { ... } }

@zhenlineo
Copy link
Contributor

#213

@ali-ince
Copy link
Contributor

ali-ince commented Sep 5, 2017

I am closing this as this is addressed by #213 and is already included in 1.4.1 release and merged in 1.5.0 branch.

@ali-ince ali-ince closed this as completed Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants