Partager via


Étape de création 7 : Définir le type de contenu externe Order

Dernière modification : vendredi 11 juin 2010

S’applique à : SharePoint Server 2010

Au cours de cette étape, vous allez définir un type de contenu externe nommé Order. Le type de contenu externe Order illustre une association qui a deux entités sources : Customer et Region. Pour plus d’informations, voir la définition suivante de GetOrdersForCustomerAndRegion. Cette étape montre également que vous pouvez définir des filtres dans des méthodes d’association.

Notes

La méthode Web principale doit prendre en charge les filtres que vous définissez.

Conditions requises

Étapes de création 6 : Définir le type de contenu externe Region

Pour définir l’entité Order

  • Ajoutez le code XML de l’entité Order après l’élément d’entité Region et avant la balise de fin Entities (</Entities>). Ce code XML définit le titre, l’identificateur et les méthodes d’entité à utiliser pour renvoyer les commandes.

    <Entity Namespace="SampleWebService" Version="1.2.0.0" EstimatedInstanceCount="10000" Name="WSOrder" DefaultDisplayName="WSOrder">
      <Properties>
        <Property Name="OutlookItemType" Type="System.String">Task</Property>
      </Properties>
      <Identifiers>
        <Identifier TypeName="System.String" Name="OrderID" />
      </Identifiers>
      <Methods>
        <Method IsStatic="false" Name="GetOrderByID">
          <Parameters>
            <Parameter Direction="In" Name="id">
              <TypeDescriptor TypeName="System.String" IdentifierName="OrderID" Name="id" DefaultDisplayName="OrderID" />
            </Parameter>
            <Parameter Direction="Return" Name="GetOrderByID">
              <TypeDescriptor TypeName="BCSServiceProxy.Order, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="GetOrderByID">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="OrderID" Name="OrderID" />
                  <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" IdentifierEntityName="WSCustomer" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomer" Name="CustomerID" />
                  <TypeDescriptor TypeName="System.String" Name="RegionID" />
                  <TypeDescriptor TypeName="System.String" Name="CurrencyCode" />
                  <TypeDescriptor TypeName="System.Decimal" Name="SubTotal">
                    <Properties>
                      <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                    </Properties>
                  </TypeDescriptor>
                  <TypeDescriptor TypeName="System.String" Name="OrderDate">
                    <Properties>
                      <Property Name="OfficeProperty" Type="System.String">Subject</Property>
                    </Properties>
                  </TypeDescriptor>
                  <TypeDescriptor TypeName="System.String" Name="ShipDate" />
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Type="SpecificFinder" ReturnParameterName="GetOrderByID" Default="true" Name="GetOrderByID" DefaultDisplayName="Read Item WSOrder">
              <Properties>
                <Property Name="LastDesignedOfficeItemType" Type="System.String">Task</Property>
              </Properties>
            </MethodInstance>
          </MethodInstances>
        </Method>
        <Method IsStatic="false" Name="GetOrders">
          <Parameters>
            <Parameter Direction="Return" Name="GetOrders">
              <TypeDescriptor TypeName="BCSServiceProxy.Order[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" Name="GetOrders">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="BCSServiceProxy.Order, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="GetOrdersElement">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="OrderID" Name="OrderID" />
                      <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" IdentifierEntityName="WSCustomer" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomer" Name="CustomerID" />
                      <TypeDescriptor TypeName="System.String" Name="RegionID" />
                      <TypeDescriptor TypeName="System.String" Name="CurrencyCode" />
                      <TypeDescriptor TypeName="System.Decimal" Name="SubTotal">
                        <Properties>
                          <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String" Name="OrderDate" />
                      <TypeDescriptor TypeName="System.String" Name="ShipDate" />
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Type="Finder" ReturnParameterName="GetOrders" Default="true" Name="GetOrders" DefaultDisplayName="WSOrder Read List">
              <Properties>
                <Property Name="UseClientCachingForSearch" Type="System.String"></Property>
                <Property Name="RootFinder" Type="System.String"></Property>
              </Properties>
            </MethodInstance>
          </MethodInstances>
        </Method>
        <Method IsStatic="false" Name="GetOrdersForCustomer">
          <Parameters>
            <Parameter Direction="In" Name="custid">
              <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" IdentifierEntityName="WSCustomer" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomer" Name="custid" />
            </Parameter>
            <Parameter Direction="Return" Name="GetOrdersForCustomer">
              <TypeDescriptor TypeName="BCSServiceProxy.Order[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" Name="GetOrdersForCustomer">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="BCSServiceProxy.Order, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="GetOrdersForCustomerElement">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="OrderID" Name="OrderID" />
                      <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" IdentifierEntityName="WSCustomer" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomer" Name="CustomerID" />
                      <TypeDescriptor TypeName="System.String" Name="RegionID" />
                      <TypeDescriptor TypeName="System.String" Name="CurrencyCode" />
                      <TypeDescriptor TypeName="System.Decimal" Name="SubTotal">
                        <Properties>
                          <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String" Name="OrderDate" />
                      <TypeDescriptor TypeName="System.String" Name="ShipDate" />
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <Association Name="GetOrdersForCustomer" Type="AssociationNavigator" ReturnParameterName="GetOrdersForCustomer" DefaultDisplayName="WSOrder Navigate Association">
              <Properties>
                <Property Name="ForeignFieldMappings" Type="System.String">
                  &lt;?xml version="1.0" encoding="utf-8"?&gt;
                  &lt;ForeignFieldMappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
                  &lt;ForeignFieldMappingsList&gt;
                  &lt;ForeignFieldMapping ForeignIdentifierName="CustomerID" ForeignIdentifierEntityName="WSCustomer" ForeignIdentifierEntityNamespace="SampleWebService" FieldName="CustomerID" /&gt;
                  &lt;/ForeignFieldMappingsList&gt;
                  &lt;/ForeignFieldMappings&gt;
                </Property>
              </Properties>
              <SourceEntity Namespace="SampleWebService" Name="WSCustomer" />
              <DestinationEntity Namespace="SampleWebService" Name="WSOrder" />
            </Association>
          </MethodInstances>
        </Method>
        <Method IsStatic="false" Name="GetOrdersForCustomerAndRegion">
          <Parameters>
            <Parameter Direction="In" Name="custid">
              <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" IdentifierEntityName="WSCustomer" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomerAndRegion" Name="custid" />
            </Parameter>
            <Parameter Direction="In" Name="regid">
              <TypeDescriptor TypeName="System.String" IdentifierName="RegionID" IdentifierEntityName="WSRegion" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomerAndRegion" Name="regtid" />
            </Parameter>
            <Parameter Direction="Return" Name="GetOrdersForCustomerAndRegion">
              <TypeDescriptor TypeName="BCSServiceProxy.Order[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" Name="GetOrdersForCustomerAndRegion">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="BCSServiceProxy.Order, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="GetOrdersForCustomerElement">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="OrderID" Name="OrderID" />
                      <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" IdentifierEntityName="WSCustomer" IdentifierEntityNamespace="SampleWebService" ForeignIdentifierAssociationName="GetOrdersForCustomer" Name="CustomerID" />
                      <TypeDescriptor TypeName="System.String" Name="RegionID" />
                      <TypeDescriptor TypeName="System.String" Name="CurrencyCode" />
                      <TypeDescriptor TypeName="System.Decimal" Name="SubTotal">
                        <Properties>
                          <Property Name="Decimal Digits" Type="System.Int32">4</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String" Name="OrderDate" />
                      <TypeDescriptor TypeName="System.String" Name="ShipDate" />
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <Association Name="GetOrdersForCustomerAndRegion" Type="AssociationNavigator" ReturnParameterName="GetOrdersForCustomerAndRegion" DefaultDisplayName="Orders for Customer and Region Navigate Association">
              <Properties>
                <Property Name="ForeignFieldMappings" Type="System.String">
                  &lt;?xml version="1.0" encoding="utf-8"?&gt;
                  &lt;ForeignFieldMappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
                  &lt;ForeignFieldMappingsList&gt;
                  &lt;ForeignFieldMapping ForeignIdentifierName="CustomerID" ForeignIdentifierEntityName="WSCustomer" ForeignIdentifierEntityNamespace="SampleWebService" FieldName="CustomerID" /&gt;
                  &lt;/ForeignFieldMappingsList&gt;
                  &lt;/ForeignFieldMappings&gt;
                </Property>
              </Properties>
              <SourceEntity Namespace="SampleWebService" Name="WSCustomer" />
              <SourceEntity Namespace="SampleWebService" Name="WSRegion" />
              <DestinationEntity Namespace="SampleWebService" Name="WSOrder" />
            </Association>
          </MethodInstances>
        </Method>
      </Methods>
      <AssociationGroups>
        <AssociationGroup Name="WSOrder-WSCustomer">
          <AssociationReference AssociationName="GetOrdersForCustomer" Reverse="false" EntityNamespace="SampleWebService" EntityName="WSOrder" />
        </AssociationGroup>
      </AssociationGroups>
    </Entity>
    

Étapes suivantes

Étape 8 de la création : Définir le type de contenu externe LineItem