Reputation: 38013
I have a query that fetches hierarchical data from the db into an object of structure:
class HierarchicalData {
public int ID {get; set;}
public string Description {get; set;}
public IEnumerable<HierarchicalData> Children {get; set;}
}
I'm comfortable with how to query the data. The problem comes when one of my hierarchical elements needs to use a number for Description
. I can't use .ToString()
because Linq to Entities doesn't have a SQL translation for that. And I don't want to pull all the data into memory just so that I can call .ToString()
- that would be hugely inefficient.
I just want some kind of expression that can convert a number to a string on the database side.
Upvotes: 0
Views: 156
Reputation: 20524
You can use SqlFunctions.StringConvert(double)
in Linq to Entities
Upvotes: 2