TechBubbles Microsoft Technology BLOG

Creating a Custom Entity Service Object in SharePoint

What is Entity Service Object? How it is related to Business Data Connectivity model? You can read the terms in business connectivity services here. The Entity Service Object is equivalent to ADO.NET provider for SQL Server and Entity class represents the row of data. Create Business Model Project in Visual Studio 2010 to create a service object.

SP2010

Create a Business Data Connectivity Model Project by following the below steps

1. Open Visual Studio 2010 and create a new project , In new project dialogue select SharePoint and select Business Data Connectivity model template and say ok

image

2. The below entity view shows all identifiers and methods defined in the model. It basically contains the configuration data for the connection and Entity Service class contains the methods which act as end points for the operations defined in the metadata.

image

3.  Add a service reference to the project by choosing Project  Add Service Reference enter

clip_image002

4. Now write a method to support Finder Stereo type and this method will be called by BCS clients. In entity viewer in Visual Studio, delete the default entity and add a new entity from tool box and name it as ServiceResult. In details pane click <Add a Method> to create a new method then select create finder method which will automatically add a method named ReadList.

image

5. Add a new parameter to the ReadList method, expand the parameters name in the details pane then click Add a parameter.

image

After adding the parameter, now you can add a filter by selecting create filter descriptor. Name the filter descriptor to   Search Filter and set the type to wildcard.

6. Associate the filter to ReadList method as shown below. Browse the BDC explorer , expand ReadList node and query node and then QueryTypeDescriptor

image

7.  Before you add the code to support this method, Right click the entity and add identifier and name it with desired name.

image

8. Now metadata is in place and can write code for the ReadList method, save the BDC model and switch solution explorer and open the code behind service file write some code for the method

image

9. Now you can build and deploy the model to SharePoint , when you deploy this model it automatically installed on the site that we specified during the project creation

10. After deploying the model, navigate to the external content types explorer now you can see the ServiceResult content type has been added with type .NET Assembly. When you open this content type then you will see the operations that we added in visual studio project.

Share this post :

About the author

Kalyan Bandarupalli

My name is kalyan, I am a software architect and builds the applications using Microsoft .NET technologies. Here I am trying to share what I feel and what I think with whoever comes along wandering to Internet home of mine.I hope that this page and its contents will speak for me and that is the reason I am not going to say anything specially about my self here.

Add Comment

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud