Building Solutions with Business Connectivity Services using Visual Studio 2010

Ok, I have made a discovery. Happiness at a tech convention consists of two things.

  1. Finding refreshments
  2. Finding an outlet for your equipment, they need to have power strips down the aisles

I've been looking forward to this session, the BCS has really gotten me pumped up.

Presented by: Rolando Jimenez, Sr Lead Program Manager, Microsoft

Goals:

  • How to use Visual Studio 2010 to implement BCS
  • What kind of solutions can be created with BCS

BCS fits into the Composite area of SharePoint 2010.

  • It enables developers to create re-usable components to access data.
  • Enables users and other developers to use these components to create solutions without having to establish the connections to the back end data.

BCS streamlines the creating of data access to external data and make it available to SharePoint.

External Lists provides external data in a standard SharePoint list.

Comparing to 2007

BCS is the extension of BDC from SharePoint 2007.

Improving the presentation

Enabling write back capability, and more out of the box connectors (.Net assembly connector)

Improving the developer tools for creating BCS

External Content Types – The building block for BCS applications

You'll have an external data source somewhere. The external content type is a description of the data, how to connect to the data and the behavior of the data.

The ECT then allows you to use BCS to make the data available for use within SharePoint.

Tools

Two solution types, code and no code. The difference is who creates them, the tools they use, and how it's managed and executed.

No Code solution is managed by the Runtime, built with SharePoint designer and the SharePoint SDK.

Code solutions are managed by the CLR, and you use Visual Studio to create them.

  • External Lists, connect to Outlook and SharePoint WorkSpaces
  • Customization using InfoPath forms, the outlook taskpane and ribbon, word/QuickParts, Workflow and Web Part Pages
  • Custom development, implementing security, transformations, data aggregations, and business logic, and they are reusable pieces

The first two are the No Code solutions, while the last one is a Code Solution. The reusable components can be used in the No Code solutions.

There's a good chart outlining the what you can do with the tools both in a No Code and a Code solution in the slide deck.

There is a BCS model project in Visual Studio for creating BCS applications.

Wow, I just love the new visual designer that you use now to create the BCS. Basically you are defining the External Content Types that you'll deploy to SharePoint.

Oooh, he's showing that the models will automatically create the code behind for you to create the entities. So instead of having to dig through the XML, we have real separation between the schema and the actual class that has the methods for retrieving the data. NICE!

Ahh, so an external list is just basically a list that uses a BCS to get its data.

Oh man, that's awesome, he still had VS up with his model and had a breakpoint, when he created the list he hit his breakpoint in his code *drool*

I wonder how many people realize how much easier this is than the old BDC?

He's demonstration aggregating data, one source is an ADO.Net REST source, and the other is a SQL table.

First he created a class called 'Customer' with just get/set properties. Then he extended it with a new class called AggregatedCustomer with two new fields. Now he's updating his model to show how he can retrieve the data from his REST service. Then he defines the methods on how to get and set data, he changes the identifier to match his model, and updates the data type. Then he changes his output parameter to be his custom Customer type descriptor. It lists all the datatypes and columns that he's expecting to receive. He then adds a method to retrieve a customer list using the customer type descriptor.

Now he's going in to the code behind to implement the retrieval of the data from the back end data service, and populates the data for the BCS.

Wow, that is much easier to follow than the old BDC. You still get the standard forms created by SharePoint for displaying single records of data from your External Content Type. Oh man, and it generates a form that is Silverlight, and it allows you to update the data if you've implemented the update methods.

OMG, you get out of the box integration into Outlook with the external data through the ribbon interface. You do have to enable the behavior of the BCS to support connectivity to Outlook. He opens SharePoint designer and goes to 'External Content Types' and he can see the one he created. It pulls up some information about the Type, oooh, and it shows you what lists are using this content type on the site.

So what he has to do is just define the mappings from the External Content Type, and then define the type in Outlook, actually just select what Outlook type he wants to map to.

He then looks at the fields in the ECT and then picks what field in Office that it should map to. This is pretty much the demo we saw in the Keynote, with the exception that this data was aggregated before it was mapped to Outlook.

Now he goes back to the External List and he's picking exporting it offline to Outlook. It then creates the packages and code that runs on the server and client that will do the export to Outlook. That could be a good thing or bad thing, if a user doesn't have rights they won't be able to willy nilly offline the data like this. In fact I kind of like that, let use push it out to them instead of letting them create it on their own. Ahh, this is actually the DLL and classes needed to understand the data coming from the BCS, that is how Outlook knows how to map the data.

I can see using this to aggregate calendar data for some of the groups, using SharePoint and BCS as an intermediary.

Ahhh, and the fields he didn't map still show up in the Outlook contact as extra fields at the bottom. It even supports updating from Outlook, back through SharePoint and BCS to the back end data stores. WOW, very nice.

They've also enhanced the external list to act more like a list now instead of just a web part that's displaying the back end data. You get all the list functionality, sort, filter, etc.

Next demo is connecting this aggregated data into Excel. Just a side note, VS2010 Beta 2 is running VERY fast on these demos, even though they are laptops. The one guy who had the older version was definitely seeing the performance hit in the older beta.

He's created a custom user control that will interact with the data coming from the BCS. He also created some code to add a button to the ribbon to display the data, and a method to add the control to the worksheet.

There are some things that are still required to be done manually that we won't have to do in the RTM.

NICE, after he populated his grid, he then imported it straight into the worksheet. He says that he didn't implement the write back, but it wouldn't be hard to do the write back. BCS includes synchronization as well so you don't have to worry about that in your application.

Now he's reviewing packaging and deployment.

  • WSP Package
  • Click once package
  • You can embed the Click once package into the WSP so it's all consolidated in one place, VERY nice.

This looks VERY nice, can't wait to start using it. I like what I've seen as far as what you can do code, versus no code. I especially like the model designer, and the code behind that allows you to more easily work with the External Data. The External Content Type is a nice abstraction that was missing, well mis-named in MOSS 2007.