Upscale a BCS Model created in SharePoint Designer 2010

 BCS Meta Man, Business Connectivity Services, SharePoint 2010.

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.

Open SharePoint site

2) Enter your SharePoint site’s URL. In the left side you’ll see the navigation panel, select External Content Types.

Select External Content Type

3) At the top you can find the “External Content Type” button, click on it to create a new BCS External Content Type.

Create a new 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

Set ECT properties

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.

Add a new connection

6) Select SQL Server

SQL Server connection

7) Set parameters for the connection to your database. In our walkthroughs we use Adventure Works database. Click OK.

SQL Server connection properties

8) Expand the populated treeview, select the Departments, right click on it and select Create all operations.

Create all External Content Type operations

9) Click on Finish, so SharePoint Designer will create all the methods for your BCS External Content Type.

Complete ECT method creation

10) Press CTRL+S to save our Departments External Content Type

Save 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.

Export External Content Types

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.

Export our BCS Model

13) Set the Model Name.

Set Model Name

14) Set where our application model should be exported to.

set location to save our model

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.

Create empty SharePoint project

16) Right click on the the project and add a new BCS Meta Man item to the project.

Add a BCS Meta Man project item

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.

Import SPD generated XML file

18) File open dialog will appear. Select the BCS application model we generated from SharePoint Designer

select the BCS Model to Open

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

BCS Meta Man upscales our External Content Types

20) View the toolbox and create an association between those two External Content Types.

Create a BCS association

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.

Display BCS data in web parts

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

New Item and Edit Item buttons are available

<hrayr/>

2 comments on “Upscale a BCS Model created in SharePoint Designer 2010

  1. Kasino Guide on said:

    This article demonstrates how to create a reusable component in ASP.NET 2.0 and then consume it from an ASP.NET page. Also learn how the ObjectDataSource control can be used to directly bind the output of an object to the controls in an ASP.NET page and how precompilation can be used to increase the performance of the Web application and catch compilation errors…..

  2. Caridad Reyes on said:

    Quiero probar lo que cuentas …. mi problema es que instale el Visual Studio 2010 en mi PC, pensando que podria creame un proyecto de “Modelo de conectividad BCS” y no me deja, dice que necesito tener el Sharepoint instalado.Mi pregunta es, para desarrollar se requiere que sea en el mismo PC donde este instalado el Sharepoint 2010? O que se puede hacer?Graciassss

Leave a Reply

Your email address will not be published. Required fields are marked *

*

HTML tags are not allowed.