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

Is returning an IAsyncEnumerable possible? #435

Open
cmaart opened this issue Feb 24, 2022 · 0 comments
Open

Is returning an IAsyncEnumerable possible? #435

cmaart opened this issue Feb 24, 2022 · 0 comments

Comments

@cmaart
Copy link

cmaart commented Feb 24, 2022

Hi,

I'd like to return an IAsyncEnumerable from a method using CypherFluentQuery, is that possible?

That's how far I am with this:

var cypherFluentQuery = _client.Cypher
  ...CypherQuery Magic here...
  .Return(() => new {
      ...
  });

await using var session = _driver.AsyncSession();

IResultCursor? cursor = await session.Run(cypherFluentQuery.Query, _client);

while (await cursor.FetchAsync())
{
  IRecord record = cursor.Current;

 // Now how to parse IRecord to T (my class, let's stay Student class)?

 yield return (Student) record;

}

But I'm stuck deserializing the record from session.Run to my class. StatementResultHelper might be helpful for that, but it's internal. Is there any other way to reach through neo4jclient to get IResultCursor or something different to be able to return as IAsyncEnumerable

Thanks for any help :)

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

1 participant