Create BCS Filters using BCS Meta Man

In this walkthrough we will demonstrate how to define BCS filters for BCS External Content Types in BCS Meta Man. As of BCS Meta Man alpha 2 (released 22nd Jan 2010) we support filters for SQL and Oracle. In this sample we will use SQL server, but you can use the same steps for Oracle and define filters for Oracle tables as well.

1) Open up Visual Studio 2010 and create a new empty SharePoint project.

Create an Empty SharePoint Project

2) Add a new BCS Meta Man item to your project.


3) When the BCS Meta Man diagram is open, in the menu bar click on BCS Meta Man-> BCS Meta Man Data Source Explorer

Open BCS Meta Man Data Source Explorer

4) When the Data Source Explorer is shown, click on the Add SQL Connection button.

Add SQL Connection

5) In the connection dialog, set the connection parameters to your SQL database. We use the AdventureWorks database for our walkthroughs.

Enter SQL Connection properties

6) If the connection is successful it will populate the explorer treeview with our databases that you can expand to show the tables available.

Data Source Explorer with tables

7) Drag and drop any two tables you want, in this walkthrough we use Employees and Product tables; we will define a comparison filter for the Product table and a Wildcard for Employee. Your diagram should look like this.

Create two External Content Types

8) Right click on the Employee table and choose Manage Entity.

Right click and choose Manage Entity

9) In the Entity Management dialog go to Methods tab and select the Finder method.

Go to Methods tab and select Finder method

10) Click on New button in the Filter section and configure a Wildcard filter for the Employee table’s Finder method. Click on Save button, and then Save the modifications.

Create a new Wildcard Filter

11) Using the above mentioned steps, define a Comparison filter for the Product table.

Create a new Comparison Filter

12) If you open the generated service c# classes, you’ll find that c# methods have been modified to accept input parameters that will be used to filter the data being returned

13) Rebuild the project and press CTRL+F5 to deploy the solution.

14) Go to your SharePoint site, and add two BCS List web parts. Set Employee as a type for one of them and Product as a type for the other BCS List web part.

Add 2 BCS List web parts to your page

15) Try to enter some filter values to display the records.

Configure and test your External Content Types with the filters