SQL EFCore
Hi!
What's current way to query db for data using raw sql? Im used to doing it this way from Doctrinedb and php
Something like
MyModel[] x = query("SELECT ...");
Rather than using an orm
10 Replies
Especially for more complex queries
Oh, that's easily googleable
SQL Queries - EF Core
Using SQL queries in Entity Framework Core
But if you don't want to use EF... why use EF?
coming back after a long time to c#, apologies 😅
Was looking for
context.Database.SqlQuery<>()
I do not really have too much of an idea what other tools are there for such thingDapper, for example
or linq2db if you want to write more advanced queries without dropping all the way to raw SQL
Dapper does a great job for what you want to achieve
And it's super flexible in terms of what Databases work
:soPortuguese:
Speaking of,
Dapper support FormatableSQLStrings?
Rider has amazing support for SQL strings but not dapper