SharePoint 4 Developers

Additional reference guide in .NET / SharePoint Development

Business Connectivity Services – Part I

Learn about the Business Connectivity Services and how to develop solutions using the SharePoint Designer 2010 and Visual Studio 2010 by creating External Content Types. (Part I)

Hi folks,

In these last months I have been working on the new SharePoint 2010 BCS for the integration of different data sources, and I have decided to talk about the concepts involved and my experiences based on examples of different lessons. This is the beginning of a series of posts related to this subject, and this is the first one. This a complete content focused on development, which BTW is the purpose of this blog. Hope you enjoy it!

Understanding what the BCS is, its architecture and components is the main purpose of this approach.

Business Connectivity Services

Have you ever thought about or had the necessity of integrating different data sources in a unified system? It is important to know that this is possible in SharePoint 2010, thanks to the Business Connectivity Services (BCS).

By default the SharePoint 2010 platform contains Out-of-the-box (OOTB) features of BCS for displaying, manipulating and data searching, and with the utilization of SharePoint Designer 2010 and/or Visual Studio 2010 tools is possible to create advanced BCS solutions for integrating data sources and services.

The previous version of BCS called Business Data Catalog in MOSS 2007 also allowed us to connect to external data sources, however the creation of this kind of solutions was difficult due to the lack of design tools. Despite the fact it was relatively simple to create applications read-only, applications that persisted data were difficult to be done. Now there is an easy workaround for these restrictions due to the new tools SPD2010 and VS2010.

By the re-utilisation of a concept in grouping metadata called Content Types, BCS creates a metadata mapping called External Content Type, due to the creation of an external metadata mapping, which I will talk about later.

Note: Many companies have already understood that SharePoint can be used like an Integration Portal, where they can extend their internal systems (ERP, CRM, etc.) with custom and OOTB solutions. That is happening with the utilisation of Business Data Catalog in MOSS 2007, now with the BCS in SharePoint 2010.

Architecture

Let’s check the blocks and components that belong to the diagram below, they bring us an understanding of how the BCS works, according the Figure 1:

BCS Architecture Figure 1 – BCS Architecture

As per the Figure 1, each block was enumerated to explain its components:

Building Block 1 – External Data Sources

This block displays the provided support to different types of external data sources, through the following connections:

Databases

By default direct connections via database are done using SQL Server.

Web / WCF Services

This support is provided to both Web Services (*.asmx) and WCF Services (*.svc).

Assemblies .NET

The connection to different databases (Oracle, MySQL, etc.) is only possible by creating custom assemblies .NET for this purpose.

Custom Data Sources

The utilisation of Custom Connectors allows the connection to different types of Data Sources. i.e.: XML and Text data.

Building Block 2 – SharePoint Site

This block is responsible for connecting to external data sources, it allows the operations Create, Read, Update, Delete, and Query (CRUDQ) to be performed. Check out its components:

BDC Metadata Store

The BDC Metadata Store is a component that is responsible for the storage of External Content Types, which contains the metadata that describes how to connect to the external data sources.

Secure Store Service (SSS)

This is a service application of SharePoint 2010 for the storage of credentials. It replaces the Single Sign On feature of MOSS 2007. The credentials of external data sources can be stored and associated to a specific identity (or a group of identities).

External Content Type (ECT)

The ECT describes the schema and data access capabilities of an external data source and its behaviour within Office and SharePoint.

BDC Server Runtime

This component knows exactly how to connect to an external data source utilising ECTs for this purpose.

Search, Workflow, Web Parts

The BCS provides and supports some features OOTB that are available in SharePoint 2010. They are listed: searching, workflows and Web Parts.

External List

This is a List created based on an ECT, which is displayed like any other List in SharePoint.

Connectors

They are responsible for interfacing the BDC Runtime with the external data sources.

Building Block 3 – Office Client

Both applications (Add-ins / Custom code) created for Office 2010 and the Microsoft products like Outlook 2010 and Microsoft SharePoint Workspace 2010 can handle external data efficiently. The following components are contained in this building block:

Cache

When the application is online, the SQL Compact stores data temporarily, which ensures that even if the application is offline, the content is displayed.

Offline Operations

The reading and writing operations performed in cache are persisted when the application is back online.

BDC Client Runtime

This component is responsible for synchronizing external data, which are carried out consistently as follows:

  • When online, it connects the client directly to the external data source. Through the Sync a copy of ETCs are sent to the client, which allows direct access.
  • When offline, data remains cached for later synchronization.

Office Add-in / Custom Code

Deployment of VSTO packages via ClickOnce allows applications to be quickly available in user machines, by the utilisation of smart-clients.

Building Block 4 – Tools

The new versions of the tools below allow the creation of several solutions due to the new set of features they offer.

SharePoint Designer 2010

It enables the creation of ETCs and External Lists without the need of creating custom code, allowing the rapid creation of solutions using its resources OOTB.

Visual Studio 2010

In cases where solutions created by the SPD 2010 do not meet the business needs, VS 2010 should be used for advanced developments via code.

External Content Types

The BCS uses External Content Types as the main object for the mapping of external data. Have you already heard about Content Types in SharePoint? By definition Content Types are collections of metadata, which groups Site Columns in SharePoint. Content Types internally store the schema of its metadata in XML, used for identifying its data types. i.e.: string, boolean, number, etc.

The ECT is an extension of this concept, the Figure 2 shows the use of ECTs:

ect_en680 Figure 2 – Utilisation of an ECT

As per Figure 2, besides storing its metadata schema, an ECT provides data access capabilities of an external data source and its behaviour within Office and SharePoint, which is available through entities and methods. This object is stored in the BDC Metadata Store that contains all ECTs (as described in the Architecture).

This was a theoretical introduction. I consider this understanding essential for the explanation of the demonstrations of the next posts. BTW, in the next post I am going to show how to create ETCs. Stay tuned!

References:
http://msdn.microsoft.com/en-us/library/ee556826(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/ee557898(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/ee557790(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/ee554916(v=office.14).aspx

Cheers,

Marcel Medina

Click here to read the same content in Portuguese.

blog comments powered by Disqus