How to store long data

Jan 4, 2011 at 1:43 PM


i want to store a long bytearrayin my db.

I tried Convert.ToBase64String(array). But the problem is nvchar only supports 4000 characters. I would like to use NText for that, but this is only available in SqlDbType not DbType.


Do you have a solution for this?


Kind regards



Jan 4, 2011 at 2:01 PM

Is teh byte array a serialized object or some sort, or is it truly just binary data?  ORM currently supports objects, though I really need to create a sample showing how that works.  I can do that, but I want to make certain it works to answer your question.

Jan 4, 2011 at 2:15 PM

The byte array unfortunately is just binary data.

Jan 4, 2011 at 2:18 PM

Nothing unfortunate about that - it's something the ORM should handle.  I know how I'd add that (the data type in the DB would be 'image').  I'll need to special-case byte array data, maybe even looking at length for type efficiency.

Jan 5, 2011 at 10:00 AM

Could you please post an example with a Custom serializer?

Jan 5, 2011 at 3:51 PM

I'm working on a sample for both binary data and custom serialization right now.  Will keep you apprised.

Jan 5, 2011 at 4:57 PM

The latest code (not Release, get the change set) has support for byte[] data.  For byte[] and object serialization there is an example in the test project in the code base. I've also explained serialization on my blog:

Jan 10, 2011 at 8:41 AM


i downloaded the current source code, but the OpenNETCF.ORM.SqlCe DLL doesn't work. It shows some files which aren't available:





Jan 10, 2011 at 2:00 PM

No idea how that happened, but yes, TFS missed adding them into the repository.  I've just added them in the latest change set (there were in the release zip).