In this blog post we will take a look at the Business Connectivity Services (BCS) in its most basic form. It is often easy for us to assume that everybody knows what a Type Descriptor, External Content Type or Model is, when in fact for somebody just starting out these are some very alien terms.
I will explain the BCS as if I was explaining it to someone with no experience whatsoever, from the beginning. I am going to attempt to avoid using jargon too! Are you ready? I am.
Imagine that there are 4 different computer systems, our imaginary employee, Martin’s everyday computer and 3 other which contain information he needs to do his job.
- The red computer contains information about customers
- The blue computer contains information about products
- The yellow computer contains information about orders – customers who have purchased products
Each of the computers behave slightly differently.
- To log into the red computer Martin needs to use his red password to use the red application to get access to the customer data, which are stored in the red data store.
- To log into the blue computer Martin needs to use his blue password to use the blue application to get access to the product data, which are stored in the blue data store.
- To log into the yellow computer Martin needs to his yellow red password to use the yellow application to get access to the order data, which are stored in the yellow data store.
With all of these separate systems it makes Martin a bit frustrated (boo, hiss!) as when he wants to do some work he must remember which password to use on which computer for the right information. When he forgets a password he needs to contact Brian in IT Support to reset it for him, just what Brian wants to be doing with his day – resetting passwords!
Martin also needs to learn how each system works as the different applications have been designed by different people, and when a new starter joins he needs to train them on all of the systems.
It’s all looking a bit messy for poor Martin, all he wants to do is log onto his computer and have access to his information from one place.
Martin’s company have implemented SharePoint (hooray) and after a couple of months they’re up and running. Now that everything is running smoothly Martin’s company decide that they want to provide access to the information on the red, blue and yellow systems in one location, SharePoint, and start to research their options. The first option they think of is to get their developer, Robin, to write some code which will get the data from the systems. The trouble is that Robin, in all of his experience, only knows how to get information from the Red data store, he doesn’t know how the Blue and Yellow data store works, so they think of getting a consultant in but the costs start to look a bit scary! Robin also points out that even though he knows how to access the Red data he will still need to create a new user interface for the users so they can interact with the data – performing actions such as viewing all customers, updating the address of a customer or adding a new customer – “this is going to take quite some time!” he says
Luckily for Martin, the end user, and Robin, the developer, there is a solution which is called the Business Connectivity Services which is designed to solve this scenario (plus a bit more too).
The BCS is designed to make it easy to integrate the systems, known as ‘External System’s (they are External to SharePoint) into SharePoint. It doesn’t copy the data, that’s important to remember. We will take a look now at how this is done.
In order to simplify the connections to a system the BCS uses what is known as a Model, this is a file which tells SharePoint how to connect.
This Model contains information such as:
- What the system is i.e a Red System
- How it connects i.e Database, Web Service or Code
- Credentials i.e Username and Password
The Model also stores information about what is represented in the Data Store, these representations are known as External Content Types or ECT for short. Examples of ECTs could be a Customer, a Product or an Order. The final information stored are the instructions on how to retrieve the data for the External Content Type, the instructions are known as the Methods, below are some typical methods
- Read List i.e Get All of the Customers
- Read Item i.e Get Single Customer
- Create i.e Add a new Customer
- Update i.e Update an existing Customer
- Delete i.e Delete an existing Customer
The final, final level of detail that I will share, and because it mentions it in the start is a ‘Type Descriptor’ this, if you think of a Database Table would represent a Column i.e FirstName for a Customer. The Type Descriptor contains information such as the Data Type, is it a number, text, yes/no etc. This is used so that SharePoint knows how to represent the data.
The Model can contain information about many External Content Types in one single model providing they are in the same External System.
The interesting part is that the structure of the information in the Model is uniform regardless of what the External System is, this means it can be applied for any of our red, blue or yellow systems. Each will have it’s own connection and method information.
So, Robin sets about creating the Models for each system and adds them to SharePoint so it knows how to connect to all 3 systems. Robin can create these Models in SharePoint Designer or Visual Studio.
Now that SharePoint has a Model for each External System it knows how to connect to each of them and because SharePoint doesn’t care what the External System is anymore as it knows the Model provides all of the information it needs it means that there are Web Parts and Lists which can work with any one of the External Systems the same way.
What does this mean for our plucky employees?
- Can now log in to SharePoint and can see all of the data from each system in one place
- Doesn’t need to log in to each system separately as the data is automatically connecting using the method in the Model file
- Doesn’t have to worry about Martin forgetting his password
- Can now write code against the BCS instead of the red, blue or yellow system which means he doesn’t need to know how each of them work, just how the BCS works.
This is a very simplistic view but hopefully you will see the benefits for all of the people involved and the businesses they work for