Extrait de code XML : modélisation d’une méthode Finder
Dernière modification : mercredi 21 avril 2010
S’applique à : SharePoint Server 2010
Voici un exemple de méthode Finder dans un modèle BDC.
Exemple
<Method Name="Read List" DefaultDisplayName="SalesReason Read List">
<Properties>
<Property Name="BackEndObject" Type="System.String">SalesReason</Property>
<Property Name="BackEndObjectType" Type="System.String">SqlServerTable</Property>
<Property Name="RdbCommandText" Type="System.String">SELECT [SalesReasonID] , [Name] , [ReasonType] , [ModifiedDate] FROM [Sales].[SalesReason]</Property>
<Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">Text</Property>
<Property Name="Schema" Type="System.String">Sales</Property>
</Properties>
<FilterDescriptors>
<FilterDescriptor Type="Limit" FilterField="SalesReasonID" Name="LimitFilter">
<Properties>
<Property Name="CaseSensitive" Type="System.Boolean">false</Property>
<Property Name="IsDefault" Type="System.Boolean">true</Property>
<Property Name="UsedForDisambiguation" Type="System.Boolean">false</Property>
</Properties>
</FilterDescriptor>
</FilterDescriptors>
<Parameters>
<Parameter Direction="In" Name="@ItemsLimit">
<TypeDescriptor TypeName="System.Int64" AssociatedFilter="LimitFilter" Name="SalesReasonID">
<DefaultValues>
<DefaultValue MethodInstanceName="Read List" Type="System.Int64">2000</DefaultValue>
</DefaultValues>
</TypeDescriptor>
</Parameter>
<Parameter Direction="Return" Name="Read List">
<TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Read List">
<TypeDescriptors>
<TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Read ListElement">
<TypeDescriptors>
<TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="SalesReasonID" Name="SalesReasonID" />
<TypeDescriptor TypeName="System.String" Name="Name">
<Properties>
<Property Name="RequiredInForms" Type="System.Boolean">true</Property>
<Property Name="ShowInPicker" Type="System.Boolean">true</Property>
<Property Name="Size" Type="System.Int32">50</Property>
</Properties>
<Interpretation>
<NormalizeString FromLOB="NormalizeToNull" ToLOB="NormalizeToEmptyString" />
</Interpretation>
</TypeDescriptor>
<TypeDescriptor TypeName="System.String" Name="ReasonType">
<Properties>
<Property Name="RequiredInForms" Type="System.Boolean">true</Property>
<Property Name="ShowInPicker" Type="System.Boolean">true</Property>
<Property Name="Size" Type="System.Int32">50</Property>
</Properties>
<Interpretation>
<NormalizeString FromLOB="NormalizeToNull" ToLOB="NormalizeToEmptyString" />
</Interpretation>
</TypeDescriptor>
<TypeDescriptor TypeName="System.DateTime" Name="ModifiedDate">
<Properties>
<Property Name="RequiredInForms" Type="System.Boolean">true</Property>
</Properties>
<Interpretation>
<NormalizeDateTime LobDateTimeMode="UTC" />
</Interpretation>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</Parameter>
</Parameters>
<MethodInstances>
<MethodInstance Type="Finder" ReturnParameterName="Read List" Default="true" Name="Read List" DefaultDisplayName="SalesReason Read List">
<Properties>
<Property Name="LastModifiedTimeStampField" Type="System.String">ModifiedDate</Property>
<Property Name="RootFinder" Type="System.String"></Property>
<Property Name="UseClientCachingForSearch" Type="System.String"></Property>
</Properties>
</MethodInstance>
</MethodInstances>
</Method>
Pour obtenir un exemple de modèle BDC complet comprenant une méthode Finder, procédez comme suit :
Téléchargez le Kit de développement logiciel (SDK) de Microsoft SharePoint 2010 (éventuellement en anglais).
Effectuez l’extraction de « bcs sample kit.zip » à partir de « %ProgramFiles%\Microsoft SDKs\SharePoint 2010\Samples\Business Connectivity Services » vers un dossier local.
Dans le dossier où vous avez extrait les fichiers, recherchez le dossier « BDC Models for XML Snippets ». Ce dossier contient les exemples de modèles BDC.