<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>SharePoint Magazine &#187; Wen He</title>
	<atom:link href="http://sharepointmagazine.net/author/wenhe/feed" rel="self" type="application/rss+xml" />
	<link>http://sharepointmagazine.net</link>
	<description>SharePoint Magazine is an online Magazine dedicated to the world of SharePoint</description>
	<lastBuildDate>Mon, 05 Jul 2010 09:14:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Everything You Need to Know about BDC: Part 8 of 8</title>
		<link>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-8-of-8</link>
		<comments>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-8-of-8#comments</comments>
		<pubDate>Mon, 08 Feb 2010 10:53:04 +0000</pubDate>
		<dc:creator>Wen He</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[BDC]]></category>
		<category><![CDATA[BI]]></category>
		<category><![CDATA[Business Data Catalog]]></category>
		<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Dashboards]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=3838</guid>
		<description><![CDATA[An action is simply an operation upon a selected item. The operation can retrieve information about the selected item, or it can launch a program or Web page with the selected item as a parameter.]]></description>
			<content:encoded><![CDATA[<p>Welcome back to Part 8 of our 8-part series on the Business Data Catalog (BDC). From the previous 7 installments, we have covered everything about BDC, from BDC architecture, ADF, BDC Web parts, BDC search and profile, to the BDC object model in details.  We also touched the surface of BDC actions in <a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-4-of-8">Part 4</a> and <a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-5-of-8">Part 5</a>. As promised, we’ll dedicate this final article to actions. We’ll explain what the BDC actions are and what they can do for you.  We’ll then walk you through how to create custom actions and how to perform these actions by using custom Web parts and InfoPath forms. As you will soon learn, this is another power capability of BDC because it extends the ability to link content to Web sites.  This allows you to quickly create mashups that are item-specific so that you can take actions in context, such as write back to your LOB systems.</p>
<p>For your reference, these are our previous seven articles:</p>
<ol>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-1-of-8">Part 1</a>, BDC Purpose and technical architecture</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-2-of-8">Part 2</a>, Application Definition File (ADF) and its Development</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-3-of-8">Part 3</a>, Developing an ADF to Connect to Web Services</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-4-of-8">Part 4</a>, Consuming Business Data through Web Parts and SharePoint Lists</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-5-of-8">Part 5</a>, Implementing Enterprise Search with Business Data</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-6-of-8">Part 6</a>, Integrating User Profiles with Business Data</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-7-of-8">Part 7</a>, Working with the BDC Object Model</li>
</ol>
<p>With that, let’s dive into BDC actions and start by asking what is an action.</p>
<h3>What is an action?</h3>
<p>An action is simply an operation upon a selected item. The operation can retrieve information about the selected item, or it can launch a program or Web page with the selected item as a parameter. The operation is a predefined URL link in each BDC item that enables you to act on the item, such as editing, or mapping it using Live Search as we demonstrated in Part 4.<br />
An action is composed of a URL target where the action is to occur, and the matching parameters in the URL QueryString format. When we associate an action with an entity, we can pass parameters to that action based on the contents of one or more fields. For example, in the Live Search example in Part 4, we associate the Live Search page’s URL with a customer and provide the customer’s address to parameterize the search.</p>
<p>From the above, major characteristics of actions are as follows:</p>
<ol>
<li>URL-based, parameter-driven</li>
<li>Actions on any entity and appear everywhere an entity goes</li>
<li>User can take action in ECB menu</li>
<li>Custom actions means custom code</li>
</ol>
<p>A perfect example of action is the default View Profile action, as shown in <strong>Figure 1</strong>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb.png" border="0" alt="image" width="644" height="331" /></a><br />
Figure 1  View Profile action in a Business Data Actions Web Part</p>
<p>Through a View Profile action we can navigate to the profile page of an entity. Clicking the View Profile action in a Business Data Actions Web Part as shown in Figure 1 above, as well as in a Business Data column, or in a Business Data List Web Part, lets us view the details of an item on that item&#8217;s profile page. <strong>Figure 2</strong> shows that a Profile page that displays employee details.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image1.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb1.png" border="0" alt="image" width="299" height="484" /></a><br />
Figure 2  A Profile page that displays employee details</p>
<h4>What is a Profile page?</h4>
<p>A profile page is automatically generated for each entity that has a SpecificFinder method after BDC imports an ADF file, a profile page can display all the information from a record in the BDC.  As we’ve seen in <strong>Figure 2</strong>, a profile page can display all the fields in a record for a specific employee. The default profile page contains a BDC Item Web Part for that entity.<br />
If we put the profile page in Edit mode, there are actually two Web parts: a Business Data Item Builder and a Business Data Item that connect together. The Item Builder parses the querystring (<a href="http://win7:10001/ssp/admin/Content/Employee.aspx?EmployeeID=1)">http://win7:10001/ssp/admin/Content/Employee.aspx?EmployeeID=1)</a> and passes the EmployeeID value to the Business Data Item, which then executes the SpecificFinder method and returns a record of Employee data.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image2.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb2.png" border="0" alt="image" width="543" height="484" /></a><br />
Figure 3  Profile page components</p>
<h4>Default Profile Page and default action</h4>
<p>As we have seen from above section, the default action (View Profile) along with the default Profile page is automatically created when the entity has a SpecificFinder method.  To provide an ECB menu user experience, we can also add actions in a Business Data List Web part without using the Business Data Actions Web Part.</p>
<h4>Defining an Action</h4>
<p>There are three ways to add an action: 1) defining it in the ADF, 2) adding it in the BDC admin page after the ADF has been imported into BDC, and 3) through the BDC Object Model. Here we’re focus the first two.</p>
<h5>Defining it in the ADF</h5>
<p>To define an Action for the specified BDC entity, we’ll first locate the &lt;Actions&gt; section within the &lt;Entities&gt; and &lt;Entity&gt; hierarchy.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image3.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb3.png" border="0" alt="image" width="644" height="241" /></a><br />
Figure 4  Actions is nested within the Entities/Entity in ADF</p>
<p>And insert the &lt;action&gt; portion like this one:</p>
<p>&lt;Actions&gt;<br />
&lt;Action Name=&#8221;Update Employee&#8221; Position=&#8221;1&#8243; IsOpenedInNewWindow=&#8221;false&#8221; Url=&#8221;pages/editemployee.aspx?EmployeeID={0}&#8221; ImageUrl=&#8221;"&gt;<br />
&lt;ActionParameters&gt;<br />
&lt;ActionParameter Name=&#8221;EmployeeID&#8221; Index=&#8221;0&#8243; /&gt;<br />
&lt;/ActionParameters&gt;<br />
&lt;/Action&gt;</p>
<h5>Adding an action in the BDC admin page</h5>
<p>In the SSP administration page (View Application –&gt; View Entity), the action is defined below and the URL that takes EmployeeID as a parameter: <a href="http://dpm:10001/ssp/admin/Content/Employee.aspx?EmployeeID={0}">http://dpm:10001/ssp/admin/Content/Employee.aspx?EmployeeID={0}</a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image4.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb4.png" border="0" alt="image" width="644" height="277" /></a><br />
Figure 5  Add an action the SSP Admin page</p>
<h4>Custom Actions</h4>
<p>We also can create custom actions for entities in BDC. Among other things, custom actions allow users to navigate to any custom page to manipulate business data.<br />
Here are some scenarios that custom actions can do:</p>
<ol>
<li>Parameterize custom search</li>
<li>Update employee in HR system</li>
<li>Customize profile page for an entity</li>
<li>Integrate BDC search into enterprise report center</li>
</ol>
<p>We’ll be creating custom actions in the last part the article.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image5.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb5.png" border="0" alt="image" width="644" height="313" /></a><br />
Figure 6 Enable View Profile action in a Business Data List Web part</p>
<p>This enables the ECB-style action, we will specify a Title property and add the following in the ADF:<br />
&lt;Entity EstimatedInstanceCount=&#8221;0&#8243; Name=&#8221;Employee&#8221;&gt;<br />
&lt;Properties&gt;<br />
&lt;Property Name=&#8221;Title&#8221; Type=&#8221;System.String&#8221;&gt;LastName&lt;/Property&gt;<br />
&lt;/Properties&gt;<br />
&lt;/Entity&gt;</p>
<p>It specifies which column in the Business Data List/Related List Web part displays the Actions menu. It also specifies the name of the TypeDescriptor that corresponds to the column you want to display as the default column in Business Data lists.</p>
<p>In the Business Data Column scenario, we can also display the action menu and link the column to the business data profile in a Business Data list.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image6.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb6.png" border="0" alt="image" width="644" height="160" /></a><br />
Figure 7  View Profile action in Business Data Column</p>
<p>This is default behavior OOB for a Business Data column.  When adding the column, just make sure the following two are checked:</p>
<ul>
<li>Display the actions menu</li>
<li>Link this column to the profile page to</li>
</ul>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image7.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb7.png" border="0" alt="image" width="644" height="410" /></a><br />
Figure 7  Enable the actions menu and profile page in Business Data list</p>
<p>These profile pages are used and being indexed by BDC Search. The following search results display the profile pages that contain the search keyword (s).  Notice in Figure 8 how a search for Great Lakes will display the profile pages for both this customer and their orders.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image8.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb8.png" border="0" alt="image" width="543" height="480" /></a><br />
Figure 8  BDC Search Results in Profile Pages</p>
<h4>Enhancing the Profile Page</h4>
<p>By default, the profile page is hosted on the Shared Services Provider site collection where the BDC administration site is located. The search result (that is, the URL) links back to the Shared Services Administration site collection address that is not scalable when you extend the Web application. In real world, we may not want to give end users access to the SSP Admin site for security reason. A better practice is to create our own profile pages and host them in any site that is not part of the SSP site collection.<br />
In this example, we’ve created a dashboard page in Report Center to replace the default Profile Page. The Report Center provides enterprise reporting capabilities that are scalable and centralized.  We can direct users to custom profile pages by updating the View Profile action.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image9.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb9.png" border="0" alt="image" width="644" height="446" /></a><br />
Figure 9  Replace the default Profile Page with Custom Report Center</p>
<p>As an alternative, we can also replace the default the URL in Action element in ADF with the path to the Profile.aspx page:</p>
<p>&lt;Actions&gt;<br />
&lt;Action Position=&#8221;1&#8243; IsOpenedInNewWindow=&#8221;false&#8221; Url=&#8221;<a href="http://reportcenter/Pages/Profile.aspx?EmployeeID={0">http://reportcenter/Pages/Profile.aspx?EmployeeID={0}&#8221;</a> ImageUrl=&#8221;/_layouts/1033/images/viewprof.gif&#8221; Name=&#8221;View Profile&#8221;&gt;<br />
&lt;ActionParameters&gt;<br />
&lt;ActionParameter Index=&#8221;0&#8243; Name=&#8221;EmployeeID&#8221; /&gt;<br />
&lt;/ActionParameters&gt;<br />
&lt;/Action&gt;<br />
&lt;/Actions&gt;</p>
<p>An action to call the Profile.aspx page for each Employee ID has been defined. This action will be the default action provides in the search result.</p>
<p>Now let’s create Profile page to display information about the Employee entity in Report Center. (The Report Center is a site that provides a central location for business-intelligence-related information.)</p>
<ol>
<li>In the <a href="http://reportcenter">http://reportcenter</a> site, create a new Blank Web Part Page called “Profile.aspx”.</li>
<li>Add the following two web parts: Query String (URL) Filter Web Part and Report Viewer Web Part.</li>
<li>Configure the Query String (URL) Filter Web Part to pickup parameter “EmployeeID” from the URL query string.</li>
<li>Configure the Report Viewer Web Part to display the employee profile report called “Employee Profile”.</li>
<li>Connect the Query String (URL) Filter Web Part parameter to the SQL Server Reporting Services Report Viewer Web Part parameter “EmployeeID”.</li>
</ol>
<blockquote><p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image10.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb10.png" border="0" alt="image" width="644" height="67" /></a><br />
Figure 10  SQL Server Reporting Services Report Viewer</p>
<p>Note: Please make sure you use this Web Part and not the OOB Report Viewer Web Part.</p></blockquote>
<p>Test that the page is picking up the URL string parameter “EmployeeID” correctly by typing the following URL: <a href="http://reportcenter/Pages/Profile.aspx?EmployeeID=108">http://reportcenter/Pages/Profile.aspx?EmployeeID=108</a></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image11.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb11.png" border="0" alt="image" width="644" height="218" /></a><br />
Figure 11  Custom Profile Page in Report Center</p>
<h4>Creating Custom Actions</h4>
<p>Creating custom actions requires custom code. The approach we take is to treat the BDC source simply as a data reader, and to build our CRUD (create/read/update/delete) logic in custom code. The BDC object model provides the means to retrieve collections, list items and enumerators, and we can use GenericInvoker to perform CRUD, which has been extensively covered in Part 7. We get the Web Parts to display data, and then we can use custom actions to create and update records by using Web parts and InfoPath Forms.</p>
<h4>Creating Web Parts</h4>
<p>We have created and deployed two Web Parts using the Object Model as shown below, with one inserting a record and one updating an existing record. (Special thanks to Lightning Tools! I’ve used <a href="http://www.lightningtools.com/bdc-meta-man/default.aspx">BDC Meta Man</a> to help with creating the Web parts.)</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image12.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb12.png" border="0" alt="image" width="467" height="480" /></a><br />
Figure 12  The two Custom Web Parts can be used to add and update employee records</p>
<p>Add these two actions in the SSP Admin page:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image13.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb13.png" border="0" alt="image" width="644" height="166" /></a><br />
Figure 13  Adding actions in the SSP Admin page</p>
<p>Now you can access the two actions from the content menu in the Employee List:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image14.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb14.png" border="0" alt="image" width="644" height="241" /></a><br />
Figure 14  Custom Actions Add Employee and Update Employee in the context menu</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image15.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb15.png" border="0" alt="image" width="644" height="342" /></a><br />
Figure 15  Add Employee Web Part</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image16.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb16.png" border="0" alt="image" width="561" height="484" /></a><br />
Figure 16  Update Employee Web Part</p>
<h4>Creating InfoPath Form</h4>
<p>MSDN has a great article titled Using Business Data Catalog Actions to Pass Parameters to InfoPath 2007 Browser Forms that walks you through this in detail.  So I’ve created our InfoPath Form and added the action using the Form Template path:<br />
<a href="http://dpm/_layouts/FormServer.aspx?XsnLocation=http://dpm/FormServerTemplates/EmployeeUpdate.xsn&amp;DefaultItemOpen=1&amp;EmployeeID={0}&amp;FirstName={1}&amp;LastName={2}">http://dpm/_layouts/FormServer.aspx?XsnLocation=http://dpm/FormServerTemplates/EmployeeUpdate.xsn&amp;DefaultItemOpen=1&amp;EmployeeID={0}&amp;FirstName={1}&amp;LastName={2}</a><br />
<a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image17.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb17.png" border="0" alt="image" width="644" height="277" /></a><br />
Figure 17  Adding Custom Action that uses InfoPath Form</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2010/02/image18.png"><img style="border-width: 0px;" src="http://sharepointmagazine.net/wp-content/uploads/2010/02/image_thumb18.png" border="0" alt="image" width="644" height="475" /></a><br />
Figure 18  Update Employee in InfoPath Form</p>
<h4>Conclusion</h4>
<p>In this final article, we have focused on actions that users can take on the business entities. We can define actions in ADF or add it “after the fact”. We have also created custom actions using the BDC object model by using custom Web parts and InfoPath forms to enable CRUD (create/read/update/delete) operation support. Once added, actions can be performed from within the list, which becomes relatively transparent to the user where the data comes from. [The statement that the BDC data is read-only is not true anymore as we have just demonstrated.] As you have learned from our 8-part series, BDC enables user interaction in business intelligence, enterprise content management, collaboration and social features, and enterprise search.</p>
<h4>Looking Forward to SharePoint Server 2010</h4>
<p>BDC has evolved to what is now called BCS (business connectivity services) in SharePoint 2010. Even though we can use BDC to enable connectivity to external systems, it was difficult to create solutions because of the lack of a designer and it was not so simple to create a solution that enabled users to make changes and write that data back to the external store. BCS now enables you to integrate LOB data into SharePoint and Office with full CRUD support, tighter integration with Office client applications, and better tools for modeling business entities. BCS is all about connecting to external data. We look forward to sharing with you the exciting new features in BCS and what they can do for you in the near future. Until then, aloha!</p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-8-of-8/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Everything You Need to Know about BDC: Part 7 of 8</title>
		<link>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-7-of-8</link>
		<comments>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-7-of-8#comments</comments>
		<pubDate>Wed, 17 Jun 2009 00:00:44 +0000</pubDate>
		<dc:creator>Wen He</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[BDC]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[lob]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=3328</guid>
		<description><![CDATA[Welcome back to Part 7 of our 8 Business Data Catalog (BDC) series. In this article, we will be focusing on the BDC Object Model.]]></description>
			<content:encoded><![CDATA[<p>Welcome back to Part 7 of our 8 Business Data Catalog (BDC) series. In this article, we will be focusing on the BDC Object Model. We start off by explaining why we would need the BDC Object Model and what it can do for us. From there we will look at some examples. Then we’ll step into the code and develop our own data access layer and custom applications to read from and write back to the LOB (line of business) systems. Finally we’ll conclude with best practices.</p>
<p>For your reference, these are our previous six articles:</p>
<ol>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-1-of-8">Part 1</a>, BDC Purpose and technical architecture</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-2-of-8">Part 2</a>, Application Definition File (ADF) and its Development</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-3-of-8">Part 3</a>, Developing an ADF to Connect to Web Services</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-4-of-8">Part 4</a>, Consuming Business Data through Web Parts and SharePoint Lists</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-5-of-8">Part 5</a>, Implementing Enterprise Search with Business Data</li>
<li><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-6-of-8">Part 6</a>, Integrating User Profiles with Business Data</li>
</ol>
<p>Until now, we have been working strictly with the out-of-the-box features and capabilities of BDC. MOSS Enterprise has also provided us another powerful approach for working with BDC, which is to employ the BDC Object Model and programmatically interact with a LOB system. This gives us as developers the power and control over BDC to further meet growing business needs.</p>
<p>You might be wondering why we use the BDC Object Model when you can just use ADO.NET. The reason is two-fold: 1) you already have BDC in place that has already abstracted the complexity of the business data and you want to maximize your investments, and 2) BDC takes care of authentication, authorization, and other security requirements, which is extremely helpful if you are writing a custom application that calls into a back-end system. So this makes the BDC Object Model a compelling API for us.</p>
<p>Using the BDC Object Model, we can accomplish many things such as the following examples:</p>
<ol>
<li>Auto-populate a SharePoint list that has a Business Data Column</li>
<li>Directly edit a customer in SAP</li>
<li>Synchronize content between SharePoint and an LOB system</li>
<li>Update and manipulate the ADF schema</li>
</ol>
<p>We now know what the Object Model can do so let’s first exam where the BDC Object Model fits in BDC architecturally.</p>
<h4>The BDC Object Model Overview</h4>
<p>To see where the BDC Object Model fits in the BDC world, let’s revisit the BDC architecture from <a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-1-of-8">Part 1</a> with <strong>Custom Applications</strong> highlighted in <strong>Figure 1</strong>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/06/image1.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/image-thumb1.png" border="0" alt="image" width="640" height="449" /></a><br />
<strong>Figure 1 The BDC Object Model Creates Custom Applications.</strong></p>
<p>As you can see from the figure above, BDC allows developers to connect to disparate LOB systems and these systems are exposed as data sources to various MOSS features such as Web Parts, list columns, enterprise search, user profiles, and custom applications that can be developed to interface with SharePoint.</p>
<p>Custom applications can be also developed to customize and extend the existing capabilities of BDC. That’s where the BDC Object Model fits in the picture and becomes the focus of this article. The BDC Object Model provides us with new namespaces and classes (methods and properties) we can use in Visual Studio the same way we use a standard set of .NET classes and interfaces. The OOB Web Parts such as Business Data List Web Part goes through this same API that we are going to learn about. You can also create your custom Applications using the same API.</p>
<p>As we have learned already, BDC abstracts the business logic in an XML-based ADF file and stores it in a shared service provider (SSP) database. This file contains all the necessary configuration data that determines how the BDC will connect to the remote systems and which requested data to make available through the BDC Object Model. The following figure shows the interaction between the ADF and the Object Model.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/06/image3.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/image-thumb3.png" border="0" alt="image" width="300" height="406" /></a><br />
<strong>Figure 2 The BDC Object Model and How It Works</strong></p>
<p>As you can see, BDC Object Model consists of <strong>Runtime</strong> and <strong>Administration</strong> object models. Each of these performs different tasks:</p>
<p>1. Runtime object model</p>
<ul>
<li>Browse metadata, execute methods, retrieve instances, traverse relationships</li>
<li>Used to build custom applications</li>
</ul>
<p>2. Administration object model</p>
<ul>
<li>Create, read, update, and delete metadata and manage permissions</li>
<li>Used to edit the metadata internally or to build metadata management tools</li>
</ul>
<h4><strong>Using the BDC Object Model</strong></h4>
<p>In order to connect to the BDC from our code, we will use the root namespace within the BDC Object model <strong>Microsoft.Office.Server.ApplicationRegistry</strong>. If you’re curious as to the term Application Registry, just know that it was the original name for BDC. It’s defined in the assembly <strong>Microsoft.sharepoint.portal.dll. </strong>Through the root namespace we have access to the child namespaces and its classes that we are going to use later in the article. Here they are listed in this table:</p>
<table class="MsoTableGrid" style="border-style: none; width: 7.65in; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="0" width="734">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<td style="border: 1pt solid black; padding: 0in 5.4pt; width: 81.7pt;" width="109" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 8pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Category</span></strong></p>
</td>
<td style="border-color: black; border-width: 1pt; border-top: 1pt solid black; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 8pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Namespace</span></strong></p>
</td>
<td style="border-color: black; border-width: 1pt; border-top: 1pt solid black; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 8pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Main Classes</span></strong></p>
</td>
<td style="border-color: black; border-width: 1pt; border-top: 1pt solid black; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 8pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Tasks</span></strong></p>
</td>
</tr>
<tr style="mso-yfti-irow: 1">
<td style="border-color: black; border-width: 1pt; border-left: 1pt solid black; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 81.7pt;" rowspan="2" width="109" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Runtime Object Model</span></strong></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">MetadataModel</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">LobSystem</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">LobSystemInstance</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Entity</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">MethodInstance</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Association</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Use it to read (and only read) the BDC objects and execute queries</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 2">
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Runtime</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">IEntityInstanceEnumerator</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Used to manage results like a DataReader</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 3">
<td style="border-color: black; border-width: 1pt; border-left: 1pt solid black; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 81.7pt;" width="109" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Administration Object Model</span></strong></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Administration</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">LobSystem</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">LobSystemInstance</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Entity</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Method</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">MethodInstance</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Association</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Use to create and edit the BDC objects (LOB system, entity, and method) and access control lists (ACLs) </span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 4">
<td style="border-color: black; border-width: 1pt; border-left: 1pt solid black; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 81.7pt;" rowspan="3" width="109" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><strong><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Shared (Supporting) Classes</span></strong></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Infrastructure</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">SqlSessionProvider</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">EntityInstanceIdEncoder</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">BdcAccessControlList</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Use it to manage security and connections to the database</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 5">
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">SystemSpecific.Db</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">DbEntityInstanceEnumerator</span></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Use to manipulate entityinstances</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 6; mso-yfti-lastrow: yes">
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 88.75pt;" width="118" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><em><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">WebService*</span></em></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 201.85pt;" width="269" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Web services are part of the BDC API and layer on top of the object model and can be called remotely via the URL </span><a href="http://webapp/_vti_bin/businessdatacatalog.asmx"><span style="font-size: 7.5pt; color: #0000cc; font-family: 'Verdana','sans-serif'; text-decoration: none; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; text-underline: none">http://webapp/_vti_bin/businessdatacatalog.asmx</span></a></p>
</td>
<td style="border-style: none solid solid none; border-right: 1pt solid black; border-bottom: 1pt solid black; padding: 0in 5.4pt; width: 178.5pt;" width="238" valign="top">
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal"><span style="font-size: 7.5pt; color: black; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Use to remotely get LOB system instances, entities, and methods</span></p>
</td>
</tr>
</tbody>
</table>
<p><strong>Table 1: Namespaces and Classes</strong></p>
<p><strong>Tip</strong>: <strong>MetadataModel</strong> and <strong>Administration</strong> use some of the same class names such as LobSystem and Entity so one way to avoid conflict when using them together is to use an alias as follows:</p>
<p>using BDCAdmin = Microsoft.Office.Server.ApplicationRegistry.Administration;</p>
<p>MSDN already has a code sample linked <a href="http://msdn.microsoft.com/en-us/library/ms492509.aspx">here</a> on how to use the <strong>Administration</strong> object model to create and import an ADF. Since it’s more practical to us, we will use the <strong>Runtime</strong> object model primarily throughout this article.</p>
<p>Now we have the basic understanding of the BDC Object Model. Let’s make use of it by applying it to the following three scenarios:</p>
<ol>
<li>Auto-populate a SharePoint list that has a Business Data Column</li>
<li>Create a BDC Utility Class that can be used in custom Applications and Web services</li>
<li>Create a custom application to update the LOB systems</li>
</ol>
<p>Since all three of these will use the Runtime object model, we can initialize our code examples by first referencing the assembly <strong>Microsoft.sharepoint.portal.dll</strong> and then import the namespaces accordingly depending on the tasks:</p>
<p>Now that namespaces have been imported, the next line of code designates the Shared Service Provider (SSP) that provides the ADF. This is accomplished using the following call to the SqlSessionProvider singleton Instance property:</p>
<p class="MsoNormal"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">using</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> Microsoft.SharePoint;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">using</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> Microsoft.Office.Server.ApplicationRegistry.Runtime;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">using</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> Microsoft.Office.Server.ApplicationRegistry.Infrastructure;<br />
</span><span style="font-size: 10pt; color: blue; line-height: 115%; font-family: 'Courier New'; mso-no-proof: yes">using</span><span style="font-size: 10pt; line-height: 115%; font-family: 'Courier New'; mso-no-proof: yes"> Microsoft.Office.Server.ApplicationRegistry.MetadataModel;</span></p>
<p class="MsoNormal">SqlSessionProvider.Instance().SetSharedResourceProviderToUse(sspName);</p>
<p>The next set of code is the actual connection to the appropriate BDC and system instance. The connection is established by indicating the LobSystemInstance and Entity objects with the following statements:</p>
<p>LobSystemInstance lobInstance = ApplicationRegistry.GetLobSystemInstanceByName(&#8220;SynergyData&#8221;);</p>
<p>//Connect to the customers entity</p>
<p>Entity customers = lobInstance.GetEntities()["Customers"];</p>
<p>Following are the top steps we perform to call into the BDC and retrieve the data:</p>
<ol>
<li>Connect to the named SSP</li>
<li>Connect to LOB Instance</li>
<li>Connect to entity</li>
<li>Connect to method for the entity</li>
<li>Execute the method</li>
<li>Parse the results</li>
</ol>
<p>Now that you understand how to initialize your projects that use the Runtime API, let’s now examine each scenario:</p>
<h5><strong>1. Auto-populate a SharePoint list with Business Data Column</strong></h5>
<p>This application automatically populates a SharePoint list that has a Business Data Column storing customer records. First we create a SharePoint teamsite named <strong>teamsite</strong> and a SharePoint list called <strong>Customers</strong>. Then we reference both the SharePoint assembly <strong>Microsoft.SharePoint.dll</strong> and BDC assembly <strong>Microsoft.SharePoint.Portal.dll</strong>. Then code the using clauses to import the namespaces and code against the BDC Object Model by connecting to BDC and execute the method instance which will return all customers.</p>
<p>As my colleague <a href="http://www.synergyonline.com/about/professionalprofiles/Pages/RandyWilliams.aspx">Randy Williams</a> has already demoed in his <a href="http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=50">blog</a>, here’s the complete code:</p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Get SPList handle </span></span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SPSite</span> site = <span style="color: blue">new</span> <span style="color: #2b91af">SPSite</span>(<a href="http://MOSS">http:<span style="color: green">//MOSS</span></a>);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SPWeb</span> web = site.OpenWeb(<span style="color: #a31515">&#8220;teamsite&#8221;</span>);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SPList</span> customerList = web.Lists[<span style="color: #a31515">"Customers"</span>];</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connected named SSP using the following call to the SqlSessionProvider singleton instance property<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SqlSessionProvider</span>.Instance().SetSharedResourceProviderToUse(<span style="color: #a31515">&#8220;SSP&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to the LOBSystemInstance<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">LobSystemInstance</span> lobInstance = <span style="color: #2b91af">ApplicationRegistry</span>.GetLobSystemInstanceByName(<span style="color: #a31515">&#8220;SynergyData&#8221;</span>);</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to the customers entity<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">Entity</span> customers = lobInstance.GetEntities()[<span style="color: #a31515">"Customers"</span>];</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to our finder method for customers<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">MethodInstance</span> getCustomers = customers.GetFinderMethodInstance();</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Execute finder method<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">IEntityInstanceEnumerator</span> results = (<span style="color: #2b91af">IEntityInstanceEnumerator</span> ) customers.Execute(getCustomers, lobInstance);</span></p>
<p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//iterate through each row returned and add a new item<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">while</span> (results.MoveNext())<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SPListItem</span> item = customerList.Items.Add();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>item[<span style="color: #a31515">"Customers_ID"</span>] = <span style="color: #2b91af">EntityInstanceIdEncoder</span>.EncodeEntityInstanceId(<span style="color: blue">new</span> <span style="color: blue">object</span>[] { results.Current[<span style="color: #a31515">"CustomerID"</span>].ToString() });<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>item.Update();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<h5><strong>2. Create a BDC Utility Class</strong></h5>
<p>We’re going to create a custom library that uses the BDC Object Model to connect to an ADF.  We treat the BDC source simply as a data reader and to build our create/update/delete logic in an assembly. The BDC object model provides the means to retrieve collections, list items and enumerators, and we do the rest. In this class, we are going to create the following three static methods:</p>
<ol>
<li>ExecuteFinder()</li>
<li>ExecuteSpecificFinder()</li>
<li>ExecuteGenericInvoker()</li>
</ol>
<p>Let’s go through the code one by one. Here’s the first static method named <strong>ExecuteFinder</strong> that returns all of the entity records.</p>
<p class="MsoNormal"><span style="font-size: 10pt; color: #4c4c4c; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'">namespace SharePointMag<br />
{<br />
public class BDCUtil<br />
{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">DataSet</span> ExecuteFinder(<span style="color: blue">string</span> SSPName, <span style="color: blue">string</span> LobSystemInstance, <span style="color: blue">string</span> Entity)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DataSet</span> ds = <span style="color: blue">new</span> <span style="color: #2b91af">DataSet</span>(Entity);</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to named SSP<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">if</span> (SSPName != <span style="color: blue">null</span>)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SqlSessionProvider</span>.Instance().SetSharedResourceProviderToUse(SSPName);</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to LOB Instance<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">LobSystemInstance</span> lobInstance = <span style="color: #2b91af">ApplicationRegistry</span>.GetLobSystemInstanceByName(LobSystemInstance);</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to customers entity<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">Entity</span> entity = lobInstance.GetEntities()[Entity];</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to Finder method for customers<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">MethodInstance</span> finder = entity.GetFinderMethodInstance();</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Execute Finder method<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DbEntityInstanceEnumerator</span> records = (<span style="color: #2b91af">DbEntityInstanceEnumerator</span>)entity.Execute(finder, lobInstance);</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Load matching entities into a DataTable<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DataTable</span> entitiesTable = <span style="color: blue">new</span> <span style="color: #2b91af">DataTable</span>();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">while</span> (records.MoveNext())<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Load each entity and include the Action URL<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DbEntityInstance</span> record = (<span style="color: #2b91af">DbEntityInstance</span>)records.Current;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DataTable</span> entityTable = record.EntityAsDataTable;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>entityTable.AcceptChanges();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>entitiesTable.Merge(entityTable);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//DataTable ordersTable = customerOrders.Tables.Add(&#8220;Orders&#8221;);<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>ds.Tables.Add(entitiesTable);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">return</span> ds;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}<br />
</span><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"> }<br />
</span><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">}</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">The following code calls </span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">ExecuteFinder of</span><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"> BDCUtil class to return the customers records:</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: blue">static</span> DataSet GetEntity()<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">return</span> <span style="color: #2b91af">BDCUtil</span>. ExecuteFinder(<span style="color: #a31515">&#8220;SSP&#8221;</span>, <span style="color: #a31515">&#8220;SynergyDataInstance&#8221;</span>, <span style="color: #a31515">&#8220;Customers&#8221;</span>);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">The following is a Web service example to call the BDCUtil class to return all the customer records:</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>[<span style="color: #2b91af">WebMethod</span>]<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: #2b91af">DataSet</span> GetCustomers()<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">string</span> SSPName=<span style="color: #a31515">&#8220;SSPPS&#8221;</span>;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">string</span> strLOBInstance=<span style="color: #a31515">&#8220;SynergyDataInstance&#8221;</span>;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">string</span> Entity=<span style="color: #a31515">&#8220;Customers&#8221;</span>;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DataSet</span> ds = <span style="color: blue">new</span> <span style="color: #2b91af">DataSet</span>(Entity);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>ds = <span style="color: #2b91af">BDCUtil</span>. ExecuteFinder(SSPName, strLOBInstance, Entity);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">return</span> ds;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">Note: For simplicity, we explicitly pass in the name of LOB Instance and Entity in our examples. They could also be “discovered” if you desire. Please check out this </span><a href="http://msdn.microsoft.com/en-us/library/ms568510.aspx"><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">MSDN</span></a><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> article titled <em>How to: Get Started with Using the Runtime Object Model</em>.</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">The second method named </span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">ExecuteSpecificFinder returns a single row of record identified by its ID.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">DataSet</span> ExecuteSpecificFinder(<span style="color: blue">string</span> SSPName, <span style="color: blue">string</span> LobSystemInstance, <span style="color: blue">string</span> Entity, <span style="color: blue">object</span>[] parameters)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DataSet</span> ds = <span style="color: blue">new</span> <span style="color: #2b91af">DataSet</span>(Entity);</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to named SSP<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">if</span> (SSPName != <span style="color: blue">null</span>)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SqlSessionProvider</span>.Instance().SetSharedResourceProviderToUse(SSPName);<span style="mso-spacerun: yes"> </span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">try<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to LOB Instance<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">NamedLobSystemInstanceDictionary</span> lobInstances = <span style="color: #2b91af">ApplicationRegistry</span>.GetLobSystemInstances();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">LobSystemInstance</span> lobInstance = lobInstances[LobSystemInstance];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">Entity</span> entity = lobInstance.GetEntities()[Entity];</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Get the specific mathcing record<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DbEntityInstance</span> record = (<span style="color: #2b91af">DbEntityInstance</span>)entity.FindSpecific(parameters, lobInstance);</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Loading matching entity into DataTable<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">DataTable</span> entityTable = record.EntityAsDataTable;</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Return the results as a dataset</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//DataSet ds = new DataSet(Entity);<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>ds.Tables.Add(entityTable);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">return</span> ds;<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">The following code calls the ExecuteSpecificFinder of BDCUtil class to return one row of employee record.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">public</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> <span style="color: blue">static</span> <span style="color: #2b91af">DataSet</span> ExecuteSpecificFinder()<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">object</span>[] parameters = <span style="color: blue">new</span> <span style="color: blue">object</span>[1];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[0] = 1; <span style="color: green">//Employee ID;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">return</span> <span style="color: #2b91af">BDCUtil</span>.ExecuteSpecificFinder(<span style="color: #a31515">&#8220;SSP&#8221;</span>, <span style="color: #a31515">&#8220;SynergyDataInstance&#8221;</span>, <span style="color: #a31515">&#8220;Employees&#8221;</span>, parameters);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">This is the returned employee record that’s displayed in XML format:</span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; color: blue; font-family: consolas">&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Employees</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;<br />
</span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Employees</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;<br />
</span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">EmployeeID</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">1<span style="color: blue">&lt;/</span><span style="color: #a31515">EmployeeID</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">LastName</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">Davolio<span style="color: blue">&lt;/</span><span style="color: #a31515">LastName</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">FirstName</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">Nancy<span style="color: blue">&lt;/</span><span style="color: #a31515">FirstName</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Title</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">Sales Representative<span style="color: blue">&lt;/</span><span style="color: #a31515">Title</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">TitleOfCourtesy</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">Ms.<span style="color: blue">&lt;/</span><span style="color: #a31515">TitleOfCourtesy</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">BirthDate</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">12/8/1948 12:00:00 AM<span style="color: blue">&lt;/</span><span style="color: #a31515">BirthDate</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">HireDate</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">5/1/1992 12:00:00 AM<span style="color: blue">&lt;/</span><span style="color: #a31515">HireDate</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Address</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">507 &#8211; 20th Ave. E.</span><span style="font-size: 9.5pt; font-family: consolas">Apt. 2A<span style="color: blue">&lt;/</span><span style="color: #a31515">Address</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">City</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">Seattle<span style="color: blue">&lt;/</span><span style="color: #a31515">City</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Region</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">WA<span style="color: blue">&lt;/</span><span style="color: #a31515">Region</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">PostalCode</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">98122<span style="color: blue">&lt;/</span><span style="color: #a31515">PostalCode</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Country</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">USA<span style="color: blue">&lt;/</span><span style="color: #a31515">Country</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">HomePhone</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">(206) 555-9857<span style="color: blue">&lt;/</span><span style="color: #a31515">HomePhone</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Extension</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">5467<span style="color: blue">&lt;/</span><span style="color: #a31515">Extension</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Photo</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">FRwvAAIAAAA…truncated…&lt;/<span style="color: #a31515">Photo</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Notes</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">Education includes a BA in psychology from Colorado State University in 1970.<span style="mso-spacerun: yes"> </span>She also completed &#8220;The Art of the Cold Call.&#8221;<span style="mso-spacerun: yes"> </span>Nancy is a member of Toastmasters International.<span style="color: blue">&lt;/</span><span style="color: #a31515">Notes</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">ReportsTo</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">2<span style="color: blue">&lt;/</span><span style="color: #a31515">ReportsTo</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">PhotoPath</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">http://portal.synergy.com/hr/employeephotos/ndavolio.jpg<span style="color: blue">&lt;/</span><span style="color: #a31515">PhotoPath</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">LoginAccount</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; font-family: consolas">synergy\ndavolio<span style="color: blue">&lt;/</span><span style="color: #a31515">LoginAccount</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 9.5pt; color: blue; font-family: consolas"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 9.5pt; color: #a31515; font-family: consolas">Employees</span><span style="font-size: 9.5pt; color: blue; font-family: consolas">&gt;</span><span style="font-size: 9.5pt; color: blue; font-family: consolas"> </span></p>
<p class="MsoNormal"><span style="font-size: 9.5pt; font-family: consolas">Note: The &lt;Photo&gt; element has been truncated to save space here.</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">Now let’s move on to <strong>GenericInvoker </strong>by </span><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">adding <strong>ExecuteGenericInvoker </strong>method in our BDCUtili class</span><strong><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">.</span></strong><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> The <a><strong>ExecuteGenericInvoker</strong> method calls the GenericInvoker method instance to write back to LOB systems.</a></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> ExecuteGenericInvoker(<span style="color: blue">string</span> SSPName, <span style="color: blue">string</span> lobSystemInstance, <span style="color: blue">string</span> entityName, <span style="color: blue">string</span> methodInstance, <span style="color: blue">object</span>[] parameters)</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">{</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//Connect to named SSP<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">if</span> (SSPName != <span style="color: blue">null</span>)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">SqlSessionProvider</span>.Instance().SetSharedResourceProviderToUse(SSPName);</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">NamedLobSystemInstanceDictionary</span> instances = <span style="color: #2b91af">ApplicationRegistry</span>.GetLobSystemInstances();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">LobSystemInstance</span> instance = instances[lobSystemInstance];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">Entity</span> entity = instance.GetEntities()[entityName];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">MethodInstance</span> methInst = entity.GetMethodInstances()[methodInstance];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>entity.Execute(methInst, instance, <span style="color: blue">ref</span> parameters);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">In our third example,</span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"> we look at </span><strong><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">GenericInvoker </span></strong><span style="font-size: 8pt; font-family: 'Verdana','sans-serif'; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes">and then call the</span><strong><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"> ExecuteGenericInvoker </span></strong><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">method we’ve just added.</span></p>
<h4><strong><span style="font-size: 12pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">3. Create a Custom Application to Update the LOB systems</span></strong></h4>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">BDC is very well known as read-only tool. <span style="mso-spacerun: yes"> </span>It’s read-only because the OOB functionality does not make use of <strong>GenericInvoker</strong> methods. However, the object model and ADF support this type of method instance that we invoke just as we would invoke any other method. If you think of this as a stored procedure call and if I can call a stored procedure that runs a select statement, I should be able to call a stored procedure that inserts or updates as long as the underlining data repository supports them. In other words, the <strong>GenericInvoker</strong> method allows us to call other SQL commands. For our situation, we’ll use it to write back to our back-end system.<span style="mso-spacerun: yes"> </span></span></p>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">So let’s first add the <strong>GenericInvoker</strong> method in our ADF file and then call the <strong>ExecuteGenericInvoker </strong>method in our BDCUtil class . (Note: I’ve used </span><a href="http://www.lightningtools.com/bdc-meta-man/default.aspx"><span style="font-size: 8pt; color: #0000cc; font-family: 'Verdana','sans-serif'; text-decoration: none; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; text-underline: none">BDC Meta Man</span></a><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"> to help generate the ADF and create ExecuteGenericInvoker. Thanks Lightning Tools! If you use BDC Definition Editor, you cannot select byte array <em>byte[]</em> as the return type of the field. You can instead select <em>byte</em> and edit the ADF by hand by changing <em>byte</em> to <em>byte[].</em>)  The following is the ADF and for the purpose of this example, only a single entity called Employees has been defined. </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> &lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Entity</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">EstimatedInstanceCount</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">0</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Identifiers</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Identifier</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.Int32</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">EmployeeID</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Identifiers</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Methods</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Methods</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Entity</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Method</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">insertEmployees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Properties</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Property</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">RdbCommandText</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>Insert into Employees(LastName,FirstName,Title) Values(@LastName,@FirstName,@Title);select NewEmployeeID = SCOPE_IDENTITY()<span style="color: blue">&lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Property</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">RdbCommandType</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue">&gt;</span>Text<span style="color: blue">&lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Properties</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameters</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@LastName</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">LastName</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@FirstName</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">FirstName</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@Title</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Title</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">Return</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.Int32</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">NewEmployeeID</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameters</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstances</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstance</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">EmployeesInserter</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">GenericInvoker</span>&#8220;<span style="color: blue"> </span><span style="color: red">ReturnParameterName</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstances</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Method</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Method</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">updateEmployees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Properties</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Property</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">RdbCommandText</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue">&gt;</span>Update Employees SET LastName=@LastName,FirstName=@FirstName,Title=@Title WHERE(EmployeeID=@EmployeeID)<span style="color: blue">&lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Property</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">RdbCommandType</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue">&gt;</span>Text<span style="color: blue">&lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Properties</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameters</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@EmployeeID</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.Int32</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">EmployeeID</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@LastName</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">LastName</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@FirstName</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">FirstName</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@Title</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Title</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">Return</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.Int32</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">EmployeeID</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameters</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstances</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstance</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">EmployeesUpdater</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">GenericInvoker</span>&#8220;<span style="color: blue"> </span><span style="color: red">ReturnParameterName</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstances</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Method</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Method</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">deleteEmployees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Properties</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Property</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">RdbCommandText</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue">&gt;</span>Delete Employees WHERE(EmployeeID=@EmployeeID)<span style="color: blue">&lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Property</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">RdbCommandType</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">System.String</span>&#8220;<span style="color: blue">&gt;</span>Text<span style="color: blue">&lt;/</span><span style="color: #a31515">Property</span><span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Properties</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameters</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">In</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">@EmployeeID</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.Int32</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">EmployeeID</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Direction</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">Return</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue">&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">TypeDescriptor</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">TypeName</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">System.Int32</span>&#8220;<span style="color: blue"> </span><span style="color: red">Name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">EmployeeID</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameter</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Parameters</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstances</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstance</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"> </span><span style="font-size: 10pt; color: red; font-family: 'Courier New'; mso-no-proof: yes">Name</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">=</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">&#8220;<span style="color: blue">EmployeesDeleter</span>&#8220;<span style="color: blue"> </span><span style="color: red">Type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">GenericInvoker</span>&#8220;<span style="color: blue"> </span><span style="color: red">ReturnParameterName</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Employees</span>&#8220;<span style="color: blue"> /&gt;<br />
</span></span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">MethodInstances</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;<br />
</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; font-family: 'Courier New'; mso-no-proof: yes">Method</span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">&gt;</span></p>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">I’ve created three GenericInvoker MethodInstances and they are </span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">EmployeesInserter,EmployeesUpdater</span><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">, and </span><span style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-no-proof: yes">EmployeesDeleter.</span><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"> When a method instance is executed, it will eventually call the appropriate SQL command as shown here:</span></p>
<ul>
<li>
<div class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">Insert into Employees(LastName,FirstName,Title) Values(@LastName,@FirstName,@Title);select NewEmployeeID = SCOPE_IDENTITY()</span></div>
</li>
<li>
<div class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">Update Employees SET LastName=@LastName,FirstName=@FirstName,Title=@Title WHERE(<a href="mailto:EmployeeID=@EmployeeID">EmployeeID=@EmployeeID</a>)</span></div>
</li>
<li>
<div class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes">Delete Employees WHERE(EmployeeID=@EmployeeID)</span></div>
</li>
</ul>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">The following method ExecuteGenericInvoker is to call the GenericInvoker method:</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> InsertEmployee()</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">object</span>[] parameters = <span style="color: blue">new</span> <span style="color: blue">object</span>[3];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[0] = <span style="color: #a31515">&#8220;He&#8221;</span>; <span style="color: green">//Last Name;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[1] = <span style="color: #a31515">&#8220;Wen&#8221;</span>; <span style="color: green">//First Name;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[2] = <span style="color: #a31515">&#8220;SharePoint Architect&#8221;</span>; <span style="color: green">//Title;</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">try<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">BDCUtil</span>.ExecuteGenericInvoker(<span style="color: #a31515">&#8220;SSP&#8221;</span>, <span style="color: #a31515">&#8220;SynergyDataInstance&#8221;</span>, <span style="color: #a31515">&#8220;Employees&#8221;</span>, <span style="color: #a31515">&#8220;EmployeesInserter&#8221;</span>, parameters);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> exception)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">Console</span>.WriteLine(exception.ToString());<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p>The result is as you can see here highlighted:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/06/clip-image002.jpg"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/clip-image002-thumb.jpg" border="0" alt="clip_image002" width="640" height="189" /></a></p>
<p>In the same token, the following code will update the employee record:</p>
<p class="MsoNormal"><span style="font-size: 8pt; color: #4c4c4c; font-family: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">In the same token, the following code will update the employee record:</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> UpdateEmployee()<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">object</span>[] parameters = <span style="color: blue">new</span> <span style="color: blue">object</span>[4];<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: green">//The parameters must match the parameters defined in ADF<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[0] = <span style="color: #a31515">&#8220;10&#8243;</span>; <span style="color: green">//Employee ID;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[1] = <span style="color: #a31515">&#8220;He&#8221;</span>; <span style="color: green">//Last Name;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[2] = <span style="color: #a31515">&#8220;Wen&#8221;</span>; <span style="color: green">//First Name;<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>parameters[3] = <span style="color: #a31515">&#8220;MOSS Architect&#8221;</span>; <span style="color: green">//Title;<br />
</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">try<br />
</span></span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">BDCUtil</span>.ExecuteGenericInvoker(<span style="color: #a31515">&#8220;SSP&#8221;</span>, <span style="color: #a31515">&#8220;SynergyDataInstance&#8221;</span>, <span style="color: #a31515">&#8220;Employees&#8221;</span>, <span style="color: #a31515">&#8220;EmployeesUpdater&#8221;</span>, parameters);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> exception)<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>{<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span><span style="color: #2b91af">Console</span>.WriteLine(exception.ToString());<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}<br />
</span><span style="font-size: 10pt; font-family: 'Courier New'; mso-no-proof: yes"><span style="mso-spacerun: yes"> </span>}</span></p>
<p>Result is as follows:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/06/clip-image004.jpg"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/06/clip-image004-thumb.jpg" border="0" alt="clip_image004" width="640" height="191" /></a></p>
<p>Note: the order of the parameters must match that of the parameters defined in the updateEmployees method in the ADF. The ReturnParameterName (ReturnParameterName=&#8221;Employees&#8221;) is required in the EmployeeUpdater and EmployeeDeleter MethodInstance, even though they have no parameters to return.</p>
<p>As we have just learned, the <strong>GenericInvoker </strong>method is extremely useful because it takes care of authentication and authorization while enabling our custom applications to call in and execute business logic stored in the back-end to insert/update/delete LOB systems.</p>
<h5><strong>Write-back Best Practice</strong></h5>
<p>Even though BDC can update the LOB systems, it’s not suited for all scenarios. I strongly recommend you to take it into consideration governance and change management that your organization might require. Here are some additional best practices:</p>
<ol>
<li>Understand the vendor support implications for changes that you make. For example, directly querying SharePoint databases is not Microsoft supported because the risk involved in damaging it.</li>
<li>Understand data integrity rules before using GenericInvoker method to make direct changes.</li>
<li>Have error handling in place.</li>
<li>When full inserts and updates are needed, consider using the LOB vendor’s own API that provides transactional write-back capabilities from the client to the underlying LOB application. Another way this can be done is using custom actions which will be covered in detail in Part 8.</li>
</ol>
<h4><strong>Conclusion</strong></h4>
<p>BDC Object Model provides a new and exciting solution by allowing direct integration with LOB systems. In this article we have explored the BDC Object Model and exploited the capabilities of the BDC from code. BDC encapsulates the business logic of the back-end systems and developers can just work with the BDC objects to interact with those systems. We’ve demonstrated how to retrieve customer records to populate a SharePoint list that has a BDC data column, and then created a BDC utility class to act as a data layer, finally called the utility class to update the back-end system. With this you can now develop custom applications to interface with SharePoint using the BDC Object Model.  And for organizations that have invested in BDC, you are on your way to leveraging the real power of BDC!</p>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-7-of-8/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Everything You Need to Know about BDC: Part 5 of 8</title>
		<link>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-5-of-8</link>
		<comments>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-5-of-8#comments</comments>
		<pubDate>Tue, 03 Mar 2009 06:00:56 +0000</pubDate>
		<dc:creator>Wen He</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[adf]]></category>
		<category><![CDATA[Application Definition]]></category>
		<category><![CDATA[BDC]]></category>
		<category><![CDATA[Business Data]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Enterprise Search]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[Search Center]]></category>
		<category><![CDATA[User Experience]]></category>

		<guid isPermaLink="false">http://sharepointmagazine.net/?p=2512</guid>
		<description><![CDATA[In this article, we will be focusing on BDC Search. Specifically we’ll be focusing on how to enable BDC Search, how to enable full and incremental crawls of BDC data sources, and how to create a search content source and search scopes. ]]></description>
			<content:encoded><![CDATA[<p><span>Welcome back to Part 5 of our 8 Business Data Catalog (BDC) series. In this article, we will be focusing on BDC Search. </span><span>Specifically we’ll be focusing on how to enable BDC Search, how to enable full and incremental crawls of BDC data sources, and </span><span>how to create a search content source and search scopes. We’ll then walk you through how to make our customer </span><span>data searchable and how to make the search results &#8220;actionable&#8221;.</span></p>
<p><span>If you’ve been following our BDC series, we’ve previously gone through the following topics:</span></p>
<ol>
<li><span><span><span><span><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-1-of-8">Part 1</a></span></span></span>, BDC Technical Architecture</span></li>
<li><span><span><span><span><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-2-of-8">Part 2</a></span></span></span>, Application Definition File (ADF) and its Development</span></li>
<li><span><span><span><span><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-3-of-8">Part 3</a></span></span></span>, Developing an ADF to Connect to Web Services</span></li>
<li><span><span><span><span><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-4-of-8">Part 4</a></span></span></span>, Using BDC Web Parts to Consume BDC Data</span> and Embedding BDC Data in Lists</li>
</ol>
<div><span>Now consider the following scenarios:</span></div>
<ul>
<li>How can I find the customer information for Great Lake Good Market in CRM?</li>
<li>How can I find the projects and resources details in Project Server 2007?</li>
<li>How can I find an employee&#8217;s legal name in HR system?</li>
</ul>
<p>With the help of the BDC Search, these all become possible. The Enterprise Search in MOSS can gather, index, and offer full-text search on all business data (entity instances) from applications registered in the BDC. Not only does it enable us to find answers in MOSS, but also it allows us to do so without having to leave SharePoint to go to these systems individually.  It makes integrating search into existing line of business (LOB) applications like a CRM solution easier.</p>
<p>For example, if we register the <strong>Northwind</strong> sample database in the BDC, Enterprise Search can crawl it and return customer data in search results. In addition, the Enterprise Search feature’s extensibility enables us to create customized search experiences. We can create a custom search tab in the Search Center where our users can search for customers in the database, and we can also create a custom UI for the search results based on which we can also take action.  So let&#8217;s dive right into it.</p>
<h3>BDC Search Overview</h3>
<p>As we&#8217;ve covered in prior articles, surfacing the BDC data to SharePoint using BDC Web Parts and lists is just first part of the BDC saga, it can also enable you to index and search on the BDC data. The following figure is an example of searching for information about a customer and then displaying both structured data from the database and unstructured documents and content stored within SharePoint.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/01/image23.png"><img style="0px" src="http://sharepointmagazine.net/wp-content/uploads/2009/01/image-thumb23.png" border="0" alt="image" width="644" height="370" /></a><br />
<strong>Figure 1:  Enterprise Search with BDC</strong></p>
<p>Here&#8217;s another example of leveraging BDC to index Project Server data and enable us to search the different objects (projects, tasks, resources, custom fields, lookup tables, and so on).  This is of great value because out of the box the Project Server data is not indexed. Only the objects in project workspace are indexed such as Issues, Risks, Documents, etc. For instance, if we are looking for project detail information for the Enterprise resource planning (ERP) project, we can search our Project Server and find the answers as shown in <strong>Figure 2</strong>:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/01/image22.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2009/01/image-thumb22.png" border="0" alt="image" width="644" height="402" /></a><br />
<strong>Figure 2: Search Project Server with BDC</strong></p>
<p>The BDC is truly a catalog of business applications that helps bridge the gap between MOSS and business applications by bringing in key data from various applications to SharePoint sites, lists, searches, and user profiles.  Let&#8217;s revisit the BDC architecture from <span><span><span><span><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-1-of-8">Part 1</a></span></span></span></span> with <strong>both XML</strong> <strong>Metadata</strong> and <strong>Search</strong> components highlighted in <strong>Figure 3</strong>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image87.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb86.png" border="0" alt="image" width="644" height="450" /></a><br />
<strong>Figure 3:  BDC architecture with emphasis on the Search</strong></p>
<p>Firstly, we&#8217;ve highlighted the XML Metadata because it is the key element in the Application Definition that makes the BDC Search possible. BDC operates off of an XML-based Application Definition File (ADF). The metadata in ADF enables MOSS to crawl the BDC data source and add them to the search index.</p>
<p>Secondly, we highlight the Search component because the search engine uses a protocol handler to crawl and a security trimmer to filter results. BDC uses these just like third party implementations when supporting BDC searching.</p>
<p>BDC Search enables us to quickly find content in business data through search queries. It also integrates with search scopes and search center to become an integral part of MOSS Enterprise Search. Here I&#8217;ve created a custom search tab and a search scope for the BDC data to create a unique search experience in which the BDC search results are segregated from the rest of SharePoint search results. See <strong>Figure 4</strong>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image88.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb87.png" border="0" alt="image" width="644" height="454" /></a><br />
<strong>Figure 4: Customized BDC Search Experience in Search Center</strong></p>
<p>By enabling the search of BDC data, BDC Search extends the SharePoint search capabilities. This extends the reach of the back-end LOB systems.  Today most LOB systems don’t have Full-Text search capability and BDC Search can serve for that purpose.</p>
<p>However, out of the box the BDC Search does not support indexing unstructured data like documents in a document management system. This is because the protocol handler for BDC is meant to connect to external structured data only. With custom protocol handlers, it&#8217;s possible to make MOSS index unstructured data . For example, using Web services to directly support BDC we can enable SharePoint to search, list, and retrieve documents from an external document management system via Web services.</p>
<p>Now let&#8217;s look into how to enable BDC Search.</p>
<h3>Enabling BDC Search</h3>
<p>One might think once we import an ADF, we can start to search.  BDC Search doesn&#8217;t come automatically, and we must enable it.  To enable BDC Search, we must first make sure these two methods exist in the ADF for the entity you want to crawl:</p>
<ol>
<li>SpecificFinder</li>
<li>IdEnumerator</li>
</ol>
<p>These are the only required metadata for Enterprise Search to use BDC to index the business application&#8217;s data.</p>
<p>In <span><span><span><span><a href="http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-2-of-8">Part 2</a></span></span></span>,</span> we’ve covered the ADF and its vocabulary: System (data source), Entity (table), Method (operation on entity), and Association (relationship). There are three primary types of methods: Finder, SpecificFinder and IdEnumerator. An IdEnumerator method returns a searchable list of unique IDs for an entity. This list enables indexing of the entities and SpecificFinder is then used to find details for the entity instance based on the specific ID. Therefore, IdEnumerator and SpecificFinder work together to enable Enterprise Search to use BDC to crawl the business data.</p>
<p>Now since we have a good understanding of what it takes, let&#8217;s put it in action. We&#8217;re going to use <a href="http://msdn.microsoft.com/en-us/library/bb736296.aspx"><strong>Business Data Catalog Definition Editor</strong></a>, a free tool from the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=6D94E307-67D9-41AC-B2D6-0074D6286FA9&amp;displaylang=en"><strong>MOSS SDK</strong></a>, to create our ADF (shown in <strong>Figure 5</strong> below). Though one of the limitations of this tool is that it doesn&#8217;t create a <strong>Finder</strong> method, BDC Search doesn&#8217;t need use this anyway, so it works very well for creating an ADF that&#8217;s just used for searching. You can learn how to use this tool <a href="http://msdn.microsoft.com/en-us/library/bb736296.aspx">here</a>.</p>
<p><span><span><span><span><span><span><span><span><span>Incidentally, both <a href="http://www.simego.net/MOSS_BDC_Design_Studio.aspx">MOSS BDC Design Studio</a> and <a href="http://www.lightningtools.com/bdc-meta-man/default.aspx">BDCMetaMan</a> will create these methods necessary to implement BDC searching.</span></span></span></span></span></span></span></span></span></p>
<p>We begin by adding a LOB system for our sample database, a modified version of <strong>Northwind</strong> database. We&#8217;re going to use the <strong>Customers</strong> entity that resembles one in a CRM system (or the like).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image89.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb88.png" border="0" alt="image" width="644" height="380" /></a><br />
<strong>Figure 5: </strong><strong>Create Application Definition</strong></p>
<p>To index and search for Customers entity in the database, we&#8217;re performing the following tasks:</p>
<ol>
<li>Define an IdEnumerator method in the BDC definition (<strong>Figure 6</strong>)</li>
<li>Define a SpecificFinder method in the BDC definition (<strong>Figure 7</strong>)</li>
</ol>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image90.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb89.png" border="0" alt="image" width="644" height="138" /></a><br />
<strong>Figure 6: Define a special type of MethodInstance method IdEnumerator</strong>.</p>
<p>The <strong>IdEnumerator </strong>method returns a list of CustomerID records, which will be indexed by MOSS Search. So now we know that the sole purpose of <strong>IdEnumerator </strong>here is to enable Search.  Here&#8217;s the SQL query:</p>
<div><span style="Courier New;">Select CustomerID from Customers</span></div>
<div><span><br />
</span></div>
<div><span> <a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image91.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb90.png" border="0" alt="image" width="644" height="218" /></a><br />
</span><strong>Figure 7: Define a SpecificFinder</strong></div>
<div>
<p>The <strong>SpecificFinder</strong> method then uses the CustomerID returned from above IdEnumerator method as a parameter (<strong><span class="kwrd">where</span> CustomerID=@CustomerID</strong>) to retrieve the fields for this particular customer. This is how the BDC search is able to search the entire Customers entity. So to make a field searchable, we just include it in the query and return as type <strong>string</strong>.  Here&#8217;s the SQL Query:</p>
<p><span style="x-small;">Select CustomerID,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax<br />
</span><span style="x-small;">from Customers<br />
</span><span style="x-small;">where customerID=@CustomerID</span></p>
<h3>Import Application Definition</h3>
<p>Now we have our required metadata well-defined in the ADF, we are ready to export the XML metadata to an ADF file and then import it to MOSS.  Once we have it imported, we can confirm that our Customers entity implements the two methods in SSP Administration page by viewing application and then entity. The Crawlable property under Entity Information means our Customers entity is available to be crawled, as shown in <strong>Figure 8</strong>.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image92.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb91.png" border="0" alt="image" width="644" height="209" /></a><br />
<strong>Figure 8: View Entity Information in SSP</strong></p>
<p>So far we have started from creating the ADF to importing it to enable searching. Since we can enable searching on any entity that has an IdEnumerator and SpecificFinder defined, we don&#8217;t have to start from scratch to set this up specifically for search.  We can just go straight to configuring the Enterprise Search.</p>
<h3>Configuring the Enterprise Search</h3>
<p>Configuring the Enterprise Search consists of the following steps:</p>
<ol>
<li>Create a content source</li>
<li>Perform a full crawl</li>
<li>Create a search scope (optional)</li>
<li>Add scope rule (optional)</li>
</ol>
<p>We start by creating a content source for our BDC application and performing a full crawl, then optionally create a search scope and scope rule.  These steps are very straight forward so I will focus on the main points. If you&#8217;re interested in each and every detail, check out the <a href="http://sharepointmagazine.net/technical/customisation/customizing-search-series-new-content-and-scope-from-a-bdc-application">Customizing Search Series</a> by Steve Mann.</p>
<p><strong>Step 1: Create a content source (Figure 9)</strong></p>
<p>In order to create a content source, go to SSP Administration page –&gt; Search Settings under Search section, and click on &#8220;Content Sources and Crawl Schedules&#8221;. Click on &#8220;New Content Source&#8221; and give a name for this content source; specify &#8220;Business Data&#8221; as the type of the content to be crawled. Additionally, if we wish to index the content at regular intervals we could create a Crawl schedule that defines our full crawl schedules. Here is how my screen looks:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image93.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb92.png" border="0" alt="image" width="308" height="484" /></a><br />
<strong>Figure 9: Create a content source</strong></p>
<p><strong>Step 2: Perform a full crawl (Figure 10)</strong></p>
<p>In the above step, since I&#8217;ve checked the Start full crawl of this content source, it will initiate a full crawl of the new content source, and we should now see the content source crawling as shown below:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image94.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb93.png" border="0" alt="image" width="563" height="197" /></a><br />
<strong>Figure 10: Perform a full crawl</strong></p>
<p>We can also check the crawl log to make sure that the BDC data has been indexed correctly. At this point, we should be able to search our customers table. If we search for &#8220;great lakes&#8221;, we get search results as shown in <strong>Figure 1 </strong>above.</p>
<p>As we can see, both documents and BDC Search Results are listed together. This demonstrates some of the real power behind Enterprise Search. That is, we’re seeing SharePoint content side by side with external BDC content. This is great especially when we intend to search everything including both documents and BDC sources.</p>
<p>Another real power of Enterprise Search is its extensibility. We can create customized search experiences by creating a custom search tab in the Search Center where our users can search for customers in the database, and we can create a custom UI for the search results. This is what we’re going to do to separate the BDC Search results from other content. We can achieve this by performing the following two additional steps: 1) creating a search scope for BDC and 2) adding a scope rule.</p>
<p><strong>Step 3: Create a search scope (Figure 11)</strong></p>
<p>In order to create a search scope, go to the SSP Administration page, under Search section, click on Search settings. In the &#8220;Scopes&#8221; area, click on &#8220;View Scopes&#8221;.  Click on &#8220;New Scope&#8221;, give it a name.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image95.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb94.png" border="0" alt="image" width="644" height="302" /></a><br />
<strong>Figure 11: Create a search scope</strong></p>
<p><strong>Step 4: Add scope rule </strong></p>
<p>Click on &#8220;Add Rules&#8221; where it says &#8220;Empty &#8211; Add Rules&#8221; on the newly added scope (<strong>Figure 12</strong>).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image96.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb95.png" border="0" alt="image" width="644" height="276" /></a><br />
<strong>Figure 12: Add scope rule</strong></p>
<p>Specify a Content Source as shown below (<strong>Figure 13</strong>):</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image97.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb96.png" border="0" alt="image" width="644" height="233" /></a><br />
<strong>Figure 13: Add scope rule &#8211; specifying a content source</strong></p>
<p>Our BDC Search scope has been created and is now available in the search drop-down as shown in <strong>Figure 14</strong>. If we now search for &#8220;great lakes&#8221;, we get search results back from the existing database as shown in <strong>Figure 4 </strong>above.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image98.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb97.png" border="0" alt="image" width="644" height="137" /></a><br />
<strong>Figure 14: BDC Search scope is available for use</strong></p>
<p>As you have seen, the last two steps, even though optional, do give us additional value.  That is, to segregate the BDC search results from the rest of SharePoint search results so that we can focus on just business data. Thus better search relevance is accomplished through the extensibility!</p>
<h3>BDC Search Access Permission</h3>
<p>It is a good time for us to know how to configure BDC Search access permission so that it will work out-of-the-gate. Often times we forget about it or ignore it, and only when the crawling fails or when the search returns no results, do we go in and dig the logs, even though it is not a bad troubleshooting methodology.</p>
<p>In these examples, we’ve been using &#8220;PassThrough&#8221; authentication in the ADF. That means additional settings have to be configured so that the &#8220;Default Content Access Account&#8221; (the account used to crawl) has access to the database. Also the “Default Content Access Account” must have appropriate rights to the BDC application and entity.</p>
<p>We’ll achieve that in the following steps:</p>
<ol>
<li>Create a new Active Directory account for BDC search. We’ll call ours MOSS.Search.</li>
<li>Change the default content access account to that account in search settings (<strong>Figure 15</strong>).</li>
<li>Change search crawler account to that account under Operations –&gt; Services –&gt; Office SharePoint Server Search.</li>
<li>Grant this account db_datareader access to the database in SQL Server.</li>
<li>Grant this account Execute, Selectable in clients in Manage permissions for the ADF (<strong>Figure 16</strong>).</li>
</ol>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image100.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb99.png" border="0" alt="image" width="644" height="344" /></a><br />
<strong>Figure 15:  Specify the Default Content Access Account</strong></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image101.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb100.png" border="0" alt="image" width="644" height="208" /></a><br />
<strong>Figure 16:  Grant Execute, Selectable permissions</strong></p>
<p><strong>Note:</strong> there might be a delay of a few minutes after the permission is changed on BDC application. You may delete and re-import the BDC application definition at when needed &#8212; no need to re-crawl as long as the BDC name is not changed.</p>
<h3>Enabling Incremental Crawling</h3>
<p>Next, we’re going to show you how create an enhancement to our ADF to support incremental crawling through the use of the __BdcLastModifiedTimestamp entity property.</p>
<p>To optimize search performance, it’s important to have incremental crawl. As you may know, Incremental Crawl is a process of crawling only new or changed content from the previous full or incremental crawl. This means that we have to let BDC know what has changed since its last crawl.</p>
<p>To ensure that incremental crawls can be performed in the database when indexing, we’ll need to enhance the IdEnumerator method that has a return field that represents the last update time for that particular row. The Type attribute of the __BdcLastModifiedTimestamp property must be System.String and its value must be set to the value of the Name attribute of the TypeDescriptor for the field returned by the IDEnumerator method that contains the last modified date and time of the entity instance. This is illustrated below.</p>
<p>In our Customers table, we start by adding a column called LastUpdated of data type DateTime to indicate the last modified time of a single row. SharePoint indexing service will use that as a time stamp and incremental crawling is enabled. SQL-knowledgeable people should not confuse this with a timestamp data type. The example we are walking through is specific to SQL Server, but the concept will apply to other databases or Web Service methods.</p>
<p>Here are the specific steps to enable incremental crawling:</p>
<ol>
<li>Update the database table to add a LastUpdated column of datetime data type (<strong>Figure 16</strong>).</li>
<li>Ensure the value of LastUpdated column is set to the current date and time when the row changes. (This can be accomplished with an Update trigger.)</li>
<li>Update ADF to have the __BdcLastModifiedTimestamp property of the entity set to LastUpdated (<strong>Figure 17).</strong></li>
<li>Update ADF to have IdEnumerator mothod return LastUpdated field (<strong>Figure 18</strong>).</li>
<li>Update ADF to have a TypeDescriptor with its TypeName attribute set to System.DateTime (<strong>Figure 19</strong>).</li>
</ol>
<p>The following figures are the screens for performing the above tasks:</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/01/image.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2009/01/image-thumb.png" border="0" alt="image" width="228" height="244" /></a><br />
<strong>Figure 16: Create a LastUpdated column of datetime type in SQL Server</strong></p>
<p><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image102.png" alt="" /><br />
<strong>Figure 17: Add the __BdcLastModifiedTimestamp property</strong></p>
<p><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image103.png" alt="" /><br />
<strong>Figure 18: Have IdEnumerator method return LastUpdated field</strong></p>
<p><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image104.png" alt="" /><br />
<strong>Figure 19: Add a TypeDescriptor with its TypeName attribute set to System.DateTime</strong></p>
<p>To compare the performance, I then performed an incremental crawl.  This is shown in <strong>Figure 20</strong> below.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image105.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb104.png" border="0" alt="image" width="644" height="249" /></a><br />
<strong>Figure 20: Comparison between the incremental crawling and the full crawling.</strong></p>
<p>In our sample, it took significantly less time in the incremental crawling than the full crawl (35 seconds vs. 54 seconds).  Depending on the size of the database and the number of changes that need to be processed with each crawl, the difference in crawl times will vary. The key of enabling incremental crawl here is performance so that the back-end systems are not unnecessarily burdened by the crawling.</p>
<h3>Actions</h3>
<p>Lastly, let’s show you how we can make our BDC search results &#8220;actionable&#8221; by creating a custom action on the Customers entity. There are two ways to create a custom action. It can be defined either in the ADF or added after the ADF is imported by going to SSP administration page (View Application –&gt; View Entity).</p>
<p>By default through the <strong>SpecificFinder</strong> method, we get a default view Profile action that links to a simple page with your search results. This is where the customization comes in, and you could create custom Web Parts to provide more user-friendly and richer user experience. We’ll dedicate Part 8 of this series to Custom Actions so you have the best for last. For this article, let&#8217;s quickly create a custom action to map the customer using Live Search Maps (maps.Live.com).</p>
<p>Here are the specific steps to enable custom action with Live Search Maps:</p>
<ol>
<li>Add Action and set parameters (<strong>Figure 21)</strong></li>
<li>Check action<strong> (Figure 22</strong>)</li>
</ol>
<p>Go to SSP administration page (View Application –&gt; View Entity), add action and configure URL parameters.</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image106.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb105.png" border="0" alt="image" width="518" height="484" /></a><br />
<strong>Figure 21:  Create a custom action in SSP</strong></p>
<p>The parameter &#8220;Address&#8221; will be substituted at index &#8220;0&#8243;, which is specified as a querystring URL to maps.live.com. If you have already deployed your ADF before creating a custom action, you will need to redeploy it if you use this approach to adding a custom action.</p>
<p>Check the custom action to ensure it&#8217;s configured and ready for use <strong>(Figure 22</strong>).</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image107.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb106.png" border="0" alt="image" width="644" height="125" /></a><br />
<strong>Figure 22: Live Map Action appears under Actions</strong></p>
<p>Now let&#8217;s test-drive our search and custom action in the following two steps:</p>
<ol>
<li>Search any customer in the Search Center (<strong>Figure 23</strong>)</li>
<li>Perform the custom action based on the search result (<strong>Figure 24</strong>)</li>
</ol>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2009/01/image2.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2009/01/image-thumb2.png" border="0" alt="image" width="644" height="217" /></a><br />
<strong>Figure 23: Search result of a customer entity</strong></p>
<p>Clicking on &#8220;The Big Cheese<strong>&#8220;</strong> will take us to the default profile page, where we can see and act upon the custom action <strong>Live Map (maps.live.com)</strong> as shown below. Clicking on <strong>Live Map</strong> will issue a search on maps.live.com using the address of &#8220;The Big Cheese&#8221;. Here&#8217;s the live map (<strong>Figure 26</strong>). Neat!</p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image108.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb107.png" border="0" alt="image" width="240" height="322" /></a><br />
<strong>Figure 24: BDC Search Results with Live Map action available</strong></p>
<p><a href="http://sharepointmagazine.net/wp-content/uploads/2008/12/image109.png"><img src="http://sharepointmagazine.net/wp-content/uploads/2008/12/image-thumb108.png" border="0" alt="image" width="644" height="439" /></a><br />
<strong>Figure 25:  Live Map of the searched customer</strong></p>
<h3>Conclusion</h3>
<p><span style="x-small;">In this article we have covered the concepts behind BDC search and how to enable it. We&#8217;ve then walked you through how to make our Customer data searchable, and how to make a custom action on search results. In doing so, we&#8217;ve demonstrated the power behind BDC and MOSS Enterprise Search. Even though we have only used a database in our example, this is also all possible with Web Services, provided the SpecificFinder and IdEnumerator methods are still in place. Hope you have enjoyed reading it as much as I have enjoyed writing it. Look forward to your comments and suggestions.  Aloha!</span></div>
]]></content:encoded>
			<wfw:commentRss>http://sharepointmagazine.net/technical/administration/everything-you-need-to-know-about-bdc-part-5-of-8/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
