Creating External content type with CRUD operations using Business Data Connectivity Model in ShareP

Introduction:

Business Connectivity Services (BCS) is a new service introduced with SharePoint 2010 to allow SharePoint sites to connect to and manipulate external data. SharePoint 2007 had a similar facility in the form of Business Data Catalog (BDC) which made external data available within its site. However, a major problem with BDC was the difficulty in creating solutions as there was no support in the 2007 designer.  Most BDC solutions were simply for accessing external data, manipulating external data sources was extremely difficult.

With SharePoint 2010, BCS ships with out-of-box features such as solutions, services, and tools which make connecting to external data an easy task. Whether you want to retrieve Outlook contacts in a list offline or edit the contents of your document file or share your excel sheet online or reuse data from dynamic InfoPath forms or just update your business presentation, BCS enables deep content sharing, editing and integration in SharePoint 2010 with SharePoint Designer and Visual Studio tools. In this article, we are going to create a model for the BDC service that returns information from a SQL database. You will then create an external list in SharePoint by using this model.

Steps Involved:

  1. SQL Database.

  2. Create Business Data Connectivity Model.

  3. Add LINQ to SQL class.

  4. Removing the default Entity from the BDC Model.

  5. Adding an Entity to the Model.

  6. CRUD Operations.

  7. Configure Business Data Connectivity access rights.

  8. Creating External List.

  9. Testing.


1. SQL Database:

First we need to create a sample database in SQL which is going to be connected to the SharePoint. Simply create a new database in your SQL Server and have it filled with some sample data. In my case, I have created a SQL database, called Customer_Details. In the database Customer_Details I have added one table called Customers. See the details of the table in the following figure.

CustomerID FirstName LastName

206570 Vijai Anand

2. Create Business Data Connectivity Model:

  • Start Visual Studio 2010.

  • Open the New Project dialog box, expand the SharePoint node under the language that you want to use, and then click 2010.

  • In the Templates pane, select Business Data Connectivity Model. Name the project BdcModel, and then click OK.


  • The SharePoint Customization Wizard appears. This wizard enables you to select the site that you will use to debug the project and the trust level of the solution.