<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SQL Server, SQL Server Express, and SqlDataSource Control</title><link>http://forums.asp.net/54.aspx</link><description>All about SQL Server, SQL Server Express, MSDE, and the SqlDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Linq to SQL varbinary for large files</title><link>http://forums.asp.net/thread/3275004.aspx</link><pubDate>Sat, 04 Jul 2009 23:44:06 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275004</guid><dc:creator>qq287461785@hotmail.com</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275004.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=3275004</wfw:commentRss><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;How did you solve the problem? I have the same question.&lt;/p&gt;
&lt;p&gt;My guess is that Linq to SQL right now doesn&amp;#39;t support update/insert/query via streams and I have to use ADO.NET to do that. The basis of that is that Binary is acutally the immutable version of byte[] and so you have to have all the contents in memory in order to perform above operations.&lt;/p&gt;&lt;p&gt;Anyone has comments?&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Arial;font-size:medium;"&gt;&lt;span&gt;&lt;span style="font-family:Verdana;font-size:small;"&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;&lt;span&gt;Matt&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Linq to SQL varbinary for large files</title><link>http://forums.asp.net/thread/2416520.aspx</link><pubDate>Wed, 11 Jun 2008 14:51:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2416520</guid><dc:creator>kcraft</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2416520.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=2416520</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have decided to use Linq for my current ASP.NET project and so far it has been good, but now I am implementing a system that will allow users to upload binary content such as pictures and&amp;nbsp; videos. For ease of&amp;nbsp;management and security, I have decided to store this content directly in the database. The performance hit is a minor concern because very few user-uploaded images/videos will be seen on any given page (usually just one).&lt;/p&gt;
&lt;p&gt;From the limited tutorials I have seen on the internet, Linq supports the SQL Server varbinary column through its System.Linq.Binary class. This class does not appear to support STREAMS and instead opts to load all of the contents into memory. This content can then be converted to an array of bytes, which can then be output to the browser via the response stream. This is not good. What if I am sending a video that is very large? Varbinary supports up to 2 GB. I can&amp;#39;t have a 2 GB video sitting in memory. It makes a lot more sense to stream it via a small buffer.&lt;/p&gt;
&lt;p&gt;Obviously, I am going to limit the size of the content that users can upload, but the core problem remains. If I limit content size to 2 MB and I have 2 GB of memory on the server, then I can only serve 1000 users concurrently. In reality, that number would be much less because of other processes running on the server.&lt;/p&gt;
&lt;p&gt;Is there no way to stream data from a varbinary column with Linq using a small buffer of bytes?&lt;/p&gt;
&lt;p&gt;Do I need to implement some custom logic on my Linq classes? Since these classes are automatically generated, how would I do such a thing?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item></channel></rss>