'Oracle.EntityFramework is generating queries with quotes for tables and columns only when more tables involved

I'm creating a datacollector application for an existing Oracle 19c relational database. I'm using a graphQL server and entityframework. here's the packages configuration I'm using:

   <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="GraphQL.Server.Ui.Voyager" Version="5.2.0" />
    <PackageReference Include="HotChocolate.AspNetCore" Version="11.0.8" />
    <PackageReference Include="HotChocolate.Data.EntityFramework" Version="11.0.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" />
    <PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.5" />
    <PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.50" />
  </ItemGroup>
    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="GraphQL.Server.Ui.Voyager" Version="5.2.0" />
        <PackageReference Include="HotChocolate.AspNetCore" Version="11.0.8" />
        <PackageReference Include="HotChocolate.Data.EntityFramework" Version="11.0.8" />
        <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
          <PrivateAssets>all</PrivateAssets>
        </PackageReference>
        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
          <PrivateAssets>all</PrivateAssets>
        </PackageReference>
        <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" />
        <PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.5" />
        <PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.50" />
      </ItemGroup>

I have scaffolded the existing tables into models. When I do graphql queries involving a single table I have no issues, but when I do queries involving 2 or more tables the generates Oracle query has columns and tables between quotes and it obviously breaks.

Stack trace is something like:

Microsoft.EntityFrameworkCore.Database.Command: Error: 2022-02-23 18:18:05.179310 ThreadID:17  (ERROR)   OracleRelationalCommand.ExecuteReaderAsync() :  Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00904: "n0"."Ngid": invalid identifier
   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, Int64 internalInitialJSONFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Database.Command: Error: Failed executing DbCommand (301ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT "n"."col1", "n"."col2", "n0"."col11", "n0"."col12"
FROM "table1" "n"
LEFT JOIN "table2" "n0" ON "n"."col1" = "n0"."col11"

Can you guys give me a hint on how to avoid this? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source