.NET 9 - Devart.Data.Oracle.EfCore - Discriminator issue with include

.NET 9 - Devart.Data.Oracle.EfCore - Discriminator issue with include

Hello Devart,

When using discriminators in EF Core and then including navigational properties which aren't available on all discriminated types, only on specific derived types:
  1. var result = await ctx.Vehicles
  2.     .Include(_ => ((Car)_).PossibleEngineTypes) // this line is problematic in .NET 9
  3.     .ToListAsync();


This now throws the following exception since the .NET 9 upgrade:

  1. System.InvalidOperationException: 'Unexpected ProjectionExpression implementation.'
  2.    at Devart.Common.Entity.EntityExpressionFactory.Alias(SqlExpression argument, String alias)
  3.    at Devart.Data.Oracle.Entity.AliasRenamer.W73XitM5qM(ProjectionExpression  )
  4.    at Devart.Data.Oracle.Entity.AliasRenamer.Rename()
  5.    at Devart.Data.Oracle.Entity.AliasRenamerVisitor.VisitExtension(Expression node)
  6.    at xKXfW2OyYoQIcN80hsY.V1HIAgerrF(Object , Expression , xKXfW2OyYoQIcN80hsY )
  7.    at Devart.Data.Oracle.Entity.AliasRenamerVisitor.VisitExtension(Expression node)
  8.    at xKXfW2OyYoQIcN80hsY.V1HIAgerrF(Object , Expression , xKXfW2OyYoQIcN80hsY )
  9.    at Devart.Data.Oracle.Entity.OracleQueryTranslationPostprocessor.Process(Expression query)
  10.    at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutorExpression[TResult](Expression query)
  11.    at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
  12.    at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
  13.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
  14.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass11_0`1.<ExecuteCore>b__0()
  15.    at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
  16.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteCore[TResult](Expression query, Boolean async, CancellationToken cancellationToken)
  17.    at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
  18.    at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
  19.    at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)
  20.    at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.IncludableQueryable`2.GetAsyncEnumerator(CancellationToken cancellationToken)
  21.    at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
  22.    at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.<ToListAsync>d__67`1.MoveNext()
  23.    at Program.<<Main>$>d__0.MoveNext() in Program.cs:line 13
  24.    at Program.<Main>(String[] args)

This is something that was working in .NET 8 and Devart 10.3.105.8.

In the attachments you can find a solution with both a working (.NET 8 ) and broken (.NET 9) implementation.

Thanks.