Skip to content

Add more materializing extension methods. #538

Description

@fiseni

We expose the WithSpecification extension which applies the specification to any IQueryable source, refer to the docs for more details.
We might go one step further and add some convenience extension methods covering some common use cases, e.g. FirstOrDefaultAsync, SingleOrDefaultAsync, etc. We already have such an extension ToListAsync, which is actually necessary considering the PostProcessingAction. But, we can expand to that and cover more methods.

Example

Current usage:

var customer = await dbContext.Customers
    .WithSpecification(spec)
    .FirstOrDefaultAsync(cancellationToken);

Proposed:

var customer = await dbContext.Customers
    .FirstOrDefaultAsync(spec, cancellationToken);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions