IDataServiceStreamProvider.GetStreamContentType(Object, DataServiceOperationContext) 方法

定义

返回属于指定实体的媒体资源的内容类型。Returns the content type of the media resource that belongs to the specified entity.

public:
 System::String ^ GetStreamContentType(System::Object ^ entity, System::Data::Services::DataServiceOperationContext ^ operationContext);
public string GetStreamContentType (object entity, System.Data.Services.DataServiceOperationContext operationContext);
abstract member GetStreamContentType : obj * System.Data.Services.DataServiceOperationContext -> string
Public Function GetStreamContentType (entity As Object, operationContext As DataServiceOperationContext) As String

参数

entity
Object

一个实体,它是具有相关媒体资源的媒体链接项。The entity that is a media link entry with a related media resource.

operationContext
DataServiceOperationContext

数据服务用于处理请求的 DataServiceOperationContext 实例。The DataServiceOperationContext instance used by the data service to process the request.

返回

String

二进制数据的有效 Content-Type。A valid Content-Type of the binary data.

注解

数据服务运行时调用 GetStreamContentType 方法,以检索属于指定的 entity 的媒体资源的 Content-Type。The GetStreamContentType method is called by the data service runtime to retrieve the Content-Type of the media resource that belongs to the specified entity. 使用 GetStreamContentType 方法实现设置媒体资源的 Content-Type。Use the GetStreamContentType method implementation to set the Content-Type of the media resource. 不要在 IDataServiceStreamProvider 提供程序实现中直接设置 Content-Type 标头。Do not directly set the Content-Type header in your IDataServiceStreamProvider provider implementation.

适用于