Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use a DbFunction to return an IQueryable? #16017

Closed
shaulbehr opened this issue Jun 10, 2019 · 1 comment
Closed

How to use a DbFunction to return an IQueryable? #16017

shaulbehr opened this issue Jun 10, 2019 · 1 comment

Comments

@shaulbehr
Copy link

shaulbehr commented Jun 10, 2019

I have a Postgresql function with signature:

create or replace function my_table_func(enddate timestamptz)
	returns setof my_table

In my DbContext I have declared:

        [DbFunction("my_table_func")]
        public static IQueryable<MyTable> MyTableFunc(DateTime? endDate = null)
        {
            throw new Exception("Not implemented in code; this is a DB function.");
        }

When I try to generate an EF Migration, though, I get the following error:

System.InvalidOperationException: The DbFunction 'MyDbContext.MyTableFunc' has an invalid return type 'IQueryable<MyTable>'. Ensure that the return type can be mapped by the current provider.

Is it possible to create a DbMapping that I can use as an IQueryable<>?

I am using EF Core 2.1.4

@smitpatel
Copy link
Member

Duplicate of #4319

It is not possible to use them in EFCore 2.x releases.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants