Étapes de création 5 : définir le type de contenu externe Customer
Dernière modification : vendredi 16 avril 2010
S’applique à : SharePoint Server 2010
Dans cette étape, vous définissez un type de contenu externe nommé Customer. En plus des méthodes Finder et SpecificFinder habituelles, le type de contenu externe Customer définit également des méthodes Creator, Updater et Deleter qui permettent d’effectuer des opérations de création, de lecture, de mise à jour et de suppression dans le système externe.
La méthode WebGetCustomerByID, qui est utilisée comme la méthode SpecificFinder, est également réutilisée comme méthode d’association pour obtenir les adresses par ID de client. La méthode Web GetCustomerByID contient une collection d’adresses dans la structure de retour utilisée pour obtenir les adresses pour un client à l’aide d’associations. Vous n’avez donc pas besoin d’utiliser une méthode distincte comme méthode d’association. Vous pouvez réutiliser toute ou partie de la structure de retour d’une autre instance de méthode (SpecificFinder dans ce cas) comme méthode d’association.
L’entité Customer montre également le concept d’association d’entités autoréférencées. Les clients peuvent avoir des clients enfants. Dans le service BDC, cela est mis en place à l’aide des associations. La méthode Web GetChildCustomersForCustomer est utilisée pour retourner les clients enfants en fonction de l’ID client.
Les associations suivantes sont définies dans le type de contenu externe Customer :
CustomerToChildCustomers (méthode AssociationGetChildCustomersForCustomer définie dans le type de contenu externe Customer)
CustomerToAddress (méthode AssociationGetAddressesForCustomer définie dans le type de contenu externe Customer)
Conditions requises
Étapes de création 4 : Définir le type de contenu externe Address
Pour définir l'entité Customer
Ajoutez le code XML de l’entité Customer après l’élément d’entité Address et avant la balise de fin Entities (</Entities>).
<Entity Namespace="SampleWebService" Version="1.0.0.0" EstimatedInstanceCount="10000" Name="WSCustomer" DefaultDisplayName="WSCustomer"> <Properties> <Property Name="OutlookItemType" Type="System.String">Contact</Property> </Properties> <Identifiers> <Identifier TypeName="System.String" Name="CustomerID" /> </Identifiers> <Methods> <Method IsStatic="false" Name="GetCustomerByID"> <Parameters> <Parameter Direction="In" Name="id"> <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" Name="id" DefaultDisplayName="CustomerID" /> </Parameter> <Parameter Direction="Return" Name="GetCustomerByID"> <TypeDescriptor TypeName="BCSServiceProxy.Customer, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="GetCustomerByID"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="CustomerID" Name="CustomerID" /> <TypeDescriptor TypeName="System.String" Name="Name"> <Properties> <Property Name="OfficeProperty" Type="System.String">FullName</Property> </Properties> </TypeDescriptor> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="WorkPhoneNumber" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="MobilePhoneNumber" /> <TypeDescriptor TypeName="System.String" Name="Industry" /> <TypeDescriptor TypeName="System.String" Name="WebSite" /> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" Name="CustomerAddresses"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="CustomerAddressesElement"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerStreet, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="Street"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" Name="BlockNumber" /> <TypeDescriptor TypeName="System.String" Name="Street" /> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" Name="City" /> <TypeDescriptor TypeName="BCSServiceProxy.States, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="StateProvince" /> <TypeDescriptor TypeName="System.String" Name="CountryRegion" /> <TypeDescriptor TypeName="System.String" Name="PostalCode" /> </TypeDescriptors> </TypeDescriptor> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" Name="ParentCustomerID" /> <TypeDescriptor TypeName="System.Int32" Name="Version" /> <TypeDescriptor TypeName="System.DateTime" Name="ModifiedDate"> <Interpretation> <NormalizeDateTime LobDateTimeMode="UTC" /> </Interpretation> </TypeDescriptor> <TypeDescriptor TypeName="System.Boolean" Name="IsDeleted" /> </TypeDescriptors> </TypeDescriptor> </Parameter> </Parameters> <MethodInstances> <MethodInstance Type="SpecificFinder" ReturnParameterName="GetCustomerByID" Default="true" Name="GetCustomerByID" DefaultDisplayName="Read Item WSCustomer"> <Properties> <Property Name="LastDesignedOfficeItemType" Type="System.String">Contact</Property> </Properties> </MethodInstance> <Association Name="CustomerToAddresses" Type="AssociationNavigator" ReturnParameterName="GetCustomerByID" ReturnTypeDescriptorPath="GetCustomerByID.CustomerAddresses" DefaultDisplayName="Customer Child Customers Navigate Association"> <SourceEntity Namespace="SampleWebService" Name="WSCustomer" /> <DestinationEntity Namespace="SampleWebService" Name="WSAddress" /> </Association> </MethodInstances> </Method> <Method IsStatic="false" Name="GetCustomers"> <FilterDescriptors> <FilterDescriptor Type="Wildcard" FilterField="Name" Name="Filter"> <Properties> <Property Name="UsedForDisambiguation" Type="System.Boolean">false</Property> <Property Name="IsDefault" Type="System.Boolean">false</Property> <Property Name="CaseSensitive" Type="System.Boolean">false</Property> </Properties> </FilterDescriptor> </FilterDescriptors> <Parameters> <Parameter Direction="In" Name="name"> <TypeDescriptor TypeName="System.String" AssociatedFilter="Filter" Name="name" /> </Parameter> <Parameter Direction="In" Name="limit"> <TypeDescriptor TypeName="System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="limit" /> </Parameter> <Parameter Direction="Return" Name="GetCustomers"> <TypeDescriptor TypeName="BCSServiceProxy.Customer[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" Name="GetCustomers"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.Customer, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="GetCustomersElement"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="CustomerID" Name="CustomerID" /> <TypeDescriptor TypeName="System.String" Name="Name"> <Properties> <Property Name="ShowInPicker" Type="System.Boolean">true</Property> </Properties> </TypeDescriptor> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="WorkPhoneNumber" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="MobilePhoneNumber" /> <TypeDescriptor TypeName="System.String" Name="Industry" /> <TypeDescriptor TypeName="System.String" Name="WebSite" /> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" Name="CustomerAddresses"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="CustomerAddressesElement"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerStreet, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="Street"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" Name="BlockNumber" /> <TypeDescriptor TypeName="System.String" Name="Street" /> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" Name="City" /> <TypeDescriptor TypeName="BCSServiceProxy.States, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="StateProvince" /> <TypeDescriptor TypeName="System.String" Name="CountryRegion" /> <TypeDescriptor TypeName="System.String" Name="PostalCode" /> </TypeDescriptors> </TypeDescriptor> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" Name="ParentCustomerID" /> <TypeDescriptor TypeName="System.Int32" Name="Version" /> <TypeDescriptor TypeName="System.DateTime" Name="ModifiedDate"> <Interpretation> <NormalizeDateTime LobDateTimeMode="UTC" /> </Interpretation> </TypeDescriptor> <TypeDescriptor TypeName="System.Boolean" Name="IsDeleted" /> </TypeDescriptors> </TypeDescriptor> </TypeDescriptors> </TypeDescriptor> </Parameter> </Parameters> <MethodInstances> <MethodInstance Type="Finder" ReturnParameterName="GetCustomers" Default="true" Name="GetCustomers" DefaultDisplayName="WSCustomer 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="CreateCustomer"> <Parameters> <Parameter Direction="In" Name="customer"> <TypeDescriptor TypeName="BCSServiceProxy.Customer, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="customer"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" CreatorField="true" IdentifierName="CustomerID" Name="CustomerID" /> <TypeDescriptor TypeName="System.String" CreatorField="true" Name="Name" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" CreatorField="true" Name="WorkPhoneNumber" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" CreatorField="true" Name="MobilePhoneNumber" /> <TypeDescriptor TypeName="System.String" CreatorField="true" Name="Industry" /> <TypeDescriptor TypeName="System.String" CreatorField="true" Name="WebSite" /> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" CreatorField="true" Name="CustomerAddresses"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="CustomerAddressesElement"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerStreet, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="Street"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" Name="BlockNumber" /> <TypeDescriptor TypeName="System.String" Name="Street" /> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" Name="City" /> <TypeDescriptor TypeName="BCSServiceProxy.States, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="StateProvince" /> <TypeDescriptor TypeName="System.String" Name="CountryRegion" /> <TypeDescriptor TypeName="System.String" Name="PostalCode" /> </TypeDescriptors> </TypeDescriptor> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" CreatorField="true" Name="ParentCustomerID" /> <TypeDescriptor TypeName="System.Int32" CreatorField="true" Name="Version" /> <TypeDescriptor TypeName="System.DateTime" CreatorField="true" Name="ModifiedDate"> <Interpretation> <NormalizeDateTime LobDateTimeMode="UTC" /> </Interpretation> </TypeDescriptor> <TypeDescriptor TypeName="System.Boolean" CreatorField="true" Name="IsDeleted" /> </TypeDescriptors> </TypeDescriptor> </Parameter> <Parameter Direction="Return" Name="CreateCustomer"> <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" Name="CreateCustomer" /> </Parameter> </Parameters> <MethodInstances> <MethodInstance Type="Creator" ReturnParameterName="CreateCustomer" Default="true" Name="CreateCustomer" DefaultDisplayName="Create WSCustomer"> </MethodInstance> </MethodInstances> </Method> <Method IsStatic="false" Name="UpdateCustomer"> <Parameters> <Parameter Direction="In" Name="customer"> <TypeDescriptor TypeName="BCSServiceProxy.Customer, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="customer"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" UpdaterField="true" IdentifierName="CustomerID" Name="CustomerID" /> <TypeDescriptor TypeName="System.String" UpdaterField="true" Name="Name" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UpdaterField="true" Name="WorkPhoneNumber" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UpdaterField="true" Name="MobilePhoneNumber" /> <TypeDescriptor TypeName="System.String" UpdaterField="true" Name="Industry" /> <TypeDescriptor TypeName="System.String" UpdaterField="true" Name="WebSite" /> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress[], http://air-mail/WSOrders2010/service.asmx?wsdl" IsCollection="true" UpdaterField="true" Name="CustomerAddresses"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerAddress, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="CustomerAddressesElement"> <TypeDescriptors> <TypeDescriptor TypeName="BCSServiceProxy.CustomerStreet, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="Street"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" Name="BlockNumber" /> <TypeDescriptor TypeName="System.String" Name="Street" /> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" Name="City" /> <TypeDescriptor TypeName="BCSServiceProxy.States, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="StateProvince" /> <TypeDescriptor TypeName="System.String" Name="CountryRegion" /> <TypeDescriptor TypeName="System.String" Name="PostalCode" /> </TypeDescriptors> </TypeDescriptor> </TypeDescriptors> </TypeDescriptor> <TypeDescriptor TypeName="System.String" UpdaterField="true" Name="ParentCustomerID" /> <TypeDescriptor TypeName="System.Int32" UpdaterField="true" Name="Version" /> <TypeDescriptor TypeName="System.DateTime" UpdaterField="true" Name="ModifiedDate"> <Interpretation> <NormalizeDateTime LobDateTimeMode="UTC" /> </Interpretation> </TypeDescriptor> <TypeDescriptor TypeName="System.Boolean" UpdaterField="true" Name="IsDeleted" /> </TypeDescriptors> </TypeDescriptor> </Parameter> </Parameters> <MethodInstances> <MethodInstance Type="Updater" Name="UpdateCustomer" DefaultDisplayName="Update WSCustomer"> </MethodInstance> </MethodInstances> </Method> <Method IsStatic="false" Name="DeleteCustomer"> <Parameters> <Parameter Direction="In" Name="id"> <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" Name="id" /> </Parameter> </Parameters> <MethodInstances> <MethodInstance Type="Deleter" Name="DeleteCustomer" DefaultDisplayName="Delete WSCustomer"> </MethodInstance> </MethodInstances> </Method> <Method IsStatic="false" Name="GetChildCustomersForCustomer"> <Parameters> <Parameter Direction="In" Name="id"> <TypeDescriptor TypeName="System.String" IdentifierName="CustomerID" Name="id" DefaultDisplayName="CustomerID" /> </Parameter> <Parameter Direction="Return" Name="Customers"> <TypeDescriptor TypeName="BCSServiceProxy.Customer, http://air-mail/WSOrders2010/service.asmx?wsdl" Name="ArrayOfCustomers"> <TypeDescriptors> <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="CustomerID" Name="CustomerID" /> <TypeDescriptor TypeName="System.String" Name="Name" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="WorkPhoneNumber" /> <TypeDescriptor TypeName="System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="MobilePhoneNumber" /> <TypeDescriptor TypeName="System.String" Name="Industry" /> <TypeDescriptor TypeName="System.String" Name="WebSite" /> </TypeDescriptors> </TypeDescriptor> </Parameter> </Parameters> <MethodInstances> <Association Name="CustomerToChildCustomers" Type="AssociationNavigator" ReturnParameterName="Customers" DefaultDisplayName="Customer Child Customers Navigate Association"> <SourceEntity Namespace="SampleWebService" Name="WSCustomer" /> <DestinationEntity Namespace="SampleWebService" Name="WSCustomer" /> </Association> </MethodInstances> </Method> </Methods> </Entity>
Étapes suivantes
Étapes de création 6 : Définir le type de contenu externe Region