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

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

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce the pre-order of The Absolutely Awesome Book on C# and .NET. This is a concise technical eBook and will be available in PDF, ePub, and mobi.

Organized around concepts, this eBook aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core. Use these concepts in your next .NET Project or to crack your next .NET Interview.

Click here to Pre-Order this eBook at a Discounted Price!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Author
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




Feedback - Leave us some adulation, criticism and everything in between!

Categories

JOIN OUR COMMUNITY

POPULAR ARTICLES

C# .NET BOOK

C# Book for Building Concepts and Interviews

Tags

JQUERY COOKBOOK

jQuery CookBook