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

Single Table Design improvements #129

Open
lezzi opened this issue May 28, 2021 · 0 comments
Open

Single Table Design improvements #129

lezzi opened this issue May 28, 2021 · 0 comments

Comments

@lezzi
Copy link
Contributor

lezzi commented May 28, 2021

Predicate approach

Retrieving multiple entities of a different type in a single query is tricky in C#. Currently, you have to retrieve documents, then create multiple collections and fill them based on some conditions.

One of the ideas to improve this process is to expose ToListAsync<A, B, ...> overloads that accept predicates for each of the output types and returns a tuple.

var (mixedEntities, stringEntities) = await context.Query<KeysOnlyEntity>()
                .AsDocuments()
                .ToListAsync<MixedEntity, MediumStringFieldsEntity>(x => x["sk"].AsString().StartsWith("mixed#"), x => x["sk"].AsString().StartsWith("string#"));
@lezzi lezzi added enhancement New feature or request suggestion and removed enhancement New feature or request labels May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant