Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 649
Robin Weston Avatar asked Jul 07 '09 15:07

Robin Weston


1 Answers

BinaryBlob should generate the proper VarBinary column for you.

like image 50
Stu Avatar answered Sep 28 '22 05:09

Stu