IT tutorials
 
Technology
 

Sharepoint 2010 : Building a .NET Connectivity Assembly (part 2) - Create a Custom Entity Service Object, Define a Method to Support the Finder Stereotype

2/19/2014 3:31:46 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
Create a Custom Entity Service Object

Before we jump into creating a new Entity Service object, it’s worth discussing what an Entity Service object is and how it relates to the rest of the items in our model. A BDC model project consists of three things:

  • A BDCM file that contains the configuration metadata for the connection

  • An Entity Service class that contains the methods that will be the endpoints of the operations defined in the metadata

  • An Entity class that contains the data to be processed by the Entity Service methods

To relate this back to the connection we made earlier via SharePoint Designer, the BDCM file contains the configuration details that we entered in the Operations Design View of the External Content Type. The Entity Service object is the equivalent of the ADO. NET provider for SQL Server and the Entity class represents a row of data.

Note

These relationships and their representation in the design tools can cause some confusion at first glance. In the Entity View, it appears as though the methods are defined on the entity object. In fact, the methods are declared as static methods on the Entity Service object.


Now that you have a clear understanding of the purpose of the Entity Service object, we can move on to add the code required to support our data source.

  1. Since the Bing.com search service is accessed via a web service, we need to add a new service reference. Choose Project | Add Service Reference.

  2. In the Add Service Reference dialog, enter http://api.bing.net/search.wsdl?AppID=<Your App ID Goes Here> &Version=2.2.

  3. Click Go to download the service WSDL.

  4. Set the Namespace to Microsoft.Bing, and then click OK to create proxy classes for the service, as shown here:

Define a Method to Support the Finder Stereotype

Our next step is to implement methods that will be called by BCS clients to interact with the data source. In our demonstration scenario, we need to be able to query the data source using a wildcard query and retrieve a single specific result.

First of all, let’s take a look at the query method. You’ll remember from earlier examples that the operation for retrieving a list of data is referenced using the Finder stereotype. We’ll start by creating a new method for this stereotype.

  1. In the Entity viewer in Visual Studio, delete the default Entity1 object, and then drag a new Entity from the toolbox onto the design surface. Change the Entity name to WebResult.

  2. In the BDC Methods Details pane, click <Add a Method> to create a new method. From the drop-down that appears, select Create Finder Method. This will automatically add a method named ReadList.

  3. Since our Finder method needs to be able to perform wildcard searches, we need to add a wildcard filter. We’re effectively performing the same configuration that we did earlier when we set up a search filter on the Model External Content Type—you’ll no doubt recognize some of the configuration objects that we’re dealing with. To add a new filter, we first need a parameter to which we can attach the filter. We’ll add a new query parameter to the ReadList method. Expand the parameters node in the BDC Method Details pane, and then click Add a Parameter. Select Create A Parameter to add a new parameter to the method. You’ll notice that although the default parameter name is selected in the BDC Method Details pane, it’s not possible to overtype it with a new value. To add a new value, we need to use the Properties pane, as shown next. Type query for the new parameter name.

  4. With this new parameter in place, we’re now free to add a new filter. Under the Filter Descriptors node, click <Add a Filter Descriptor>, and then select Create a Filter Descriptor. As before, use the Properties pane to change the Name to Search Filter and the Type to Wildcard. To make this filter the default, we need to add an additional property. Click the ellipsis next to Custom Properties in the Properties pane to add another property. Type IsDefault for the Name, System.Boolean for the Type, and true for the Value.

  5. Now that we have a filter, we need to associate it with our ReadList method. We can do this by selecting an associated type description. You’ll notice in the BDC Method Details pane that each parameter has a type descriptor attached. A type descriptor is metadata that defines the type of the parameter as well as a number of properties that control how the type should be handled, such as whether the type is an identifier or should be read-only. When we added our additional parameter to the ReadList method, a new type descriptor was automatically created. We need to attach our Search Filter to this type. From the BDC Explorer pane, expand the ReadList node and the query node beneath it. Select the queryTypeDescriptor node to define the properties of the parameter. First, let’s change the name to something more succinct: In the Properties pane, change the Name to simply query. To attach the filter to this type, select the filter name (Search Filter) from the drop-down list next to the Associated Filter property, as illustrated next:

 
Others
 
- Sharepoint 2010 : Building a .NET Connectivity Assembly (part 1) - Business Data Connectivity Model Project
- Windows 8 : Configuring security - Managing Windows Firewall and exceptions (part 5) - Configuring outbound rules, Configuring connection security rules
- Windows 8 : Configuring security - Managing Windows Firewall and exceptions (part 4) - Allowing the secure connection
- Windows 8 : Configuring security - Managing Windows Firewall and exceptions (part 3) - Configuring IPsec settings
- Windows 8 : Configuring security - Managing Windows Firewall and exceptions (part 2) - Modifying a firewall profile
- Windows 8 : Configuring security - Managing Windows Firewall and exceptions (part 1) - Choosing Windows Firewall
- Exchange Server 2010 : Interoperability with Earlier Versions of Exchange
- Exchange Server 2010 : Positioning the Client Access Server in Your LAN (part 2) - Client Redirection, Client Access Arrays
- Exchange Server 2010 : Positioning the Client Access Server in Your LAN (part 1) - Client Access Server Proxying
- SQL Server 2012 Security : SQL Server Instance Security (part 2) - Server Permissions, Endpoints, User-Defined Server Roles
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us