Step 1: Create the BDC Model (Metadata.bdcm)

Applies to: SharePoint Server 2010

The Microsoft Business Connectivity Services (BCS) Client Runtime needs to know what external data source to connect to and how, and what data your intermediate declarative 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 declarative solution is to use Microsoft SharePoint Designer 2010 to create all the external content types 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 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 machine to store the solution artifacts.

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

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

  4. Download the Code Sample: AdventureWorks2008 ASP.NET Web Service 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 it.

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 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 on how to create an association.

  3. Click the External Content Types button 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 click the Export button on the ribbon. Name the file Metadata and save it your Solution Artifacts folder. The generated XML file will contain the external content type definitions of both Customer and Order, and will also include 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 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 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 Cache Subscriptions (*Subscription.xml)