Step 5 (Optional): Define IDEnumerator Methods and Enable Business Data Search

SharePoint 2007

To enable Business Data Search, you must define a SpecificFinder and a special type of MethodInstance method called IDEnumerator in your metadata. Because you already defined a SpecificFinder method for the Product entity in Step 2, you only need to define an IDEnumerator method in this step. An IDEnumerator method returns a searchable list of IDs (unique key) for an entity. This list enables indexing of the entities whose IDs the IDEnumerator method returns.


If you require incremental crawl, then you must also make sure that one of the return fields in the IDEnumerator for the entity represents the time the entity instance (or row in database terminology) was last updated in the LOB application. You should then set the __BdcLastModifiedTimestamp property of the entity with the name of the TypeDescriptor in the return value of the IDEnumerator that represents the last modified date.

Entities have zero or one IDEnumerator. The definition for an IDEnumerator is exactly like a Finder method, except that it has zero filters and returns only the ID field or the ID and LastModifiedDate fields.

The following example shows you how to define an IDEnumerator to index and search for products in the AdventureWorks2000 database.


This example uses a Microsoft SQL Server 2000 database, which supports streaming of data. To improve performance for Web services and other non-streaming back-end applications, you should use the LastIdSeen filter in your IDEnumerator method as follows:

SELECT TOP 100 Id FROM Customers WHERE Id>=@LastIdSeen

  1. Open the AdventureWorks2000.XML file from Step 2, 3, or 4.

  2. Add the following XML for the IDEnumerator method in the Product Entity XML, after the GetProducts method definition:

            <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.-->
                <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>
                <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">
                      <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Product">
                          <TypeDescriptor TypeName="System.Int32" IdentifierName="ProductID" Name="ProductID">
                              <LocalizedDisplayName LCID="1033">ID</LocalizedDisplayName>
                <MethodInstance Name="ProductIDEnumeratorInstance"  Type="IdEnumerator" ReturnParameterName="ProductIDs" />
  3. Save the XML file.

  4. Before you add the application definition again, you must delete the AdventureWorksSample application you created in Step 1 from the Business Data Catalog. To delete AdventureWorksSample, follow these steps:

    1. Open SharePoint 3.0 Central Administration.

    2. In the left navigation pane, click the name of your Shared Services Provider (SSP).

    3. In the Business Data Catalog section, click View Applications to view the registered applications.

    4. Click AdventureWorksSample to open the View Application: AdventureWorksSample page.

    5. Finally, click Delete Application in the Application Settings section.

  5. Add the application definition to the Business Data Catalog. For details, see How to: Add an Application Definition to the Business Data Catalog.

  6. Add a content source.

  7. Map crawled properties.

  8. Create a search scope.

After you complete this walkthrough, content from the AdventureWorks2000 sample database is available for search queries. Next, you must customize the search user interface, or create custom search applications to execute queries against the business data content.

For information about performing these next steps, see:

Walkthrough: Add a Tab and Custom Search Page with Enterprise Search Web Parts to the Search Center

Walkthrough: Creating an ASP.NET Web Part for the AdventureWorks Business Data Application Sample