What is the best way to store byte array in SQL database using NHibernate?

c#, nhibernate, sql, sql-server, sql-server-2005

Solution

BinaryBlob should generate the proper VarBinary column for you.

Problem

I have an array of bytes in my C# class, and need to persist it into a SQL Server 2005 database using NHibernate. What SQL data type should I use for the column, and how do I got about using NHiberante to do the persistance for me? If the answer is a custom NHibernate type, is there any sample code knicking around to do this? Would it just be easier to convert the byte array to a string and persist it in a varcahr column?

Original source