Skip to content

Temporal rewriter may have issue #28058

Open

Description

Exception -

 System.InvalidOperationException : An exception was thrown while attempting to evaluate the LINQ query parameter expression 'Convert(value(Microsoft.EntityFrameworkCore.Query.ComplexNavigationsCollectionsQueryTestBase`1+<>c__DisplayClass25_0[Microsoft.EntityFrameworkCore.Query.TemporalComplexNavigationsSharedTypeQuerySqlServerFixture]).ss.Set(), DbSet`1).TemporalAsOf(1/1/2010 12:00:00 AM)'. See the inner exception for more information.
    ---- System.InvalidCastException : Unable to cast object of type 'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel.Level2]' to type 'Microsoft.EntityFrameworkCore.DbSet`1[Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel.Level2]'.
 

Query

DbSet<Level1>()
    .OrderBy(l1 => l1.Id)
    .Select(l1 => new { 
        l1 = l1, 
        inner = <>c__DisplayClass25_0.ss.Set<Level2>()
            .Where(l2 => l2.Name != "Foo")
            .Select(l2 => new { 
                l2 = l2, 
                innerL1s = <>c__DisplayClass25_0.ss.Set<Level1>()
                    .Where(innerL1 => innerL1.OneToMany_Optional1
                        .Any(innerL2 => innerL2.Id == l2.Id))
                    .Select(innerL1 => innerL1.Name)
                    .AsEnumerable()
             })
            .Select(<>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.innerL1s
                .ToList())
            .FirstOrDefault()
     })
    .Select(<>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.inner
        .ToList())

We are adding convert to DbSet in rewriter for test and it is throwing something off.

Only happens for STET so may be because Set is never db set.

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

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions