Compartilhar via


Exemplo: AdventureWorks2000 passagem de metadados

Este é o completo XML para o AdventureWorks2000 exemplo descrito essa seção. Este metadados usa autenticação passagem para conectar para o banco de dados AdventureWorks SQL Server 2000.

Dica

A única diferença entre o exemplo sign-on único XML AdventureWorks2000 e o exemplo AdventureWorks2000 PassThrough XML é nos metadados para o objeto LobSystemInstance LobSystemInstance.O restante de metadados é idêntico.

Nos metadados LobSystemInstance LobSystemInstance, substituir o nome do computador a execução SQL Server que hospeda o banco de dados AdventureWorks2000 no Rdb Connection Source Rdb Connection Source propriedade apropriadamente. Se você usar um instância do SQL Server, use o formato, SQLServer\Instance. Para obter instruções detalhadas sobre como usar esse exemplo, consulte Exemplo SQL Server 2000 AdventureWorks.

Os metadados

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<!-- This metadata XML defines three entities: Product, Customer, 
and SalesOrder from the AdventureWorks 2000 Sample database.-->
<!-- The Business Data Catalog treats the LobSystem name as the 
applicaton name. This is the name that appears in the 
Administration user interface. However, the clients such as the 
Business Data Web Parts and Lists use the LobSystemInstance 
name in the entity picker, and so on. -->
<LobSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="https://schemas.microsoft.com/office/2006/03/BusinessDataCatalog BDCMetadata.xsd" Type="Database" 
Version="1.0.0.0" name="AdventureWorksSample" 
xmlns="https://schemas.microsoft.com/office/2006/03/BusinessDataCatalog">
  <!-- Version represents the version number for the application 
  definition. Use the format - major.minor[.build[.revision]].
  -->
  <Properties>
    <!-- The Business Data Catalog uses the wildcard character 
    specified here with filter parameters. You should enter the 
    wildcard character that your back-end Lob application uses 
    here. The Business Data Catalog will automatically transform
    the Business Data Catalog wildcard '*' into the back-end 
    system wildcard character ('%' in this case)-->
    <Property name="WildcardCharacter" Type="System.String">%</Property>
  </Properties>
  <LobSystemInstances>
    <LobSystemInstance name="AdventureWorksSampleInstance">
      <!-- Business Data clients such as the Web Parts and Lists use 
      the LobSystemInstance name in the entity picker, and so on.-->
      <Properties>
        <Property name="AuthenticationMode" 
Type="System.String">PassThrough</Property>
        <!--AuthenticationMode can be set to PassThrough, 
        RevertToSelf, RdbCredentials, or WindowsCredentials. -->
        <Property name="DatabaseAccessProvider" 
Type="System.String">SqlServer</Property>
        <!-- Can be SqlServer, OleDb, Oracle, or Odbc for database 
        systems. -->
        <Property name="RdbConnection Data Source" Type="System.String">EnterYourAdventureWorks2000ServerNameHere</Property>
        <!-- The name of your server hosting the AdventureWorks2000 
             database or the name of the SQL Server instance in the 
             format SQLServer\Instance. -->
        <Property name="RdbConnection Initial Catalog" 
    Type="System.String">AdventureWorks2000</Property>
        <!-- The name of the database.> -->
        <Property name="RdbConnection Integrated Security" 
Type="System.String">SSPI</Property>
        <!--This turns off connection pooling. -->
        <Property name="RdbConnection Pooling" 
Type="System.String">false</Property>
      </Properties>
    </LobSystemInstance>
  </LobSystemInstances>
  <Entities>
    <Entity EstimatedInstanceCount="10000" name="Product">
      <!-- EstimatedInstanceCount is an optional attribute-->
      <Properties>
        <Property name="Title" Type="System.String">Name</Property>
        <!-- Specifies the name of the TypeDescriptor 
        that corresponds to the column you want to display 
        as the default column in Business Data lists
        It also specifies which column in the Business Data   
        List/Related List Web part displays the Actions menu.-->
      </Properties>
      <Identifiers>
        <Identifier name="ProductID" Typename="System.Int32" />
        <!-- Once defined, TypeDescriptors can be tagged with the 
        Identifier to denote where the Business Data Catalog should 
        plug in identifier values on input and read identifier values 
        on output.  -->
        <!-- If the entity uses a combination of keys to uniquely 
        identify an entity instance, define multiple 
        identifiers. The Business Data Catalog will use the 
        combination to idenitfy entity instances.-->
      </Identifiers>
      <Methods>
        <!-- Defines a method that brings back Product data from the 
        back-end database. Methods are not executable until 
        instantiated (referenced) by MethodInstances. -->
        <Method name="GetProducts">
          <Properties>
            <Property name="RdbCommandText" Type="System.String">
              SELECT ProductID, Name, ProductNumber, ListPrice FROM Product WHERE (ProductID &gt;= @MinProductID) AND (ProductID &lt;= @MaxProductID) AND (Name LIKE @Name) AND (ProductNumber LIKE @ProductNumber)
            </Property>
            <Property name="RdbCommandType" Type="System.Data.CommandType">Text</Property>
            <!-- For database systems, can be Text, StoredProcedure, 
            or TableDirect. -->
          </Properties>
          <FilterDescriptors>
            <!-- Define the filters supported by the back-end method 
           (or sql query) here. -->
            <!-- Once a FilterDescriptor is defined, the metadata 
            author can tag TypeDescriptors of input parameters with it. 
            When the Business Data Catalog instantiates the parameters 
            to execute the method it will plug in user or system 
            provided values into these tagged slots automatically, 
            overriding the default values. -->
            <FilterDescriptor Type="Comparison" name="ID" >
              <Properties>
                <!-- Equals is the default and may be omitted. -->
                <Property name="Comparator" Type="System.String">Equals</Property>
              </Properties>
            </FilterDescriptor>
            <FilterDescriptor Type="Wildcard" name="Name">
              <Properties>
                <Property name="UsedForDisambiguation" Type="System.Boolean">true</Property>
                <!-- The UsedForDisambiguation property is optional 
                and is used by the entity instance picker (Business 
                Data in Lists and Business Data Item Web Part). 
                Users use the picker to pick a single instance of an 
               entity and if their input partially matches many entity 
               instances, the picker will display a list of matches to 
               help the user disambiguate. This property tells the 
               Business Data Catalog to use this filter for doing the 
               partial match query. -->
              </Properties>
            </FilterDescriptor>
            <FilterDescriptor Type="Wildcard" name="ProductNumber" />
          </FilterDescriptors>
          <Parameters>
            <!-- Parameter name must match the parameter name in the
                 Sql query and in the stored procedure. -->
            <Parameter Direction="In" name="@MinProductID">
              <TypeDescriptor Typename="System.Int32" Identifiername="ProductID" AssociatedFilter="ID" name="MinProductID">
                <!-- The AssociatedFilter attribute is required 
                above because it's an input parameter and 
                represents a filter column.-->
                <!-- However, the AssociatedFilter attribute should 
                not be used in return parameter's type 
                descriptors. -->
                <!-- The IdentifierName attribute on an input 
                TypeDescriptor signals the Business Data Catalog to 
                insert the identifier value of the entity instance of 
                relevance before executing the method. For example, if 
                this is part of a SpecificFinder MethodInstance, the 
                user has probably provided the identifier value for the 
                entity instance they want retrieved. The Business Data 
                Catalog will insert that value into this slot after 
                fully instantiating this parameter using all the 
                default values. -->
                <!-- The AssociatedFilter attribute on an input 
                TypeDescriptor signals the Business Data Catalog to 
                insert the user or system provided value after 
                instantiating the parameter and before executing the 
                method. For example, if this is part of a Finder 
                MethodInstance, the user will have provided values for 
               some or all the filters associated with the method. 
               These will be inserted into the tagged slots before 
               method execution. In this case, whatever the user 
               supplied for the ID Comparison filter will be 
               inserted. -->
                <DefaultValues>
                  <!-- Default Values differ across MethodInstances so 
                that the parameter can be instantiated with different 
                 values when executing different MethodInstances. In 
                 this case, when executing the Finder, the Default 
                 Value will be 0 and when executing any other 
                 MethodInstance, the value will be NULL (But the NULL 
                 will be changed to a 0 because the default value type 
                 is non-nullable Int32.  -->
                  <DefaultValue MethodInstancename="ProductFinderInstance" Type="System.Int32">0</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In" name="@MaxProductID">
              <TypeDescriptor Typename="System.Int32" Identifiername="ProductID" AssociatedFilter="ID" name="MaxProductID">
                <DefaultValues>
                  <DefaultValue MethodInstancename="ProductFinderInstance" Type="System.Int32">99999999</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In" name="@Name">
              <TypeDescriptor Typename="System.String" AssociatedFilter="Name" name="Name">
                <DefaultValues>
                  <DefaultValue MethodInstancename="ProductFinderInstance" Type="System.String">%</DefaultValue>
                  <DefaultValue MethodInstancename="ProductSpecificFinderInstance" Type="System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In" name="@ProductNumber">
              <TypeDescriptor Typename="System.String" AssociatedFilter="ProductNumber" name="ProductNumber">
                <DefaultValues>
                  <DefaultValue MethodInstancename="ProductFinderInstance" Type="System.String">%</DefaultValue>
                  <DefaultValue MethodInstancename="ProductSpecificFinderInstance" Type="System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return" name="Products">
              <TypeDescriptor Typename="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" name="ProductDataReader">
                <!-- Typenames that are interfaces are permissible on 
               return parameters but not input, output or ref type 
               parameters. This is because the latter need to be 
               instantiated, requiring concrete types. -->
                <!-- For database systems, the root TypeDescriptor of the 
              return parameter always has the IsCollection flag set. 
             This is because all output from a database is a record 
             stream regardless of the semantic context that is whether 
             a single record (SpecificFinder/ViewAccessor) or multiple 
             records (Finder) are expected. . -->
                <TypeDescriptors>
                  <!-- Database systems are modeled as a stream of records.
             Hence the root TypeDescriptor is a stream and the next 
             level TypeDescriptor is a record. Even though a record is 
              a collection of columns, the IsCollection is not set 
              because we want the Business Data Catalog to treat it as 
              a structure of strongly typed fields.  -->
                  <TypeDescriptor Typename="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ProductDataRecord">
                    <TypeDescriptors>
                      <TypeDescriptor Typename="System.Int32" Identifiername="ProductID" name="ProductID">
                        <!-- The TypeDescriptors in the return parameter 
                represent the Fields of the IEntityInstance constructed 
                by the Business Data Catalog and returned to the user 
                for display/manipulation. The IEntityInstance provides 
                an abstract access mechanism for fields and and the 
               identifier values of the instance. Since the identifier 
                values are promoted within the IEntityInstance for 
               direct access, we need to identify which TypeDescriptor  
                actually provides these values. We do this by tagging 
                the output/return Parameter's TypeDescriptor with the 
                IdentifierName attribute. -->
                        <!-- Do not use the IdentifierEntityName 
                        attribute in return parameters. -->
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.String" name="Name" >
                        <!-- Do not use the AssociatedFilter 
                        attribute in return parameters.-->
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Name</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                          <!-- DisplayByDefault is optional and even 
                          if it's not specified, you will still be 
                          able to choose the column from the Web 
                          Parts and List.-->
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.String" name="ProductNumber">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Product Number</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.Decimal" name="ListPrice">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">List Price</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <!-- MethodInstance objects can optionally take a 
            TypeDescriptor along with the return parameter name. 
            For details, see the SampleWebServiceMetadata.-->
            <MethodInstance name="ProductFinderInstance" Type="Finder" ReturnParametername="Products" />
            <MethodInstance name="ProductSpecificFinderInstance" Type="SpecificFinder" ReturnParametername="Products" />
          </MethodInstances>
        </Method>
        <Method name="ProductIDEnumerator">
          <!-- Method for enabling business data search. The method 
          returns a list of IDs. Business Data Catalog will use the 
          SpecificFinder method on each of these IDs when indexing 
          the prodocuts.-->
          <Properties>
            <Property name="RdbCommandText" Type="System.String">SELECT ProductID FROM Product WHERE ProductID &gt; 1200 AND ProductID &lt; 1300</Property>
            <Property name="RdbCommandType" Type="System.String">Text</Property>
          </Properties>
          <Parameters>
            <Parameter name="ProductIDs" Direction="Return">
              <TypeDescriptor Typename="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" name="Products">
                <TypeDescriptors>
                  <TypeDescriptor Typename="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Product">
                    <TypeDescriptors>
                      <TypeDescriptor Typename="System.Int32" Identifiername="ProductID" name="ProductID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance name="ProductIDEnumeratorInstance"  Type="IdEnumerator" ReturnParametername="ProductIDs" />
          </MethodInstances>
        </Method>
      </Methods>
      <!-- Enter your Action XML here -->
      <Actions>
        <Action name="Search on MSN" Position="1" IsOpenedInNewWindow="true" 
                Url="https://search.msn.com/results.aspx?q={0}" ImageUrl="">
          <ActionParameters>
            <ActionParameter name="Name" Index="0" />
          </ActionParameters>
        </Action>
      </Actions>
    </Entity>
    <Entity EstimatedInstanceCount="10000" name="SalesOrder">
      <LocalizedDisplayNames>
        <LocalizedDisplayName LCID="1033">Sales Order</LocalizedDisplayName>
      </LocalizedDisplayNames>
      <Identifiers>
        <Identifier name="SalesOrderID" Typename="System.Int32" />
      </Identifiers>
      <Methods>
        <Method name="GetSalesOrders">
          <Properties>
            <Property name="RdbCommandText" Type="System.String">
              SELECT SalesOrderID, OrderDate, SubTotal, IndividualID
              FROM SalesOrderHeader, Individual WHERE (SalesOrderID &gt;= @MinSalesOrderID)
              AND (SalesOrderID &lt;= @MaxSalesOrderID) AND (SalesOrderNumber LIKE @SalesOrderNumber)
              AND SalesOrderHeader.CustomerID = Individual.CustomerID
            </Property>
            <Property name="RdbCommandType" Type="System.String">Text</Property>
          </Properties>
          <FilterDescriptors>
            <FilterDescriptor Type="Comparison" name="ID" >
              <Properties>
                <Property name="Comparator" Type="System.String">Equals</Property>
              </Properties>
            </FilterDescriptor>
            <FilterDescriptor Type="Wildcard" name="SalesOrderNumber" />
          </FilterDescriptors>
          <Parameters>
            <Parameter Direction="In"  name="@MinSalesOrderID">
              <TypeDescriptor Typename="System.Int32" Identifiername="SalesOrderID" 
                              AssociatedFilter="ID" name="MinSalesOrderID">
                <DefaultValues>
                  <DefaultValue MethodInstancename="SalesOrderFinderInstance" Type="System.Int32">0</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In"  name="@MaxSalesOrderID">
              <TypeDescriptor Typename="System.Int32" Identifiername="SalesOrderID" AssociatedFilter="ID" name="MaxSalesOrderID">
                <DefaultValues>
                  <DefaultValue MethodInstancename="SalesOrderFinderInstance" Type="System.Int32">99999999</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In"  name="@SalesOrderNumber">
              <TypeDescriptor Typename="System.String" AssociatedFilter="SalesOrderNumber" name="SalesOrderNumber">
                <DefaultValues>
                  <DefaultValue MethodInstancename="SalesOrderFinderInstance" Type="System.String">%</DefaultValue>
                  <DefaultValue MethodInstancename="SalesOrderSpecificFinderInstance" Type="System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return"  name="SalesOrders">
              <TypeDescriptor Typename="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" name="SalesOrderDataReader">
                <TypeDescriptors>
                  <TypeDescriptor Typename="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="SalesOrderDataRecord">
                    <TypeDescriptors>
                      <TypeDescriptor Typename="System.Int32" Identifiername="SalesOrderID" name="SalesOrderID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.DateTime" name="OrderDate">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Order Date</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.Int32" name="IndividualID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">IndividualID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.Decimal" name="SubTotal">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">SubTotal</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance name="SalesOrderFinderInstance" Type="Finder" ReturnParametername="SalesOrders" />
            <MethodInstance name="SalesOrderSpecificFinderInstance" Type="SpecificFinder" ReturnParametername="SalesOrders" />
          </MethodInstances>
        </Method>
      </Methods>
    </Entity>
    <Entity EstimatedInstanceCount="10000" name="Customer">
      <Properties>
        <Property name="Title" Type="System.String">FirstName</Property>
      </Properties>
      <Identifiers>
        <Identifier name="IndividualID" Typename="System.Int32" />
      </Identifiers>
      <Methods>
        <Method name="GetCustomers">
          <Properties>
            <Property name="RdbCommandText" Type="System.String">SELECT * FROM Individual WHERE (IndividualID &gt;= @MinIndividualID) AND (IndividualID &lt;= @MaxIndividualID) AND ((FirstName+' '+LastName) LIKE @Name)</Property>
            <Property name="RdbCommandType" Type="System.String">Text</Property>
          </Properties>
          <FilterDescriptors>
            <FilterDescriptor Type="Comparison" name="ID" >
              <Properties>
                <Property name="Comparator" Type="System.String">Equals</Property>
              </Properties>
            </FilterDescriptor>
            <FilterDescriptor Type="Wildcard" name="Name" />
          </FilterDescriptors>
          <Parameters>
            <Parameter Direction="In"  name="@MinIndividualID">
              <TypeDescriptor Typename="System.Int32" Identifiername="IndividualID" AssociatedFilter="ID" name="MinIndividualID">
                <DefaultValues>
                  <DefaultValue MethodInstancename="CustomerFinderInstance" Type="System.Int32">0</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In"  name="@MaxIndividualID">
              <TypeDescriptor Typename="System.Int32" Identifiername="IndividualID" AssociatedFilter="ID" name="MaxIndividualID">
                <DefaultValues>
                  <DefaultValue MethodInstancename="CustomerFinderInstance" Type="System.Int32">99999999</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In"  name="@Name">
              <TypeDescriptor Typename="System.String" AssociatedFilter="Name" name="Name">
                <DefaultValues>
                  <DefaultValue MethodInstancename="CustomerFinderInstance" Type="System.String">%</DefaultValue>
                  <DefaultValue MethodInstancename="CustomerSpecificFinderInstance" Type="System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return"  name="Customers">
              <TypeDescriptor Typename="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" name="CustomerDataReader">
                <TypeDescriptors>
                  <TypeDescriptor Typename="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="CustomerDataRecord">
                    <TypeDescriptors>
                      <TypeDescriptor Typename="System.Int32" Identifiername="IndividualID" name="IndividualID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.String" name="FirstName">
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.String" name="LastName">
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance name="CustomerFinderInstance" Type="Finder" ReturnParametername="Customers" />
            <MethodInstance name="CustomerSpecificFinderInstance" Type="SpecificFinder" ReturnParametername="Customers" />
          </MethodInstances>
        </Method>
        <Method name="GetSalesOrdersForCustomer">
          <!-- This is the MethodInstance that contains the association 
         logic.   The association logic (MethodInstance) can be on any 
        entity, either source or destination or an unrelated entity.-->
          <!-- The order in which you define the source and destination 
          entities is very important because the XML file is processed 
          from top to bottom. Therefore, ensure that the entities 
          referenced in the association method are defined before the 
          entity containing the association method. -->
          <Properties>
            <Property name="RdbCommandText" Type="System.String">SELECT SalesOrderID, OrderDate, SubTotal,Individual.IndividualID FROM SalesOrderHeader,Individual WHERE SalesOrderHeader.CustomerID=Individual.CustomerID and Individual.IndividualID=@IndividualID</Property>
            <Property name="RdbCommandType" Type="System.String">Text</Property>
          </Properties>
          <Parameters>
            <!-- An Association MethodInstance contains slots in 
                the input for the identifier values of the source 
                 entity instance, and a slot in the output for the 
                 identifier values of the destination entity instances. 
                 Therefore, you must tag enough input type descriptors 
                 tagged with identifiers corresponding to each 
                 identifier of each entity that is a source in the 
                 association in the association method.-->
            <!-- The IdentifierName attribute on an input 
                TypeDescriptor signals the Business Data Catalog to 
                insert the identifier value of the entity instance of 
                relevance before executing the method. For example, in 
                an Association MethodInstance, the 
                user has probably provided the identifier values for 
                all the source entity instances entity instance they 
                want retrieved. The Business Data Catalog will insert 
                that value into this slot after fully instantiating 
                this parameter using all the default values. -->
            <Parameter Direction="In"  name="@IndividualID">
              <TypeDescriptor Typename="System.Int32" Identifiername="IndividualID" name="IndividualID" />
            </Parameter>
            <Parameter Direction="Return"  name="SalesOrders">
              <TypeDescriptor Typename="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" name="SalesOrderDataReader">
                <TypeDescriptors>
                  <TypeDescriptor Typename="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="SalesOrderDataRecord">
                    <TypeDescriptors>
                      <!-- An Association MethodInstance contains a slot in 
               the output for the identifier values of the destination 
               entity instances.Therefore, you should tag enough type 
               descriptors with identifiers corresponding to each 
               identifier of the destination entity in the 
               association. -->
                      <TypeDescriptor Typename="System.Int32" IdentifierEntityname="SalesOrder" Identifiername="SalesOrderID" name="SalesOrderID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.DateTime" name="OrderDate">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Order Date</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.Int32" name="IndividualID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">IndividualID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Typename="System.Decimal" name="SubTotal">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">SubTotal</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
        </Method>
      </Methods>
      <Actions>
        <Action name="Send Email" Position="1" IsOpenedInNewWindow="true" Url="mailto:{0}.msn.com" ImageUrl="">
          <ActionParameters>
            <ActionParameter name="FirstName" Index="0" />
          </ActionParameters>
        </Action>
      </Actions>
    </Entity>
  </Entities>
  <Associations>
    <Association AssociationMethodEntityname="Customer" AssociationMethodname="GetSalesOrdersForCustomer" AssociationMethodReturnParametername="SalesOrders" name="CustomerToSalesOrder" IsCached="true">
      <!-- Associations are just subclasses of MethodInstances. 
      They can also take ReturnTypeDescriptorName optionally to
      point to a TypeDescriptor nested deep in the return structure.
      For a sample, see SampleWebService Metadata in the SDK.-->
      <SourceEntity name="Customer" />
      <DestinationEntity name="SalesOrder" />
      <!-- The source and destination entities can be the same. 
      For a sample, see the SampleWebService Metadata sample.-->
    </Association>
  </Associations>
</LobSystem>

Consulte também

Outros recursos

Exemplo SQL Server 2000 AdventureWorks