Step 1: Create the BDC Model

Applies to: SharePoint Server 2010

You must provide information to the Microsoft Business Connectivity Services (BCS) Client Runtime about what external data source to connect to and how, and what data your advanced code-based Microsoft Outlook solution needs from that external data source. This is the purpose of the BDC model. For more information about BDC models and what they contain, see BDC Model Infrastructure.

The easiest way to create a BDC model file for your advanced code-based solution is to use Microsoft SharePoint Designer 2010 to create all the external content types that are involved in your solution, define any associations between them, and then export the model for the external content types. The steps are outlined below. You must name this file Metadata.bdcm.

If your external content type cannot be created by using SharePoint Designer, you can create the model file by using any XML editor, including Microsoft Visual Studio. Visual Studio can provide IntelliSense functionality, which can be helpful when you are creating the model file. Use the Business Connectivity Services Sample XML Snippets and the BDCMetadata Schema documentation as resources to help you create a model file. The schema file, BDCMetadata.xsd, is available at BDCMetadata.xsd.

Prerequisites

  1. Create a folder on your development computer to store the solution artifacts.

  2. Name this folder Solution Artifacts (this is the name that is used throughout this walkthrough).

  3. Download the AdventureWorks2008 sample database from Sample Databases for Microsoft SQL Server 2008 and install it on a server.

  4. Download the Code Sample: AdventureWorks2008 ASP.NET Web Service that is included in the Microsoft SharePoint 2010 Software Development Kit (SDK).

  5. Deploy the service on a web server, as specified in the Readme file that accompanies the web service.

To create the BDC model

  1. Create the Customer external content type by using SharePoint Designer as described in How to: Create an External Content Type Based on a Web Service. Then, use the same procedure to create the Order external content type based on OrderHeader web methods in the AdventureWorks web service in SharePoint Designer.

  2. Create an association between Customer and Order. You can look at the How to: Add an Association Between Two Web Service-Based External Content Types topic for instructions about how to create an association.

  3. Click External Content Types in the left navigation in SharePoint Designer so that you can see the Customer and Order external content types listed in the right pane.

  4. Select both Customer and Order, and then, on the External Content Types tab of the ribbon, in the Manage group, click Export BDC Model . Name the file Metadata and save it in your Solution Artifacts folder. The generated XML file contains the external content type definitions of both Customer and Order, and also includes the association between them.

    Export BDC model

You have successfully created a BDC model for the Customer and Order external content types in the AdventureWorks Sample web service. For your convenience, the contents of the Metadata.bdcm file are provided to you. If you do not want to create the external content types to test this SDK sample, you can simply copy the contents of the provided Metadata.bdcm file to a text file, edit the web service connection parameters, and save it to your Solution Artifacts folder as Metadata.bdcm.

Next Steps

Step 2: Create a Cache Subscription