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

Execute Custom SQL. #4487

Closed
GArrigotti opened this issue Feb 4, 2016 · 6 comments
Closed

Execute Custom SQL. #4487

GArrigotti opened this issue Feb 4, 2016 · 6 comments

Comments

@GArrigotti
Copy link

In Entity Framework 6 I was able to utilize SqlQuery. I found on Stack Overflow and several documentation that the command was modified to FromSql. However, when I utilize the release candidate, the FromSql command doesn't appear though the proper depdencies are specified in the application.

@divega
Copy link
Contributor

divega commented Feb 4, 2016

FromSql() is an extension method for DbSet<TEntity>. Are you importing the necessary namespace? In RC1 that would be Microsoft.Data.Entity.

@divega
Copy link
Contributor

divega commented Feb 4, 2016

Correction: it is on IQueryable<T>.

@GArrigotti
Copy link
Author

Yes, I did implement Microsoft.Data.Entity. I'll double check, I didn't attempt on a DbSet. This differs from SqlQuery, SqlQuery could be wrapped:

public TEntity GetEntityFromStoredProcedure<TEntity>(string procedure, params SqlParameter[] parameters)
{
     return this.Database.SqlQuery(..., ...);
}

Which I would of assumed would be the case FromSql for the most part. But that doesn't appear to be the case, if I have to go off a DbSet.

@divega
Copy link
Contributor

divega commented Feb 4, 2016

Yes, FromSql() and SqlQuery() are different. We already have issues tracking the functional gap. You should be able to find them searching active issues here.

@GArrigotti
Copy link
Author

Thank you Divega, anything I can do to potentially help?

@divega
Copy link
Contributor

divega commented Feb 5, 2016

AFAIR the main two things that are missing are:

For the first one there is some pending design work, e.g. figure out what the API looks like and where we put it (and option is to do something similar to what we had in EF6) whether it is still composable like FromSql() or not, etc. I would suggest that if you have a strong preference you start by posting to the thread.

For the second one we are pretty much locked on just adding DbParameter as an option, but other patterns have been suggested as well.

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants