❔ Mixing EF Core and another SQL library
Hello, I need to write some raw SQL queries outside the ORM but EF Core doesn't support that, how good is an idea of adding another SQL library to do those raw queries. It would be nice if I could split queries into seperate .sql files. Pls suggestions, thank you
15 Replies
I checked ADO.NET and it seems like what I'm looking for, is it a bad idea to have multiple db libs like this?
Dapper if anything
But EF does let you execute raw queries
I saw Database.SqlQuery but it doesn't let me return objects
only 1 scalar value
as it says on docs
Is there another way?
Keyless Entity Types - EF Core
How to configure keyless entity types using Entity Framework Core
keyless entities
thx 😄
Hmm seems like [Keyless] creates the table, is this intended behavior?
It shouldn't be creating one
seems like adding Keyless annotation did nothing,
this is the result I get in my modelsnapshot and this is from msdn
seems like this issue exists for a while.. found github issues from 2018-2022
I guess it creates a view, then, huh
I'd say go with Dapper, then
is it ok to mix ef core and dapper? no possible issues to arise?
Ideally, don't use them to query for the same things, but it should be fine
ty, using ef core to get and update 'simple' queries but I have some 60 liners that dapper will handle
dapper works, gonna use it for selection and EF core for everything else, just feels wrong having 2 orms
I used 2 ORMs back in the old EF 4~6 days. The old EF was pretty slow on large reads. So I used dapper for that and EF for updating.
ty for info
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.