Thursday, May 01, 2008

SQL Server 2008 FILESTREAM Attribute from Start to C#

MSSQLTips.com - Using FILESTREAM to Store BLOBs in the NTFS File System in SQL Server 2008

"Problem
SQL Server 2008 provides the capability of storing BLOBs (e.g. MP3, Word, Excel, PDF, etc.) in the NTFS file system rather than in a database file.  I am interested in how to configure the FILESTREAM technology in Management Studio.  Could you help us to understand the benefits and provide details on how to implement this new feature in SQL Server 2008?  Further, I am interested in how to use this functionality with the C# programming language.

...

In this tip we are going to gain an understanding of FILESTREAM by walking through a simple code sample to demonstrate the steps to:

  • Configure FILESTREAM
  • Add a BLOB from T-SQL code
  • Add a BLOB from C# code
..."

A nice start to finish FILESTREAM article.

I wonder how many code wrappers are going to be written to encapsulate the required .Net code? (i.e. this looks like a wheel we're going to be recreating for every project/group/company/etc...)

Also I wonder what the Linq to SQL/Linq to Entities and the FILESTREAM attribute story is going to be?

 

Related Past Post XRef:
SQL Server 2008, the FILESTREAM Attribute and Partitioning - Apparently not as easy as it looks (yet at least)...
A future world without the SQL Server Image/Text/NText data types. Now's the time to start planning for that future...
SQL Server 2008 FILESTREAM - Writing a file to a FILESTREAM column
More SQL Server 2008 FileStream Fun
Playing with the SQL Server 2008 FileStream Attribute

2 comments:

Anonymous said...

Both L2E and L2S will have 'partial' support for Filestreams in their first and next release respectively.

By partial I mean they get treated as BLOBs, so there is no streaming.

I.e. if an Entity has a FileStream column, then when you do something like this:

var results = from p in ctx.People
where p.Firstname == "Whatever"
select p;

if p has a FILESTREAM resume property, then you are loading each person's resume into an byte[] when results are enumerated.

So the moral of the story is support is very much 'partial' and you need to understand what is happening to avoid performance problems.

Alex

Greg said...

You rock Alex, thank you!