开发者

Save video stream into the database's table

I want to save a stream video into my database, I want to know what data type in SQL-Server is suitable to save video开发者_如何学运维 stream ?

EDIT : Note that, I'm using EF4 as my project ORM.

Any advice will be graceful.

Thanks.


For storing BLOBs such as video data you can use the varbinary(MAX) data type in SQL Server 2005 which is supported by Entity Framework.

Keep in mind whenever you load the entity that contains this column EF will try to fully load your full video into memory, there is no byte streaming mode in EF - this means not only will this not scale well but with multiple users also becomes infeasible because of the memory requirements and will perform poorly. Don't do this - I would look hard for better alternatives.


we can assume that a video is basically a file and you can use the FILESTREAM SQL 2008 data type.

there should be plenty of examples around, I found this:

http://weblogs.asp.net/aghausman/archive/2009/03/16/saving-and-retrieving-file-using-filestream-sql-server-2008.aspx


Download and Upload images from SQL Server via ASP.Net MVC. The article shows how to use streaming semantics for large BLOBs (avoid creating an in memory byte[]) and you ca use the implementation in C# forms just as well, is nothing specific for ASP MVC or web in general.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜