I have a simple question.
Is it possible to wrap a SQL function in “EF Code first” code such that I can execute it as part of my other LINQ -> EF queries?
We have a SQL function that does some hardcore work on the DB. We give it a reference number, and its returns a nice formatted string based on the reference. What I want to do is add it into the db query, but I’m not sure how to go about it.
For info, this would be the SQL that I would use (made simpler):
select t.ref, getrefstring(t.ref) from transactions t;
I dont want to write the SQL by hand and use the SQLQuery command, as the actual SQL is extensive, and I really dont want to have to go back to using SQL, as that gets messy when I have to map all of the fields back into C# again.
Does anyone have any ideas?
Cheers, Nick
How about creating a view: