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.
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
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.
3. Add a service reference to the project by choosing Project Add Service Reference enter
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.
5. Add a new parameter to the ReadList method, expand the parameters name in the details pane then click Add a parameter.
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
7. Before you add the code to support this method, Right click the entity and add identifier and name it with desired name.
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
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 :