Friday, July 30, 2010

Programming BCS entity model in SharePoint 2010 - Part 1

Recently, I have completed one of my BCS, business connectivity service, entity models for SharePoint 2010 using Visual Studio 2010 and like to share some of what I have learned with you.

When I started this project initially, I couldn't find all the information, that  I needed to program a BCS entity model, from one single place.  I had to go to user forums at MSDN and visited few blogs to scratch my wonder like "uhmm, I don't know how to get this done in Visual Studio 2010."

So, here I decided to put everything I learned on this blog to share with you... hoping that this would help you get your BCS entity model completed easily.

Let's start...


1. Development Environment

Windows 7 64 bit,
SharePoint 2010 Foundation (here is how to set up >>>),
Visual Studio 2010 Professional w/ SharePoint tools,
MS SQL Express R2 64 bit w/ Northwind sample database

2. Create a new BCS project

I will here create a new BCS entity model for [customers] table in Northwind database, and do follow the steps explained below in the same order.



- change the name of BdcModel1 to BdcModel
- change the name of "Entity1" to Customer in all places
- change "Identifier1" to CustomerID
- change the name of "Entity1Service" to CustomerService
- check BdcModel.bdcm and BdcModel.bdcm.diagram files to make sure they no longer have BdcModel1, Entity1, Entity1Service, Identifier1, and etc.  You can manually update these files accordingly too.

After finishing these "renaming" steps, your model should be just like this.  The CustomerID is the primary key identifier in our model, so this CustomerID should be set up with the identifier field accordingly as well.  To make my job easier, I used the same name for both "Identifier" and "TypeDescriptor Name."

  


Before we proceed, please make sure that you have no warning and error messages from the first validation and compilation.

No comments: