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

Enriched the extension helpers on async result #211

Merged
merged 2 commits into from
Aug 7, 2017

Conversation

zhenlineo
Copy link
Contributor

@zhenlineo zhenlineo commented Aug 4, 2017

Added a few extension methods for handling async result, such as SingleAsync, ForeachAsync.

@zhenlineo
Copy link
Contributor Author

zhenlineo commented Aug 7, 2017

@ali-ince I removed the extension method
Task ForEachAsync(..., Function<IRecord, Task>)
but instead added
Task<List<T>> ToListAsync<T>(..., Function<IRecord, T>)

The reason I changed is that I am not sure if we should make decisions for a user to await on their tasks. Instead I think it might be better to give ToListAsync method where a user could return his/her tasks into a list<Task> and then waitAll on them.

And in the future, when requested, we could add
Task ForEachAsync(..., Function<IRecord, Task>) and
Task ForEachAsync<T>(..., Function<IRecord, Task<T>>)

list.Add(result.Current()[0].As<string>());

return list;
return await result.ToListAsync(r => r[0].As<string>());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code shows a "normal" usecase of Task<List<T>> ToListAsync(..., Func<IRecord, T>)

@ali-ince ali-ince merged commit 542db9e into neo4j:1.5 Aug 7, 2017
@zhenlineo zhenlineo deleted the 1.5-extensions branch August 7, 2017 16:07
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

Successfully merging this pull request may close these issues.

None yet

2 participants