Partager via


Extrait de code XML : Modélisation d’une méthode BulkSpecificFinder

Dernière modification : mercredi 21 avril 2010

S’applique à : SharePoint Server 2010

Voici un exemple de méthode BulkSpecificFinder dans un modèle BDC.

Exemple

<Method Name="Bulk Read Item" DefaultDisplayName="SalesOrder Bulk Read Item">
  <Properties>
    <Property Name="BackEndObject" Type="System.String">SalesOrderHeader
    </Property>
    <Property Name="BackEndObjectType" Type="System.String">SqlServerTable
    </Property>
    <Property Name="RdbCommandText" Type="System.String">
      SELECT [SalesOrderID] , [RevisionNumber] , [OrderDate] , 
      [DueDate] , [ShipDate] , [Status] , [OnlineOrderFlag] ,
      [SalesOrderNumber] , [PurchaseOrderNumber] , 
      [AccountNumber] , [CustomerID] , [ContactID] , [BillToAddressID] , 
      [ShipToAddressID] , [ShipMethodID] , [SubTotal] ,
      [TaxAmt] , [Freight] , [TotalDue] , [Comment] , [rowguid] , 
      [ModifiedDate] , [TerritoryID]
      FROM [Sales].[SalesOrderHeader] 
      WHERE [SalesOrderID] IN (@SalesOrderIDs)
    </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>
  <Parameters>
    <Parameter Direction="In" Name="@SalesOrderIDs">
      <TypeDescriptor TypeName="System.Int32[]" Name="SalesOrderIDs" 
                      IsCollection="true">
        <TypeDescriptors>
          <TypeDescriptor TypeName="System.Int32" 
                          IdentifierName="SalesOrderID" 
                          Name="SalesOrderID" />
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
    <Parameter Direction="Return" Name="Bulk Read Item">
      <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, 
                      Version=2.0.0.0, Culture=neutral, 
                      PublicKeyToken=b77a5c561934e089" 
                      IsCollection="true" Name="Bulk Read Item">
        <TypeDescriptors>
          <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, 
                          Version=2.0.0.0, Culture=neutral, 
                          PublicKeyToken=b77a5c561934e089" 
                          Name="Read ItemElement">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.Int32" ReadOnly="true" 
                              IdentifierName="SalesOrderID" 
                              Name="SalesOrderID" />
              <TypeDescriptor TypeName="System.Byte" Name="RevisionNumber">
                <Properties>
                  <Property Name="RequiredInForms" 
                            Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.DateTime" Name="OrderDate">
                <Properties>
                  <Property Name="RequiredInForms" 
                            Type="System.Boolean">true</Property>
                </Properties>
                <Interpretation>
                  <NormalizeDateTime LobDateTimeMode="UTC" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.DateTime" Name="DueDate">
                <Properties>
                  <Property Name="RequiredInForms" 
                            Type="System.Boolean">true</Property>
                </Properties>
                <Interpretation>
                  <NormalizeDateTime LobDateTimeMode="UTC" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Nullable`1[[System.DateTime, 
                              mscorlib, Version=2.0.0.0, Culture=neutral, 
                              PublicKeyToken=b77a5c561934e089]]" 
                              Name="ShipDate">
                <Interpretation>
                  <NormalizeDateTime LobDateTimeMode="UTC" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Byte" Name="Status">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">
                    true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Boolean" 
                              Name="OnlineOrderFlag">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">
                    true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.String" ReadOnly="true" 
                              Name="SalesOrderNumber">
                <Properties>
                  <Property Name="Size" Type="System.Int32">25</Property>
                </Properties>
                <Interpretation>
                  <NormalizeString FromLOB="NormalizeToNull" 
                                   ToLOB="NormalizeToNull" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.String" 
                              Name="PurchaseOrderNumber">
                <Properties>
                  <Property Name="Size" Type="System.Int32">25</Property>
                </Properties>
                <Interpretation>
                  <NormalizeString FromLOB="NormalizeToNull" 
                                   ToLOB="NormalizeToNull" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.String" Name="AccountNumber">
                <Properties>
                  <Property Name="Size" Type="System.Int32">15</Property>
                </Properties>
                <Interpretation>
                  <NormalizeString FromLOB="NormalizeToNull" 
                                   ToLOB="NormalizeToNull" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" 
                              IdentifierName="CustomerID" 
                              IdentifierEntityName="Customer" 
                              IdentifierEntityNamespace="AdventureWorks" 
                              ForeignIdentifierAssociationName="Customers Sales Orders" 
                              Name="CustomerID">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" Name="ContactID">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" Name="BillToAddressID">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" Name="ShipToAddressID">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" Name="ShipMethodID">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Decimal" Name="SubTotal">
                <Properties>
                  <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Decimal" Name="TaxAmt">
                <Properties>
                  <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Decimal" Name="Freight">
                <Properties>
                  <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Nullable`1[[System.Decimal, mscorlib, 
                              Version=2.0.0.0, Culture=neutral, 
                              PublicKeyToken=b77a5c561934e089]]" ReadOnly="true" 
                              Name="TotalDue">
                <Properties>
                  <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.String" Name="Comment">
                <Properties>
                  <Property Name="Size" Type="System.Int32">128</Property>
                </Properties>
                <Interpretation>
                  <NormalizeString FromLOB="NormalizeToNull" ToLOB="NormalizeToNull" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Guid" Name="rowguid">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.DateTime" Name="ModifiedDate">
                <Properties>
                  <Property Name="RequiredInForms" Type="System.Boolean">true</Property>
                </Properties>
                <Interpretation>
                  <NormalizeDateTime LobDateTimeMode="UTC" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Nullable`1[[System.Int32, mscorlib, 
                              Version=2.0.0.0, Culture=neutral, 
                              PublicKeyToken=b77a5c561934e089]]" Name="TerritoryID" />
            </TypeDescriptors>
          </TypeDescriptor>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
  </Parameters>
  <MethodInstances>
    <MethodInstance Type="BulkSpecificFinder" 
                    ReturnParameterName="Bulk Read Item" 
                    Default="true" 
                    Name="Bulk Read Item" 
                    DefaultDisplayName="SalesOrder Bulk Read Item">
      <Properties>
        <Property Name="Bulk Input Limit" Type="System.Int32">20</Property>
        <Property Name="LastDesignedOfficeItemType" Type="System.String">None</Property>
      </Properties>
    </MethodInstance>
  </MethodInstances>
</Method>

Pour un exemple de modèle BDC complet qui inclut un BulkSpecificFinder, procédez comme suit :

  1. Téléchargez le Kit de développement logiciel Microsoft SharePoint 2010 (éventuellement en anglais).

  2. Effectuez l’extraction de « bcs sample kit.zip » à partir de « %ProgramFiles%\Microsoft SDKs\SharePoint 2010\Samples\Business Connectivity Services » vers un dossier local.

  3. 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.