SharePoint 4 Developers

Additional reference guide in .NET / SharePoint Development

Business Connectivity Services – Part IV

Understand the hierarchical structure of the BDC metadata model (Business Data Connectivity Model) and the new tools in Visual Studio 2010 to design BDC models (Part IV)

Hi folks,

This is the fourth part of the article about the news in integrating external data with the Business Connectivity Services (BCS) in SharePoint 2010!

Just to recap, the Part I of this article brought an introduction to the BCS by the analysis of its architecture and components, the Part II brought the creation of External Content Types (ECT) via Database and the Part III the creation of ECTs via Web Service.

Part I reading is extremely important to understand this post. In this article I will explain the hierarchical structure of the Business Data Connectivity Metadata Model and introduce the new tools available in the Visual Studio 2010 to create BDC objects.

Have a good reading!

Understanding the BDC Metadata Model

In this article's example a new template in Visual Studio 2010 called Business Data Connectivity (BDC) Model will be used. It allows the creation of entities (BDC Entities) also known as External Content Types, an old friend of us (check Part I for more details).

Entities are objects that belong to the BDC metadata model and represent one of the core BDC metadata model objects. In this approach I want to go a little deeper into this model, check out the Figure 1:

BDCModelFigure 1 - BDC Metadata Model

Now it is clear where the ECTs are within the BDC Metadata Model, but we still do not know in details the role performed by each one of the objects comprised in the Figure 1. We can only note that the objects are in a hierarchical structure.

To understand these objects let's check the details of each one:

NOTE: The same content can be found in the Reference links, however I have decided to drill down a little bit more than the content presented on MSDN. :)

  • Model - This is the BDC core main object that maps the external data. This is the aggregator of all the objects that comprise the hierarchy of this model.

  • LobSystem - Inside the model it behaves as the representation of an external service that contains the business logic, simply by defining the type of external data source to be used, that can be:
  1. Database – Sets the mapping of a database;
  2. DotNetAssembly – Defines the mapping of an assembly. NET;
  3. Wcf – Defines the mapping of a WCF service endpoint;
  4. WebService – Defines the mapping of a Web Service. It is considered "deprecated", so use a WCF service;
  5. Custom – Defines the mapping of a custom connector, implemented to manage the external data source connection and data transferring.
  • LobSystemInstance - This is the implementation of a LobSystem. It holds all the connection details to an external service.

  • Entity - This is the representation within the BDC metadata model of an ECT, which according to the Part I describes the schema and data access capabilities of an external data source and its behaviour within Office and SharePoint.

  • Identifier - An identifier acts as a primary key in entities, the same concept used in tables.

  • Method - The methods are the behaviours of an entity. Within the metadata model it works as an aggregator of settings (FilterDescriptor, Parameter, MethodInstance) of the method that represents.

  • FilterDescriptor - Basically a FilterDescriptor can be created within a method to select both the input and the return of values. Several types of filters can be used (check the Reference links).

  • Parameter - Defines the parameter to be used inside the method, as follows:
  1. In – Used to input parameters;
  2. Out – Used to output parameters, similar to the parameter "out" in C#.
  3. InOut – Represents a parameter that has two functions (input / output), similar to the parameter "ref" in C#.
  4. Return – Sets a method return type. In the BDC this is considered as a return parameter.
  • TypeDescriptor - A TypeDescriptor is nothing more, nothing less than a definition to the parameter type. i.e.: Int32, String. It is recursive because it allows that other TypeDescriptor is referred as a parameter type.

  • MethodInstance - This is the implementation of a Method. Operations Create, Update, ReadItem, ReadList and Delete are already predefined for using.

  • Action - The actions allow the addition of extra functionalities to ECTs because they work as an additional link to external data. By default the actions View Item, Edit Item and Delete Item are added to the user interface (check the Reference links) and any further action added, such as a link to open a page, follows the ECT in any part of SharePoint.

  • ActionParameter - Sets the URL of the action that refers, so the link created works. It uses Identifiers or TypeDescriptors of the entity to create the URL.

  • AssociationGroup - Associations represent relationships between entities, similar to a relationship of tables. An AssociationGroup should be used to tie association methods, which are applied in a relationship of entities. i.e.: Given two entities Customer and Order, an AssociationGroup would store methods like GetOrderByCustomer and GetCustomerByOrder.

NOTE: In the next part of this lesson you will see the majority of these objects in use. This overview will be consolidated with a hands-on demo, especially when working with XML behind these definitions.

BDC Metadata Model Design Tool

Visual Studio 2010 was powered with several new design tools and the BDC was not forgotten. Now it's easy to create BDC models, because the toughest job (creation of objects) can be done visually and other small details manually in the XML generated.

The Figure 2 displays the new windows available in VS2010 to design BDC models:

NewDesignerFigure 2 - New windows to design BDC models

With the exception of the Properties window, three (3) new windows were added to the VS2010. They are:

  • BDC Designer - Enables the creation and edition of Entities, Identifiers, Methods and Associations between Entities. This is an design area that allows the creation of objects via drag-and-drop from the Toolbox window or even using the context menu (right mouse button).

  • BDC Method Details - As the name implies, it displays the configuration details of the methods. Allows creation and edition of methods, parameters, typedescriptors and filters (according to the BDC metadata model).

  • BDC Explorer - Organizes and displays BDC metadata model objects in a tree view. Its main purpose is to display objects in a hierarchical structure, but also allows the creation of TypeDescriptors and validation of objects.

Throughout the development in the next part you will see how to manipulate the BDC Metadata Model objects by using these panels. Stick around!



Marcel Medina

Click here to read the same content in Portuguese.

blog comments powered by Disqus