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

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

This article has been editorially reviewed by Suprotim Agarwal.

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 Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

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!