You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue has been previously reported as #255 and is still present in Oracle.EntityFrameworkCore 8.21.121
when schema is explicitly specified in OnModelCreating, using function mapping results in incorrectly generated query - schema is placed before table (it should be inside).
// model + contextpublicclassTestTable{publicintId{get;set;}publicstringData{get;set;}}publicclassTestContext:DbContext{publicTestContext(DbContextOptions<TestContext>options):base(options){}publicDbSet<TestTable> TestTables {get;set;}publicIQueryable<TestTable>TestFunction()=> FromExpression(()=> TestFunction());protectedoverridevoidOnModelCreating(ModelBuildermodelBuilder){
modelBuilder.HasDefaultSchema("DEV3");// this causes the issue - when schema is not specified, the query is generated correctly
modelBuilder.Entity<TestTable>(builder =>{ builder.HasKey(b => b.Id);});
modelBuilder.HasDbFunction(typeof(TestContext).GetMethod(nameof(TestFunction))).HasName("TestFunction");}}
DB can be created using ef.core migrations
dotnet ef migrations add IniticalCreate
dotnet ef database update
function definition in Oracle:
CREATE OR REPLACETYPE "TestType" AS OBJECT (
"Id"NUMBER,
"Data" NVARCHAR2
);
/CREATE OR REPLACETYPE "TestTableType" AS TABLE OF UserRecordType;
/CREATE OR REPLACEFUNCTION "TestFunction"()
RETURN "TestTableType" PIPELINED
IS
BEGIN
FOR "tt"IN (
SELECT*FROM"TestTables"
) LOOP
PIPE ROW("TestType"(
"tt"."Id",
"tt"."Data"
));
END LOOP;
RETURN;
END;
The text was updated successfully, but these errors were encountered:
Thanks @nfdavi for reporting! I was able to reproduce your error and have filed a bug (36218521) to have the dev team review the issue and provide a fix.
This issue has been previously reported as #255 and is still present in
Oracle.EntityFrameworkCore 8.21.121
when schema is explicitly specified in
OnModelCreating
, using function mapping results in incorrectly generated query - schema is placed beforetable
(it should be inside).The generated (incorrect) query:
should be instead:
reproducible example (.net core 8.0):
DB can be created using ef.core migrations
function definition in Oracle:
The text was updated successfully, but these errors were encountered: