Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cosmos: Min/Max/Average over nullable value type throws on no data #35094

@alexandrereyes

Description

@alexandrereyes

The code below is throwing "sequence contains no elements", even though there is a conversion to null.

await Set<Order>().MinAsync(o => (decimal?)o.TotalPrice)

This is blocking me from migrating to EF Core 9, since the only workaround is very bad (make two queries, the other one to verify if there is some record).

EF Core version: 9
Database provider: Microsoft.EntityFrameworkCore.Cosmos
Target framework: NET 9.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.12.0

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions