Question

I have an object I am using to store document meta data into a table. The body text of the document can be very large, sometimes > 2GB so I will be storing it into a nvarchar(max) field in SQL 2008. I'll use SQL 2008 later to index that field. I won't be using filestreams because they are very restrictive to the database and prevents certain types of concurrency locking schemes.

This object is exposed to the developer via LinqToSQL. My concern is that the field will be to large and I have seen .Net bomb out with an OutOfMemory exception if the text is > 1.5 GB.

So I am wondering, can I treat this blob as a stream with Linq? Or do I have to bypass Linq altogether if I want to use a blob?

Was it helpful?

Solution

Given the answer to "Can a LINQ query retrieve BLOBs [...]" I suspect you're out of luck. The System.Data.Linq.Binary type doesn't have any mechanism for streaming - basically it's just an immutable byte array representation.

There may be some deep LINQ mojo you could invoke, but I suspect it would really have to be pretty deep.

It's possible that the Entity Framework would handle it - I haven't investigated that.

OTHER TIPS

I ended up writing my own method around linqtoSql utlising the write method avaiable to varchar(max) objects in SQL. This allows developers to chunk inserts into the DB for large data types.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top