Поделиться через


Фрагмент XML-кода: моделирование метода StreamAccessor

Дата последнего изменения: 21 апреля 2010 г.

Применимо к: SharePoint Server 2010

Ниже приводится пример метода StreamAccessor в модели BDC.

Пример

<Method Name="GetResumeLarge">
  <Properties>
    <Property Name="RdbCommandText" Type="System.String">SELECT ResumeLarge FROM Customers WHERE CustomerId = @CustomerId</Property>
    <Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">Text</Property>
  </Properties>
  <Parameters>
    <Parameter Direction="In" Name="@CustomerId">
      <TypeDescriptor TypeName="System.Int32" IdentifierName="CustomerId" Name="CustomerId" />
    </Parameter>
    <Parameter Name="StreamData" Direction="Return">
      <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="StreamData">
        <TypeDescriptors>
          <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="StreamData Element">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.Byte[]" Name="ResumeLarge" />
            </TypeDescriptors>
          </TypeDescriptor>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
  </Parameters>
  <MethodInstances>
    <MethodInstance Name="LargeResumeAccessor" Type="StreamAccessor" ReturnParameterName="StreamData" ReturnTypeDescriptorName="ResumeLarge">
      <Properties>
        <Property Name="MimeType" Type="System.String">application/vnd.openxmlformats-officedocument.wordprocessingml.document</Property>
        <Property Name="FileName" Type="System.String">Resume Large.docx</Property>
        <Property Name="MimeTypeField" Type="System.String">ResumeLargeMIME</Property>
        <Property Name="FileNameField" Type="System.String">ResumeLargeName</Property>
        <Property Name="MaxFileSizeInKB" Type="System.Int32">120</Property>
      </Properties>
    </MethodInstance>
  </MethodInstances>
</Method>

Чтобы получить полный образец модели BDC, включающий метод StreamAccessor, выполните следующие действия:

  1. Загрузите Microsoft SharePoint 2010 SDK (Возможно, на английском языке).

  2. Извлеките содержимое файла "bcs sample kit.zip" из каталога "%ProgramFiles%\Microsoft SDKs\SharePoint 2010\Samples\Business Connectivity Services" в локальную папку.

  3. В папке, где находятся извлеченные файлы, найдите папку "BDC Models for XML Snippets". В этой папке содержатся образцы модели BDC.