17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4: <strong>FILESTREAM</strong> with Entity Framework and LINQ to <strong>SQL</strong>Each lab will follow the same basic structure.1. Create a stored procedure through which EF will access the <strong>FILESTREAM</strong> data.2. Create a console application project.3. Add an Entity Data Model Object to the project.4. Create the ORM.5. Insert a row with <strong>FILESTREAM</strong> data into the table.6. Retrieve rows along with <strong>FILESTREAM</strong> data.In both cases, the goal is to help you to get started with writing EF applications that readand write <strong>FILESTREAM</strong> data. We will examine only a few basic features <strong>of</strong>fered by ADO.NET EF, a more detailed discussion <strong>of</strong> which is beyond the scope <strong>of</strong> this book.Rebuilding the sample databaseBefore we get started with the labs, we need to create a new sample database. Run theT-<strong>SQL</strong> script in Listing 4-1 to rebuild the NorthPole sample database.USE masterGO-- ----------------------------------------------------- If the sample database exists, drop it and re-create-- ---------------------------------------------------IF DB_ID('NorthPole') IS NOT NULLDROP DATABASE NorthPoleGO133

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!