XML Snippet: Modeling a StreamAccessor Method
Applies to: SharePoint Server 2010
The following is an example of a StreamAccessor method in a BDC model.
Example
<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>
For a complete BDC model sample that includes a StreamAccessor, do the following:
Download the Microsoft SharePoint 2010 SDK.
Extract "bcs sample kit.zip" from "%ProgramFiles%\Microsoft SDKs\SharePoint 2010\Samples\Business Connectivity Services" to a local folder.
In the folder where you extracted the files, locate the "BDC Models for XML Snippets" folder. This folder contains BDC model samples.