Skip to content

Single Table Design improvements #129

@lezzi

Description

@lezzi

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#"));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions