How can I convert this query to linq to entities with entity framework:
SELECT customer_id,
customer_name,
customer_code
FROM dbo.V_STF_CUSTOMER
WHERE company_id=@company_id AND
ORDER BY CASE
WHEN ISNUMERIC(customer_name)=1 THEN 1
ELSE 0
END,
customer_name
I have this:
return CUstomers.GetQuery().
Where(x => x.CompanyId == companyId).
OrderBy(??This is my problem??);
I don't know how to translate the orderby. Any idea?
return Customers.GetQuery().
Where(x => x.CompanyId == companyId).
OrderBy(x=> SqlFunctions.IsNumeric(x.customer_name)).
ThenBy(x=> x.customer_name);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With