I have a couple of large SQL scripts, but one particular in general which I would like to use as a stored procedure (but I dont since I am not the biggest fan of stored procedures for this kind of query).
My question isnt about the actuall script, but how I should in "best practice" handle a big SQL query which I need to run as RawSql with EF Core. The script takes some parameters and so on.
Should I:
- Store the script in a .sql file in the project and use some kind of
Regex.Replacefor the parameters in the actual content of the file? - Should I just have a class with SQL scripts which takes in parameters and uses the
$"select * from x where column = '{myParameter}'"?
Thanks in advance!
Best regards Max