Share via


IDataServiceStreamProvider.ResolveType 方法

定义

返回一个命名空间限定的类型名称,该名称表示数据服务运行时必须为媒体链接项创建的类型,该媒体链接项与正在插入的媒体资源的数据流相关联。

public:
 System::String ^ ResolveType(System::String ^ entitySetName, System::Data::Services::DataServiceOperationContext ^ operationContext);
public string ResolveType (string entitySetName, System.Data.Services.DataServiceOperationContext operationContext);
abstract member ResolveType : string * System.Data.Services.DataServiceOperationContext -> string
Public Function ResolveType (entitySetName As String, operationContext As DataServiceOperationContext) As String

参数

entitySetName
String

完全限定的实体集名称。

operationContext
DataServiceOperationContext

数据服务用来处理请求的 DataServiceOperationContext 实例。

返回

一个命名空间限定的类型名称。

注解

当新的媒体链接项实体正在与其媒体资源一起处于创建过程中时,数据服务将调用 ResolveType 方法。 此方法的实现器必须检查 operationContext 中的请求标头,并返回一个命名空间限定的类型名称,该名称表示数据服务运行时必须实例化的类型,以便创建与新的媒体资源相关联的媒体链接项。 表示此类型名称的字符串将传递给 CreateResource 方法,以创建媒体链接项。

当您实现 GetWriteStream 方法时,您应引发以下例外,如下所示:

例外类型 条件
ArgumentNullException operationContextnull 时。
DataServiceException 当无法基于 operationContext 解析实体类型名称时。

适用于