Backend: SQL Server 2008 Database with FileStream Enabled
Data Access: Linq to Entities
I have thousands of PDFs that are currently located on a file server. I would like to transfer these pdf files from the file server and to the SQL Server 2008 database so that I can more easily manage them.
As a proof of concept (i.e., to make sure that the new FileStream ability in SQL Server 2008 is what I'm looking for), I wrote a small application that will read and write these pdfs to a database that supports FileStream through entities.
The application is very simple; here is the code:
datReport report = new datReport();
report.ReportName = "ANL-7411-Rev-Supp-1.pdf";
report.RowGuid = Guid.NewGuid();
report.ReportData = File.ReadAllBytes(@"C:\TestSavePDF\ANL-7411-Rev-Supp-1.pdf");
using (NewNNAFTAEntities ctx = new NewNNAFTAEntities()) {
ctx.AddTodatReport(report);
ctx.SaveChanges();
}
, , . - "System.outofmemoryexception", , . PDF . , , pdf - 350 , .
. !