Jaap Vossers’ SharePoint Blog

December 13, 2009

Context in SharePoint 2010 Business Connectivity Services (or the lack of it)

Filed under: Development, SharePoint 2010 — Jaap Vossers @ 1:10 pm

The problem I see with Business Connectivity Services is the lack of context available when writing your custom code to retrieve and update data. As a result, custom BCS implementations are not very reusable because the lack of configuration options per External List.

Let’s look at an example.

ACME Ltd, an ISV focusing on selling SharePoint products, wants to develop and sell a BCS solution that allows customers to create External Lists based on data that resides in ANOTHER SharePoint site collection. In a nutshell, the External List will contain a “virtual” list item for each site in the target site collection. Now how does the BCS code know where this target site collection is? You could hardcode the url, or you could store the url in the appSettings in the web.config for your web app. These are both solutions that will give you headaches when you need more than one instance of this External List, each using the same BCS code, but retrieving data from different target site collections.

When I created a new Business Data Connectivity Model in Visual Studio 2010 for the first time and I looked at the code that was initially generated (Entity1Service.cs), I was surprised that there seemed to be no way to derive any of the following in code:

  • SPWeb instance or url of the site that contains the External List we are trying to load data for.
  • Name (or ID) of the External List we are trying to load data for. This, together with an SPWeb, would allow you to read per-list configuration data from SPList.RootFolder.Properties
  • Some string containing configuration data that applies to our BCS Entity to External List association. Something similar exists for EventReceivers and Workflow, so why does it not exist for BCS?

I would be very interested to hear people’s thoughts on this subject.

2 Comments »

  1. I love the new External List functionality. It takes the Business Data column to its expected evolution. I’m sorry you’re having a hard time porting it and making it reusable. When I start actually developing solutions for the External List I’ll be sure to investigate it and make a blog post. Just remember every new feature with Microsoft takes a little time to gain traction and become “solid”. We should be happy they gave us this functionality — I’ve been waiting for it ever since the BDC was introduced. Maybe because creating an External List is so easy once the External Content Type is created, they want us to use Designer to create them. And because I like to write my own features and site definitions and use CAML and API to provision components, I might be a little irked too.

    Comment by Brian Bedard — December 14, 2009 @ 9:20 pm

  2. Hi Brian. Don’t get me wrong I do love the new BCS stuff! :) The point of this post is to point out to people that something important seems to be missing, and it would be really cool if Microsoft would agree and decided to change this before the RTM version is released. Obviously if you don’t plan on developing reusable BCS solutions, you won’t be affected by this limitation, so I do see your point.

    Comment by Jaap Vossers — December 15, 2009 @ 5:32 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress