BDC: General tips on integrating your external data in MOSS

Last week, one of my clients asked me to explain a bit about the Business Data Catalog (BDC) and how they can fully exploit its power. In this specific case they needed to bind a supplier instance to a contract content type. Since I’ve got some field experience using the BDC I thought I’d share a bit of my personal best practices on how to do proper integration.  If you want technical information on how to write a application definition; you can view the links at the end of my post.

First off, create indirection layers for your data

When you want to integrate your data, make a data contract with the supplier. In other words, if your data is maintained by someone else or another department within your company. Let them create extra views (when using an database) on the external data specifically for your BDC application definition. This will be your indirection layer such that they can easily change their data model as long as they keep the views intact. The same goes for web services, create an indirection layer before connecting to a third party web service if you want to be on the safe side. By using such a layer your maintainability will increase, you still give the third party the freedom to change their data model as long as they respect your data contract, and you still have an direction to point your finger to when it breaks. How convenient.

Ensure that BDC application doesn’t expose any information that shouldn’t be seen

It is easy to accidentally expose confidential information from your external datasource to your Sharepoint users when you are happily mapping tables.  So make sure the users are allowed to see the information from the back end. If there is a security policy you need to enforce on entity, instance or record level you can implement the CheckAccess method.  This will trim your security by asking for the rights by passing an set of ID’s. You need to supply the back-end business logic for checking the authorization. This method will also be called when crawling the BDC.

You can find more on this subject here: http://msdn2.microsoft.com/en-us/library/bb447548.aspx

Make sure the external source is ready for the extra load

Well, this seems quite obvious, but I’ve seen cases where an administrator was quite busy figuring out why his SQL server kept getting a high load. When you introduce an extra view upon your data from Sharepoint, your load is going to be increased. Make sure your environment is ready for such an increase. This is especially important if you use BDC’s AccessChecker implementation cause this can be quite a stress on your server depending on how well you’ve managed to write your back-end access check logic. And whether your CheckAccess method supports passing of multiple id’s to check. If this is not the case, the BDC will automatically spawn a threads to acquire the rights information for every id to check, thus possibility resulting in a high load.

Use the BDC as single point of read/write to external datasource

If for some well-thought reason you need to write to your external datasource you could use the BDC as well. Therefore you can define your BDC as your single point of entrance to your external datasource for reading and writing. You can create an GenericInvoker method in your application definition, which can be called from the BDC object model. A best practice is to create an Data Access Layer (DAL) class that abstracts and encapsulates the logic for calling the methods on the BDC object model. For instance, you could make a class that bares the name: TaskEventLogger with methods like WriteTaskEvent(string eventname) that maps to methods of the same name in the application definition.

Since the application definition supports versioning you could even dynamically ask the BDC object model whether the version of the application definition loaded matches the DAL you specifically wrote for that application definition. How about that?

More information on the BDC (Microsoft):
http://msdn2.microsoft.com/en-us/library/ms563661.aspx

Del.icio.us:
http://del.icio.us/popular/BDC

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: