This is a mirror of official site: http://jasper-net.blogspot.com/

Data Services Streaming Provider Series: Implementing a Streaming Provider

| Thursday, August 5, 2010
The Open Data Protocol (OData) enables you to define data feeds that also make binary large object (BLOB) data, such as photos, videos, and documents, available to client applications that consume OData feeds. These BLOBs are not returned within the feed itself (for obvious serialization, memory consumption and performance reasons). Instead, this binary data, called a media resource (MR), is requested from the data service separately from the entry in the feed to which it belongs, called a media link entry (MLE). An MR cannot exist without a related MLE, and each MLE has a reference to the related MR. (OData inherits this behavior from the AtomPub protocol.) If you are interested in the details and representation of an MLE in an OData feed, see Representing Media Link Entries (either AtomPub or  JSON) in the OData Protocol documentation.

To support these behaviors, WCF Data Services defines an IDataServiceStreamProvider interface that, when implemented, is used by the data service runtime to access the Stream that it uses to return or save the MR.  

What We Will Cover in this Series
Because it is the most straight-forward way to implement a streaming provider, this initial post in the series demonstrates an IDataServiceStreamProvider implementation that reads binary data from and writes binary data to files stored in the file system as a FileStream. MLE data is stored in a SQL Server database by using the Entity Framework provider. (If you are not already familiar with how to create an OData service by using WCF Data Services, you should first read Getting Started with WCF Data Services and the WCF Data Service quickstart in the MSDN documentation.) Subsequent posts will discuss other strategies and considerations for implementing the IDataServiceStreamProvider interface, such as storing the MR in the database (along with the MLE) and handling concurrency, as well as how to use the WCF Data Services client to consume an MR as a stream in a client application.

Steps Required to Implement a Streaming Provider
This initial blog post will cover the basic requirements for creating a streaming data service, which are:

Create the ASP.NET application.
Define the data provider.
Create the data service.
Implement IDataServiceStreamProvider.
Implement IServiceProvider.
Attribute the model metadata.
Enable large data streams in the ASP.NET application.
Grant the service access to the image file storage location and to the database.
Now, let’s take a look at the data service that we will use in this blog series.

The PhotoData Sample Data Service
This blog series features a sample photo data service that implements a streaming provider to store and retrieve image files, along with information about each photo.

Read more: WCF Data Services Team Blog Part 1

Posted via email from .NET Info

1 comments:

Anonymous said...

Your new creditor will offer you a good rate for a limited time -
you're going to take but push on assured that what
you want to spend off your balances. This mainly involves sitting down debt consolidation counselors
with a credit union or some other way. Using a single glance, no matter
how many loans you have taken out.

Here is my page :: best-onlinenews.yolasite.com