views:

69

answers:

1

I am having trouble with Subsonic 3.0 generating an object for a table which contains the new HeirachyID datatype. From what I have found, there is no corrosponding .Net type, and subsonic doesn't seem to know how to handle the hierachyid data.

Error that is thrown:

Object of type 'Microsoft.SqlServer.Types.SqlHierarchyId' cannot be converted to type 'System.String'.

Code:

foreach (MyDB.DataAccess.ThingCategory tc in DataAccess.ThingCategory.Find(x => x.fk_Thing.Equals(thingId)))
{
    sb.AppendFormat("<{0}>{1}</{0}>", wrapTag, tc.Categories.ToList<DataAccess.Category>()[0].Name);
}

tc.Categories.ToList() generates the error

Alternatively, I tried to get around this by writing a sproc to return the hierachyid column as a string, and noticed SubSonic 3.0 sprocs are not strongly-typed. or am I doing something wrong?

A: 

Sprocs can be strongly-typed by calling ExecuteTypedList()

I would create an issue on the Github tracker to either add support for the type (someone will have to contribute this since I don't think it's a high priority) or to gracefully handle it when they exist.

John Sheehan