I have a LINQ to Entities query
From item In ctx.Items Select new { ListPrice = item.Cost / (1M - item.Markup) };
Can I tell EF that I want it to apply cast to the price of the list before requesting and materializing it 1 ? Maybe something like EntityFunctions.Cast ? Or can I use the ESQL cast function?
I want LINQ to create an SQL query on these lines
SELECT cast((Cost / (1 - Markup)) as decimal(10, 2)) AS ListPrice
1 My goal is to get rid of the heap of accuracy / scale of the request. Since there is decimal subtraction and division, the result of mathematics is decimal (38, 26)! Thus, more than .NET can handle more than I need.
c # sql-server linq entity-framework entity-sql
just.another.programmer
source share