-
Notifications
You must be signed in to change notification settings - Fork 2k
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 would use a stored procedure with query types? #1018
Comments
You can do this, given you have a
|
What about passing parameters to the sp on runtime? |
You can pass parameters to SP on runtime like this:
|
Thank you for the information. |
I don't know how to handle multiple result sets but in this case EF will get the first result set to list. |
We are just looking into EF Core 2.x. I am trying to understand the use of Stored Procedure calls and how to use them with EF Core. While this example shows how to return a query result from a stored procedure. How would you set one up that returns the return results of a stored procedure. We have a few stored procedures that do bulk updates or other things that don't have a query result, but does return a return value (in some cases a bool, string, int, etc...). Examples would be greatly appreciated. |
I'm also having the same issue. My stored proc returns a list of records without any unique key and I need to map it to my entity because field names in the database are chaotic (legacy database). So, as usual, I add:
But EF throws on initialization:
So, how do I add custom mapping to my query type that has no primary key? |
Oh, I just found IQueryTypeConfiguration, which was not documented in the article - I just replaced IEntityTypeConfiguration with IQueryTypeConfiguration, mapped my entity to my stored proc results without
I think IQueryTypeConfiguration should be added to the Query Types article. |
@progmars How did you define the query expression to builder.ToQuery() for stored procedure? I'm going through the same to call a sproc. A sample will be helpful. |
@gopala000 |
@progmars Thanks for your response. I'm looking for how to map the sproc and parameters using builder.*. In addition looking for how to pass the parameter values as well. |
Duplicate of #969 |
This document only shows an example of a view. How would you use a stored procedure with query types to return something that is not "*" and more than one column?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: