SharePoint Designer 2010 is a great tool for putting together simple External Content Types, but often you will want to create your External Content Types in Visual Studio to give you the full power of c# code. Unfortunately with the BCS tooling that comes with Visual Studio there is no way to take a model built in SharePoint Designer 2010 and upscale it to a Dot Net Assembly based model. Using BCS Meta Man however you can do exactly this. BCS Meta Man will allow you to select your BCS Model built by SharePoint Designer and then generate all the c# methods and BCS model you need to be able to then take it further and customize it any way you like.
In this blog post we will show you how to create an External Content Type with SharePoint Designer 2010 and then upsize them with BCS Meta Man.
1) Open SharePoint Designer 2010 and click on Open Site.
2) Enter your SharePoint site’s URL. In the left side you’ll see the navigation panel, select External Content Types.
3) At the top you can find the “External Content Type” button, click on it to create a new BCS External Content Type.
4) Set the Name, Display name(Departments) of your new External Content Type and click on the hyperlink to discover External Systems
5) When you click on the hyperlink, a new page will be opened to set up a connection to your back end database/WCF service or .Net assembly. Click on Add Connection button.
6) Select SQL Server
7) Set parameters for the connection to your database. In our walkthroughs we use Adventure Works database. Click OK.
8) Expand the populated treeview, select the Departments, right click on it and select Create all operations.
9) Click on Finish, so SharePoint Designer will create all the methods for your BCS External Content Type.
10) Press CTRL+S to save our Departments External Content Type
11) Please repeat the same steps and create another external content type for Employee table of the AdventureWorks database. Name it Employees.
12) Now we need to export these two external content types to XML file so that we can upscale them in BCS Meta Man. Select both external content types, right click on them and select Export Application Model.
13) Set the Model Name.
14) Set where our application model should be exported to.
Now we have a BCS application model of Departments and Employees External Content Types. Next we need to upsize it in BCS Meta Man. BCS Meta Man will generate C# code for all the methods that you have defined in SharePoint Designer and also we will create an Association between them easily.
15) Open up Visual Studio 2010 and create a new empty SharePoint project.
16) Right click on the the project and add a new BCS Meta Man item to the project.
17) When the project item is added, BCS Meta Man’s design surface is opened. Go to menu bar and select BCS Meta Man->Import SPD generated XML file.
18) File open dialog will appear. Select the BCS application model we generated from SharePoint Designer
19) BCS Meta Man will now create External Content Types for Departments and Employees ECTs that we created with SPD 2010. It will add new c# files to your project so you can modify c# methods that have been generated by BCS Meta Man for each BCS method
20) View the toolbox and create an association between those two External Content Types.
21) Rebuild the project and press CTRL+F5 to deploy the solution.
22) Open your SharePoint site, add BCS List and BCS Related List web parts to the page. Set Departments as a type for List web part, and Employees as a type for Related List web part. Connect those two web parts so List web part should send data to the related list web part. When everything is done you can select an item in Departments list web part and see associated data in related list web part.
23) Now, let’s see if Creator and Updater methods have been upsized properly. Create a new External List in your SharePoint site and set Departments as a type for that list.
You’ll see that “New Item” and “Edit Item” buttons are enabled, which means BCS Meta Man has declared(upsized) those methods properly, try to insert and update some departments
<hrayr/>