-
Notifications
You must be signed in to change notification settings - Fork 3.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
Database.SqlQuery<TElement> Missing #10365
Labels
Comments
Raw SQL queries that return arbitrary types is being tracked by #9290. |
Meanwhile you can try netcore-ef-util and a code like follow using SearchAThing.EFUtil;
using System.Linq;
...
var integerList = db.ExecSQL<int>("SELECT [MyIntegerColumn] FROM [MyTable]");
foreach (int id in integerList)
{
// do something with each in the list or just return the list
} More complex example here |
This is a perfect example why people is moving to NodeJS and alternative frameworks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Entity Framework, there is a method to execute a query against the database and return a specified object type. Entity Framework Core does not have this and the only alternative is 4 times the amount of code. Example below.
Database.SqlQuery (Entity Framework 6.0)
This is the SqlQuery method found in Entity Framework 6.0
SqlCommand (Entity Framework Core 2.0)
This is the DbDataReader method found in Entity Framework Core 2.0
Honestly, quadrupling the amount of code required to perform the same action and expecting the same result is not "more efficient" in my opinion. I have literally dozens of "quick calls" as I call them in my code that will now require me to convert a single line of code over to 4 (or more).
The text was updated successfully, but these errors were encountered: