In our previous blog posts we have already introduced to you how it is easy to create Business Connectivity Service External Content Types, upscale BDC application definition files and upsize SPD 2010 generated BCS models with BCS Meta Man. All these blog posts were done based off Microsoft SQL server. In this walkthrough we’ll show you how to create a BCS External Content Type, generate C# methods, and make an association for Oracle database tables.
1) Add a New Project
Expand the “SharePoint” node, select “Lightning Tools (2010)” node and then the “BCS Meta Man” project type
Give your project a name i.e OracleSecureStoreBCSMetaManDemo and click “OK”
2) On the next dialog box, enter the name of where you want to deploy your model, and click “Finish” button
If prompted, click “Trial” on the licensing dialog
3) Add System.Data.OracleClient reference to your project, which is in the following location,
4) When the BCS Meta Man design surface is in view you will find the BCS Meta Man menu item in the menu bar. Click on BCS Meta Man – > BCS Meta Man Data Source Explorer.
5) Click on the “Add Oracle Connection” button of the data source explorer.
6) In the connection dialog, setup connection to your oracle database.
7) If the connection is OK the treeview will populate with Oracle tables.
8) Drag and drop the Departments table to the design surface. In the Entity Creation wizard click on the Next button, select to generate all the methods and then click on the Generate button.
9) BCS Meta Man will add new files to the project which contain generated C# code. You’ll also see the External Content Type on the design surface.
10) At this point we have created a BCS external content type for Departments table. Please, do the same to create External Content Type for the Employees table too.
11) View the Visual Studio’s toolbox and choose the association action. Create an association between Departments(Source) and Employees(Destination) External Content Types. It will pop up a dialog for identifier mapping. Select DepartmentId in both dropdown boxes.
12) Click on OK and it will create an association between those two tables. You’ll find that it
automatically adds a new association method to the Employees External Content Type.
13) Rebuild the project and press CTRL+F5 to deploy the solution.
14) Go to your SharePoint site and add a new External List. Set either Departments or Employees as the External Content Type to use for the list. We want to make sure, that all the generated methods work properly.
15) When the External List is displayed, it calls the BCS Finder method to populate the records.
16) Click on the Items ribbon which is in the top. If Creator method is configured properly then it should be enabled.
17) Click on “New Item” and insert a record.
18) You can see the inserted record in the list.
19) Let’s check if the specific finder method works ok. Select any record in the list and go to Items ribbon. Click on View Item button.
20) “View Item” should execute the specific finder method.
21) And finally, let’s make sure that updater works properly. Select any item in the list, click on Items ribbon and then click on Edit Item button.
22) Update the name of the selected department and click on Save button.
23) When the list is re populated, you’ll see the updated record.
Well, we have made sure that all the generated methods(Finder, Specific Finder, Creator, Updater) work properly, but we have an association between Departments and Employees as well. So, let’s make sure it works ok too.
24) Edit the page of your SharePoint site, add add a BCS List and BCS Related List web part. Set Departments as the type for BCS list web part and Employees as the type for BCS related list web part. Connect those two web parts, so BCS List web part should send data to the Related List web part. Select any department in the list web part. This will execute the association method and populate appropriate employees in the related list web part.