WCF to the rescue: Fixing bad performing BDC connectors in SharePoint

Posted by: Mark Kendall , on 7/29/2011, in Category SharePoint
Views: 80105
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:

clip_image002

For a basic WCF Service, you need 5 classes:

  • An Interface
  • A Service class (svc file)
  • An object
  • BLL Business Logic layer class
  • DAL Data Access Layer

Here is the code:

An Interface

image

A Service Class

image

An Object

image

image

Business Logic Layer (BLL)

image

Data Access Layer (DAL)

image

image

Conclusion:

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

Give me a +1 if you think it was a good article. Thanks!
Recommended Articles
Mark Kendall is a Software Engineer working in the Oil Industry in Dallas,Texas. He has been a programmer/developer for past 15 years specializing in .NET/C# development. Currently, he is a Sharepoint/Silverlight developer specializing in BCS Services. He has published a book on Dotnetnuke, and written several articles on many .net subjects. Apart from his passion for making money writing software to improve business, Mark enjoys ranting-and-raving about current events and taking long runs on the beach. He blogs at kendallsoft and can be reached at Kendallsoft[attherate]hotmail[dot]com


Page copy protected against web site content infringement by Copyscape


User Feedback

Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel