One issue with the Business Data Catalog was that you could only define one Finder method per Entity. This meant that if you wanted to use two different SQL Views that each returned different columns from a table you would have to actually create two completely different entities.
With Business Connectivity Services you can now define multiple Finder methods, and then pick within the UI or object model which method to use. In this walk through we show you how to use SharePoint Designer 2010 and the BCS to define multiple Finder methods for your External Content Types.
Pre-requisites..
- SharePoint Designer 2010
- A Data Source – We will be using the AdventureWorks2000 Products table
How to..
- Open SharePoint Designer 2010
- Connect to your SharePoint Site
- Click on ‘External Content Types’ from the Site Objects list
- Click ‘External Content Type’ (ECT) from the ‘New’ section of the ribbon
- Give your ECT a meaning full name – You just need to click on the existing text to edit
- Click the link in the External Content Type Operations section to ‘discover external data sources and define operations’
- Click ‘Add Connection’ and choose ’SQL Server’
- Enter your connection credentials and click OK
- Expand the tree view to show the ‘Products’ Table
- Right Click on the Table and choose ‘New Read List Operation’
- Change the ‘Operation Name’ and ‘Operation Display Name’ to “All Products and Information”, Click Next
- We are going to ignore the filter for now (you should usually add a filter when you are returning a large data set), click Next
- Click ‘Finish’ on the ‘Return Parameter Configuration’ screen
- We have now created a ‘Read List’ Finder method which returns all items from our Products table with all of the columns
- Right Click on the Table and choose ‘New Read List Operation’ again
- Change the ‘Operation Name’ and ‘Operation Display Name’ to “All Product Names”, Click Next
- Ignore the filter screen again – Click Next
- On the ‘Return Parameter Configuration’ screen uncheck all of the ‘Data Source Elements’ apart from ‘ProductID’ and ‘Name’
- Click ‘Finish’
- We now have our two ‘Finder’ methods defined
- Click ‘Save’
- The ECT will be saved to the BDC Metadata Store
- Once the document has been saved we can navigate to our SharePoint Site
- Add a ‘Business Data List’ Web Part to your page
- Click on the icon to bring up the ECT Picker
- Select the AdventureWorks Products ECT
- Click ‘OK’
- In the View section you have the 2 Finder methods that we created, the ‘All Products and Information’ and the ‘All Product Names’
- Select the default option of ‘All Products and Information’
- Click ‘’OK’
- All Products and Information are returned
- Click to edit the Web Part again
- Choose the ‘All Product Names’ View
- Click OK
- All the Product Names are now returned
<phill/>