WinForms application development - transferring documents from SQL Server to file storage

I have a standard WinForms application that connects to SQL Server. The application allows users to upload documents that are currently stored in the database to a table using an image column.

I need to change this approach so that documents are saved as files and the link to the file is stored in the database table.

Using the current approach - when a user downloads a document, he is protected from how it is stored, since they have a database connection, they don’t need to know anything about where the files are stored, no special permissions on directories, etc. necessary. If I set up a network resource for documents, I want to avoid any problems with IT, such as users who have access to this directory for downloading or access to existing documents.

What are the options for this? I was thinking of a temporary database where the documents are uploaded the same way as the current approach, and then the process running on the server to save them to the file vault. Then this database could be deleted and recreated to restore any space. Are there any more efficient approaches?

MORE INFO: There is no web server element in my application, so I don’t think WCF service is possible

+3
source share
3 answers

Is there a reason why you want to get files from a database in the first place?

How else to save them in SQL Server, but using a FILESTREAMcolumn instead IMAGE?

Quote from the link:

FILESTREAM allows SQL Server-based applications to store unstructured data, such as documents and images, in the file system. Applications can use rich streaming APIs and system file performance and at the same time maintain a sequence of transactions between unstructured data and corresponding structured data.

FILESTREAM SQL Server Database Engine NTFS (BLOB) varbinary (max) . Transact-SQL , , FILESTREAM. Win32 .

FILESTREAM NT . FILESTREAM Database Engine . SQL Server ; .

, :
(probabl ), , ..

, FILESTREAM , , SQL Server 2008.

+2

, . WCF, . , , ​​, . , , , WCF, .

+1

(, CLR) , , . , , , .

Alternatively, a WCF / web service can be created to which the application connects. The web method can be used to receive the contents of the file and write to the desired location; it can return the path to the file or some file identifier.

+1
source

All Articles