0

BDC 支持对外部内容类型的 BLOB 进行爬网。在 BDC 模型中有一些示例说明如何使用 SQL-Database 和 StreamAccessor 方法执行此操作。我终于让它工作了,包括全文搜索。

BDC也支持OData,但是是否支持抓取OData中的BLOB呢?我在 BDC 模型中测试了许多选项,但没有人使用 BLOB。

当 OData 实体返回时byte[](如 SQL 示例中所示),BDC 显示InvalidOperationException: The MethodInstance with Name 'DataAccessor' of Type 'StreamAccessor' returned 'null' or did not return an AdapterObject that is streamable. Are you using a shim that supports streaming?

我还测试了OData 媒体链接条目(HasStream),它失败并显示 http 415(请求不支持的媒体类型),因为请求/Document(1)/$value是使用application/atom+xml标头发出的。

我尝试实现一个 StreamAccessor,但到目前为止还没有让它工作。

需要什么才能让 BDC 与 OData 和 BLOB 爬行工作?

这是我的 BDC 文件中的方法示例:

<Method Name="GetData">
  <Properties>
    <Property Name="ODataEntityUrl" Type="System.String">/Documents(@Id)</Property>
  </Properties>
  <Parameters>
    <Parameter Name="@Id" Direction="In">
      <TypeDescriptor Name="Id" DefaultDisplayName="Id" TypeName="System.Int32" IdentifierName="Id" />
    </Parameter>
    <Parameter Name="@Document" Direction="Return">
      <TypeDescriptor Name="Document" DefaultDisplayName="Document" TypeName="Microsoft.BusinessData.Runtime.DynamicType">
        <TypeDescriptors>
          <TypeDescriptor Name="Data" DefaultDisplayName="Data" TypeName="System.Byte[]" />
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
  </Parameters>
  <MethodInstances>
    <MethodInstance Name="DataAccessor" Type="StreamAccessor" Default="true" ReturnParameterName="@Document" ReturnTypeDescriptorPath="Document.Data" DefaultDisplayName="Document">
      <Properties>
        <Property Name="FileNameField" Type="System.String">DisplayName</Property>
      </Properties>
    </MethodInstance>
  </MethodInstances>
</Method>
4

0 回答 0