You can always convert a HierarchyId
to its string representation - something like /1/3/4/1
- and send that string across the WCF data service.
Update: if you add this computed, persisted column to your SQL Server table, that new column should definitely show up in your EF model and you should be able to use this to send it back over WCF and WCF Data Services:
ALTER TABLE dbo.YourTable
ADD HierarchyString AS (your hierarchyID field).ToString() PERSISTED
Update #2: read the docs! You can parse back a string like /1/3/4/1
into a HierarchyId
type - either use the HierarchyId::Parse(string)
or the usual CAST(string as HierarchyId)
methods to do so.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…