Skip to content

IQueryable<T> filter by subquery gives "Item with Same Key has already been added" #2659

Closed
@Molinware

Description

@Molinware

Execute this query, gives the following exception:

statelessSession.Query<Sale>()
    .Select(x => new SaleDto
    {
        Id = x.Id,
        SaleDate = x.ListChildren.Max(y => y.Date)
    })
    .Where(x => x.SaleDate <= DateTime.Today && x.SaleDate >= DateTime.Today)
    .ToList();

Exception:
System.ArgumentException: Item with Same Key has already been added.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions