WCF to the rescue: Fixing bad performing BDC connectors in SharePoint
Posted by: Mark Kendall
in Category SharePoint
Abstract: Although WCF is a little tougher to configure than SharePoint BDC connectors, once you get the hang of it, WCF services are fun to write and your performance will sure to improve! In this article, I will provide a boilerplate WCF service that will get you started.
I was excited about the new data connectivity features (BDC) of SharePoint 2010 when it was first released. In fact, External Lists were a staple in our development shop, and an “everything is a list” was the standard operating procedure SOP.
As time went by, however, it seems as those our applications were rolled out with very poor performance. And inevitably, someone would say “Why is this thing sooooooooooooooooooo slow?”
So we started to look at the pieces of the pie, and everything starting pointing to the connectors or external lists. We were able to establish this by using SharePoint’s Developer dashboard - If you haven’t tried this dashboard; then you should - it is very instructive and can help with your performance problem, narrowing the search for those bad performing routines. Here is a good blog post for you to get started: SharePoint 2010 – Enable & using Developer Dashboard. On a side note, here are some SharePoint 2010 article that you may find useful SharePoint 2010 Tutorials For Beginners and Intermediate Developers
Although WCF is a little tougher to configure than BDC connectors, once you get the hang of it, WCF services are fun to write and your performance will sure to improve, and everyone is happy!
In this article I will provide a boilerplate WCF service that will get you started - There are plenty of good articles on WCF and I would suggest reading a few.
In Visual Studio, create a new WCF Project and set your file structure up like this:
For a basic WCF Service, you need 5 classes:
Here is the code:
A Service Class
Business Logic Layer (BLL)
Data Access Layer (DAL)
The problem was bad performing BDC connectors or External list in SharePoint 2010. The solution was rewriting the External list to WCF Services and changing the SharePoint presentation code in the visual web parts to call these WF Services. The result, a 30-50 percent reduction in the page loads across the site!
Now don’t get me wrong WCF can be challenging and sometime downright nasty, but no pain no gain. In my opinion it’s worth the work- and it looks good on your resume! Study the code snippets above and get your WCF project up in no time!
The entire source code of this article can be downloaded over here