Mapping a GUID to a string with NHibernate
Posted by Garry Shutler in NHibernate
In a project I’m working on at the moment I needed to back a GUID to a string as it didn’t seem to be working out of the box with my SQLite database. It was saving it to whatever type of column I gave it in what looked like byte form leading to some crazy characters. However, it was falling over when trying to hydrate the field from that column.
Now I’m probably epic failing and there’s a much easier way to do this but I ended up creating a custom user type for doing this which I've made available on gist. I won’t be surprised if there’s an easier way and please let me know about it with a comment. I’ve also included the Fluent NHibernate class map to show how it use it if you’re not familiar with custom user types.
This got me moving again and googling how to do this came up blank, hence the blog post.
This entry was posted on at Friday, April 02, 2010 and is filed under NHibernate. You can follow any responses to this entry through the RSS 2.0. You can