vkhorikov / CSharpFunctionalExtensions

Functional extensions for C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: AsMaybeAsync

mollsju opened this issue · comments

Hello!
Any chance AsMaybeAsync could be added, just as we have ToResultAsync?

It would allow for less clutter when combined with EF.

Current:
Maybe<Entity> maybeEntity = (await dbContext.Entity.FirstOrDefaultAsync(x => x.Id == EntityId)).AsMaybe();

With AsMaybeAsync:
Maybe<Entity> maybeEntity = await dbContext.Entity.FirstOrDefaultAsync(x => x.Id == EntityId).AsMaybeAsync();

Yes, looks good. Feel free to submit a PR please.