<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>My Blogs</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/anweshi/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/anweshi/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:39:49 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Creating a Web Part with Client-side Scripts</title>
      <link>https://docs.microsoft.com/archive/blogs/anweshi/creating-a-web-part-with-client-side-scripts</link>
      <pubDate>Tue, 29 Mar 2011 17:51:15 GMT</pubDate>
      <dc:creator><![CDATA[Anweshi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anweshi/2011/03/29/creating-a-web-part-with-client-side-scripts/</guid>
      <description><![CDATA[&nbsp;

Check out my latest blog post on SharepointDev site on &ldquo;Creating a webpart with Client...]]></description>
      <content:encoded><![CDATA[&nbsp;

Check out my latest blog post on SharepointDev site on &ldquo;Creating a webpart with Client Side Scirpts)

<p><a title="http://blogs.msdn.com/b/sharepointdev/archive/2011/02/15/creating-a-web-part-with-client-side-script.aspx" href="http://blogs.msdn.com/b/sharepointdev/archive/2011/02/15/creating-a-web-part-with-client-side-script.aspx">http://blogs.msdn.com/b/sharepointdev/archive/2011/02/15/creating-a-web-part-with-client-side-script.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>“Calling a WCF Service using jQuery in SharePoint” on SharepointDev Blog site</title>
      <link>https://docs.microsoft.com/archive/blogs/anweshi/calling-a-wcf-service-using-jquery-in-sharepoint-on-sharepointdev-blog-site</link>
      <pubDate>Tue, 29 Mar 2011 17:48:33 GMT</pubDate>
      <dc:creator><![CDATA[Anweshi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anweshi/2011/03/29/calling-a-wcf-service-using-jquery-in-sharepoint-on-sharepointdev-blog-site/</guid>
      <description><![CDATA[&nbsp;

Check out my article about&ldquo;Calling a WCF Service using JQuery in Sharepoint&rdquo;...]]></description>
      <content:encoded><![CDATA[&nbsp;

Check out my article about&ldquo;Calling a WCF Service using JQuery in Sharepoint&rdquo; SharepointDev blog site. I have initially blogged in on my blogpost, now its up on SharepointDev Site. 

Link to my blog <a title="http://blogs.msdn.com/b/anweshi/archive/2010/11/30/calling-wcf-service-using-jquery-in-sharepoint-applications.aspx" href="http://blogs.msdn.com/b/anweshi/archive/2010/11/30/calling-wcf-service-using-jquery-in-sharepoint-applications.aspx">http://blogs.msdn.com/b/anweshi/archive/2010/11/30/calling-wcf-service-using-jquery-in-sharepoint-applications.aspx</a>&nbsp;

<p>Link to my blog on SharepointDev <a title="http://blogs.msdn.com/b/sharepointdev/archive/2011/02/22/calling-a-wcf-service-using-jquery-in-sharepoint.aspx" href="http://blogs.msdn.com/b/sharepointdev/archive/2011/02/22/calling-a-wcf-service-using-jquery-in-sharepoint.aspx">http://blogs.msdn.com/b/sharepointdev/archive/2011/02/22/calling-a-wcf-service-using-jquery-in-sharepoint.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>RAD using InfoPath and BCS, and Overcoming performance limitations using SPs and Filters</title>
      <link>https://docs.microsoft.com/archive/blogs/anweshi/rad-using-infopath-and-bcs-and-overcoming-performance-limitations-using-sps-and-filters</link>
      <pubDate>Thu, 24 Feb 2011 20:32:19 GMT</pubDate>
      <dc:creator><![CDATA[Anweshi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anweshi/2011/02/24/rad-using-infopath-and-bcs-and-overcoming-performance-limitations-using-sps-and-filters/</guid>
      <description><![CDATA[&nbsp;

Contributors : Anweshi Deverasetty, Ashutosh Mahamia

Background 

In our current Sharepoint...]]></description>
      <content:encoded><![CDATA[&nbsp;

<h3><strong>Contributors</strong> : Anweshi Deverasetty, Ashutosh Mahamia</h3>

<h3><strong>Background </strong></h3>

In our current Sharepoint project, we had a requirement to create a user interface for performing CRUD operations on Master detailed tables. We had to generate forms for Create/Edit/Delete/View operations on Master and Detailed tables. We came up with an approach to generate all these forms OOB with less C# code. So we started with BCS ( Business Connectivity Services). 

<h3><strong>Contents</strong></h3>

<ol>   <li>Introduction.      <ol>       <li>The Challenge </li>        <li>The Solution. </li>     </ol>   </li>    <li>BCS Entities: The Business cum Data Access Layer      <ol>       <li>Create CRUD operations on Entities using Stored Procedures. </li>        <li>Creating Associations. </li>        <li>Performance Check on BDC Model </li>        <li>Importing BDC Model </li>        <li>Creating The External Lists. </li>     </ol>   </li>    <li>SharePoint InfoPath: For Application Presentation Layer      <ol>       <li>Generating InfoPath for External Lists. </li>        <li>Enabling Search/Filters on External Content Types. </li>     </ol>   </li>    <li>The Application: A SharePoint site / Site collection      <ol>       <li>Creating a Site for Application. </li>        <li>Creating An Application Page </li>     </ol>   </li> </ol>

<b></b>

<h3><strong>Introduction</strong></h3>

There is growing demand and expectation as well in the field to be able to leverage the new features in SharePoint 2010 to create database driven simple SharePoint solutions which do not involve lot of customization, business rules and validations. This article will help you to understand how BCS and InfoPath, together can supplement this requirement and facilitate database CRUD operations based simple applications with decent User Interface. 

<h4><a name="_Toc285830109">The Challenge</a></h4>

One of the key challenges in this approach is Performance. If the number of records maintained by the application outgrow to what the entities can handle, then it reflects upon a poor user experience. The pages rendering slow, the data searches taking significant time, and other related issues would need an adequate mitigation. So to encounter this challenge, we start with exploring BCS capabilities, then onto SharePoint InfoPath and lastly turning to the programmable objects in the database.

<h4><a name="_Toc285830110">The Solution</a></h4>

First, we take a decision to generate BCS Entities which will use Stored Procedures (SP). As an alert designer or developer one can easily visualize the high level benefits of using the SP to support the BCS (which in turn is our Data Access Layer for the application in question). With this we have the flexibility of using parameters, governing the resultant data expected, applying set of business rules within the SPs, and the tuning of queries can give enormous performance boost. 

Secondly, designing and developing rich InfoPath based UI forms, completely out-of-the-box. We harvest a rich UI, New/Edit/View/List forms, with absolutely <b><i>zero</i></b> lines of code. Besides the regular CRUD operation support, we will also learn how to create Associations, Filters, and generating these InfoPath forms in the document forward.

<b></b>

<b></b>

<h2><a name="_Toc285830111">BCS Entities: The Business cum Data Access Layer</a></h2>

Let&rsquo;s go step by step and see how we can create this as an end to end solution.

Here is a snapshot of the Database Diagram that we are going to use in our solution. We are going to use Department, Employee and Job tables.

<h4><a name="_Toc285830112">Create CRUD operations on Entities using Stored Procedures</a></h4>

Create the following Stored procedures on Department table for all the CRUD operations. 

   

<table border="1" cellspacing="0" cellpadding="0" width="537"><tbody>       <tr>         <td valign="top" width="243">           <b>Stored Procedure Name</b></p>         </td>          <td valign="top" width="157">           <p><b>Parameters</b></p>         </td>          <td valign="top" width="135">           <p><b>Return parameters</b></p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>InsertDepartment</p>         </td>          <td valign="top" width="157">           <p>@Deptname</p>            <p>@Location</p>            <p>@User</p>         </td>          <td valign="top" width="135">           <p>Deptno</p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>UpdateDepartment</p>         </td>          <td valign="top" width="157">           <p>@Deptno</p>            <p>@Deptname</p>            <p>@Location</p>            <p>@User</p>         </td>          <td valign="top" width="135">&nbsp;</td>       </tr>        <tr>         <td valign="top" width="243">           <p>DeleteDepartment</p>         </td>          <td valign="top" width="157">           <p>@Deptno</p>         </td>          <td valign="top" width="135">&nbsp;</td>       </tr>        <tr>         <td valign="top" width="243">           <p>GetDepartment</p>         </td>          <td valign="top" width="157">           <p>@Deptno</p>         </td>          <td valign="top" width="135">           <p>Deptno</p>            <p>Deptname</p>            <p>Location</p>            <p>User</p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>GetAlDepartments</p>         </td>          <td valign="top" width="157">&nbsp;</td>          <td valign="top" width="135">           <p>Deptno</p>            <p>Deptname</p>            <p>Location</p>            <p>User</p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>InsertEmployee</p>         </td>          <td valign="top" width="157">           <p>@Empname</p>            <p>@Jobno</p>            <p>@Deptno</p>            <p>@User</p>         </td>          <td valign="top" width="135">           <p>Empno</p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>UpdateEmployee</p>         </td>          <td valign="top" width="157">           <p>@Empno</p>            <p>@Empname</p>            <p>@Jobno</p>            <p>@Deptno</p>            <p>@User</p>         </td>          <td valign="top" width="135">&nbsp;</td>       </tr>        <tr>         <td valign="top" width="243">           <p>DeleteEmployee</p>         </td>          <td valign="top" width="157">           <p>@Empno</p>         </td>          <td valign="top" width="135">&nbsp;</td>       </tr>        <tr>         <td valign="top" width="243">           <p>GetEmployee</p>         </td>          <td valign="top" width="157">           <p>@Empno</p>         </td>          <td valign="top" width="135">           <p>Empno</p>            <p>Empname</p>            <p>Jobno</p>            <p>Deptno</p>            <p>User</p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>GetAllEmployees</p>         </td>          <td valign="top" width="157">&nbsp;</td>          <td valign="top" width="135">           <p>Empno</p>            <p>Empname</p>            <p>Jobno</p>            <p>Deptno</p>            <p>User</p>         </td>       </tr>     </tbody></table>

<p><u></u>

<h5><b>Create Entity for Department table </b></h5>

Create an Entity for <i>Department</i> on which we are going to create all the CRUD operations. Also specify the Primary Key/Identity Column as given in the below snippet.     

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Entity Namespace="DepartmentDB" Version="1.0.0.0" EstimatedInstanceCount="10000" Name="Department" DefaultDisplayName=" Department "&gt;</p>            <p>&lt;Identifiers&gt;</p>            <p>&lt;Identifier TypeName="System.Int32" Name="Deptno" /&gt;</p>            <p>&lt;/Identifiers&gt;</p>            <p>. . . . . </p>            <p>&lt;/Entity&gt;</p>         </td>       </tr>     </tbody></table>

<p><b></b>

<h5><b>Generate CRUD operations on Department using Stored Procedures</b></h5>

You might have often used SharePoint Designer to easily generate CRUD operations on a table. But when it comes to using Stored Procedures, it&rsquo;s not often easy. SharePoint Designer might not help in this case. We will have to create operations manually. Let us see how to generate CRUD operations using Stored Procedures. Create an element Methods in the Entity Element and start adding all the operations. 

Let&rsquo;s start creating the following operations on the Department Entity. 

1. Create

2. Update 

3. Read Item

4. Read List

If you are using SharePoint Designer to generate operations on a Table then the BackEndObjectType is set to Table automatically. But our plan is to generate CRUD operations using Stored Procedure. The following table shows you what needs to be set for a Table and Stored Procedure 

   

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="228">           <b>Property Name</b></p>         </td>          <td valign="top" width="217">           <p><b>For Stored Procedure</b></p>         </td>          <td valign="top" width="194">           <p><b>For Table</b></p>         </td>       </tr>        <tr>         <td valign="top" width="228">           <p>BackEndObject</p>         </td>          <td valign="top" width="217">           <p>Name of the Stored Procedure </p>         </td>          <td valign="top" width="194">           <p>Name of the Table</p>         </td>       </tr>        <tr>         <td valign="top" width="228">           <p>BackEndObjectType</p>         </td>          <td valign="top" width="217">           <p>SqlServerRoutine</p>         </td>          <td valign="top" width="194">           <p>SqlServerTable</p>         </td>       </tr>        <tr>         <td valign="top" width="228">           <p>RdbCommandText</p>         </td>          <td valign="top" width="217">           <p>Name of the Stored Procedure</p>         </td>          <td valign="top" width="194">           <p>Insert the SQL Statement. </p>         </td>       </tr>        <tr>         <td valign="top" width="228">           <p>RdbCommandType</p>         </td>          <td valign="top" width="217">           <p>StoredProcedure</p>         </td>          <td valign="top" width="194">           <p>Text</p>         </td>       </tr>        <tr>         <td valign="top" width="228">           <p>Schema</p>         </td>          <td valign="top" width="217">           <p>Name of the Schema</p>         </td>          <td valign="top" width="194">           <p>Name of the Schema</p>         </td>       </tr>     </tbody></table>

<p><i>For example ,</i>

See the below XML snippet for a stored procedure. For every operation the following properties need to be set if you are calling a stored procedure. 

   

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;[StoredProcedureName]&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;NameoftheStoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, </p>            <p>Culture=neutral, </p>            <p>PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;[SchemaName]&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>         </td>       </tr>     </tbody></table>

<p>Before generating all the operations, you need to note few things 

<b><i>1. </i></b><b><i>All CRUD operations should return and pass same set of parameters , else New/Edit/View will not get generated.</i></b> This indicates, the set of parameters that you return from ReadItem and ReadList should be the same and also the parameters that you pass to Create and Update should also be the same. In case you have a parameter in ReadItem and you do not return it in ReadList and do not pass that parameter in Create or Delete then the forms do not get generated.

<b><i>2. </i></b><b>Parameters are case sensitive. </b>Make sure the parameter names are same and they are case sensitive. Forms will not get generated if the names are different or case sensitive. You might receive the following error if the parameters are case sensitive<b></b>

<i></i>

<i>Could not save changes. No Finders available in the View Group associated with the SpecificFinder (Read Item) operation &lsquo;ReadItem&rsquo; on Entity (External Content Type) with Namespace = &lsquo;XXXXX&rsquo;, Name =&rsquo;XXXX&rsquo;. The list cannot be created</i>

<b></b>

<b><i>3. </i></b><b>SPs should be created before creating the External lists. </b>Though you created CRUD operations on Entities, if you do not have corresponding Stores procedures, then the forms do not get generated.<b></b>

<b></b>

<h5><b>Create Item Operation</b></h5>

Write the Create method with all the input parameters required to be passed to InsertDepartment Stored Procedure.    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method Name="Create" DefaultDisplayName="Department Create"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;InsertDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;InsertDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptname" &gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" CreatorField="true" Name="DeptName" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Location" &gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" CreatorField="true" Name="Location" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt; </p>            <p>&lt;Parameter Direction="In" Name="@User"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" CreatorField="true" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="Return" Name="Create"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Create"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="CreateElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Creator" ReturnParameterName="Create" ReturnTypeDescriptorPath="Create[0]" Default="true" Name="Create" DefaultDisplayName="Department Create"&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<h5><b>Update Item Operation</b></h5>

<p>Write the Update method by passing the Department Id with all the input parameters the need to be modified into the UpdateDepartment Stored Procedure.    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method Name="Update" DefaultDisplayName="Department Update"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;UdpateDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;UdpateDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" UpdaterField="true" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptname"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" UpdaterField="true" Name="Deptname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Location"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" UpdaterField="true" Name="Location"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Updater" Name="Update" DefaultDisplayName="Employee Update"&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<h5><b>Delete Item Operation</b></h5>

<p>Write the Delete method by passing the DepartmentId that you want to delete into the DeleteDepartment Stored Procedure.    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method Name="Delete" DefaultDisplayName="Department Delete"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;DeleteDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;DeleteDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Deleter" Name="Delete" DefaultDisplayName="Department Delete"&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<h5><b>Read Item Operation</b></h5>

<p>Write a Read Item method which returns the Department values for the specified Department Id using the GetDepartment Stored Procedure    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method Name="Read Item" DefaultDisplayName="Department Read Item"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;GetDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;GetDepartment&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="Return" Name="Read Item"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Read Item"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Read ItemElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Deptname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Location"&gt;</p>            <p>&lt;/TypeDescriptor&gt; </p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="SpecificFinder" ReturnParameterName="Read Item" ReturnTypeDescriptorPath="Read Item[0]" Default="true" Name="Read Item" DefaultDisplayName="Department Read Item"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="LastDesignedOfficeItemType" Type="System.String"&gt;None&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<h5><b>Read List Operation</b></h5>

<p>Write the Read List method which would return all the Departments by calling GetAllDepartments Stored Procedure.    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method Name="Read List" DefaultDisplayName="Department Read List"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;GetAllDepartments&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;GetAllDepartments&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="Return" Name="Read List"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Read List"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Read ListElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Deptname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Location"&gt;</p>            <p>&lt;/TypeDescriptor&gt; </p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Finder" ReturnParameterName="Read List" Default="true" Name="Read List" DefaultDisplayName="Department Read List"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="RootFinder" Type="System.String"&gt;&lt;/Property&gt;</p>            <p>&lt;Property Name="UseClientCachingForSearch" Type="System.String"&gt;&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<p><b>     <br></b>

<b></b>

<h5><b>Create Entity for Employee table </b></h5>

Now, create an Entity for Employee table with all the CRUD Operations.

Here is the XML snippet for the Employee entity with all the CRUD Operations    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Entity Namespace="EmployeeDB" Version="1.0.0.0" EstimatedInstanceCount="10000" Name="Employee" DefaultDisplayName="Employee"&gt;</p>            <p>&lt;Identifiers&gt;</p>            <p>&lt;Identifier TypeName="System.Int32" Name="Empno" /&gt;</p>            <p>&lt;/Identifiers&gt;</p>            <p>&lt;Methods&gt;</p>            <p>&lt;Method Name="Create" DefaultDisplayName="Employee Create"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;InsertEmployee&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;InsertEmployee&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Empname" &gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" CreatorField="true" Name="Empname" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Jobno" &gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" CreatorField="true" Name="Jobno" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptno" &gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" CreatorField="true" Name="Deptno" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@User"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" CreatorField="true" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="Return" Name="Create"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Create"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="CreateElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Empno" Name="Empno" /&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Creator" ReturnParameterName="Create" ReturnTypeDescriptorPath="Create[0]" Default="true" Name="Create" DefaultDisplayName="Employee Create"&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>            <p>&lt;Method Name="Update" DefaultDisplayName="Employee Update"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;UdpateEmployee&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;UdpateEmployee&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Empno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" UpdaterField="true" IdentifierName="Empno" Name="Empno" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Empname"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" UpdaterField="true" Name="Empname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Jobno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" UpdaterField="true" Name="Jobno"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" UpdaterField="true" Name="Deptno"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="In" Name="@User"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" UpdaterField="true" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt; </p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Updater" Name="Update" DefaultDisplayName="Employee Update"&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>            <p>&lt;Method Name="Delete" DefaultDisplayName="Employee Delete"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;DeleteEmployee&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;DeleteEmployee&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Empno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" IdentifierName="Empno" Name="Empno" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Deleter" Name="Delete" DefaultDisplayName="Employee Delete"&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>            <p>&lt;Method Name="Read List" DefaultDisplayName="Employee Read List"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;GetAllEmployees&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;GetAllEmployees&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="Return" Name="Read List"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Read List"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Read ListElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Empno" Name="Empno" /&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Empname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Jobno"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Deptno"&gt; </p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="User"&gt; </p>            <p>&lt;/TypeDescriptor&gt; </p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Finder" ReturnParameterName="Read List" Default="true" Name="Read List" DefaultDisplayName="Employee Read List"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="RootFinder" Type="System.String"&gt;&lt;/Property&gt;</p>            <p>&lt;Property Name="UseClientCachingForSearch" Type="System.String"&gt;&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>            <p>&lt;Method Name="Read Item" DefaultDisplayName="Employee Read Item"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;[dbo].[GetEmployee]&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;[dbo].[GetEmployee]&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Empno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" IdentifierName="Empno" Name="Empno" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="Return" Name="Read Item"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Read Item"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Read ItemElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Empno" Name="Empno" /&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Empname"&gt; </p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Jobno"&gt; </p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Deptno"&gt; </p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="SpecificFinder" ReturnParameterName="Read Item" ReturnTypeDescriptorPath="Read Item[0]" Default="true" Name="Read Item" DefaultDisplayName="Employee Read Item"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="LastDesignedOfficeItemType" Type="System.String"&gt;None&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>            <p>&lt;/Methods&gt;</p>            <p>&lt;/Entity&gt;</p>         </td>       </tr>     </tbody></table>

<h4><a name="_Toc285830113">Creating Associations</a></h4>

<p>Let us create an association on Employee table. When you generate the New/Edit forms on the Employee Entity you will see that the Deptno just displays a textbox. And the user needs to enter the Dept ID as shown in the figure below ( we are going to generate the forms later in this section) .

In the above screen, it would have been good if there was an option to select the Departments available. To achieve this your need to create Association. Let us see, how the edit form would look like. Btw, later we are going to generate Infopath forms.

Let us see how to create an Association. Association has to be created on the master table ie., Department Entity.

<b>Step 1: Create a Stored Procedure</b> which would return the Employee details specific to a Department. Make sure it returns same set of parameters as the other CRUD operations return/Pass, else as specified earlier, the forms might not get generated. 

   

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="243">           <b>Stored Procedure Name</b></p>         </td>          <td valign="top" width="168">           <p><b>Parameters</b></p>         </td>          <td valign="top" width="143">           <p><b>Return parameters</b></p>         </td>       </tr>        <tr>         <td valign="top" width="243">           <p>DepartmentEmployeeAssociation</p>         </td>          <td valign="top" width="168">           <p>@Deptno </p>         </td>          <td valign="top" width="143">           <p>Empno</p>            <p>Empname</p>            <p>JobNo</p>            <p>DeptNo</p>            <p>User</p>         </td>       </tr>     </tbody></table>

<p><b>Step 2: Create Association on the Employee Entity. </b>Create an association method by calling the above defined Stored Procedure. 

   

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method IsStatic="false" Name="DepartmentEmployee Association" DefaultDisplayName="DepartmentEmployee Association"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;DepartmentEmployeeAssociation&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;DepartmentEmployeeAssociation&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptno"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Deptno" IdentifierName="Deptno" IdentifierEntityName="Department" IdentifierEntityNamespace="DepartmentDB" ForeignIdentifierAssociationName="DepartmentEmployee Association" /&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;Parameter Direction="Return" Name="DepartmentEmployee Association"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="DepartmentEmployee Association"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="DepartmentEmployee Association"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" Name="Empno"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Empname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Jobno"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" Name="Deptno" IdentifierName="Deptno" IdentifierEntityName="Department" IdentifierEntityNamespace="DepartmentDB" ForeignIdentifierAssociationName="DepartmentEmployee Association" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;Association Name="DepartmentEmployee Association" Type="AssociationNavigator" ReturnParameterName="DepartmentEmployee Association" DefaultDisplayName="DepartmentEmployee Association"&gt;</p>            <p>&lt;SourceEntity Namespace="DepartmentDB" Name="Department" /&gt;</p>            <p>&lt;DestinationEntity Namespace="EmployeeDB" Name="Employee" /&gt;</p>            <p>&lt;/Association&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<p><b></b>

<b>Step 3: Create Association Group on Employee.</b> Create the AssociationGroup elemen under Entity element. 

   

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;AssociationGroups&gt;</p>            <p>&lt;AssociationGroup Name="DepartmentEmployee Association"&gt;</p>            <p>&lt;AssociationReference AssociationName="DepartmentEmployee Association" Reverse="false" EntityNamespace="EmployeeDB" EntityName="Employee" /&gt;</p>            <p>&lt;/AssociationGroup&gt;</p>            <p>&lt;/AssociationGroups&gt;</p>         </td>       </tr>     </tbody></table>

<p><b></b>

<b>Step 4: Apply the association to the Deptno parameter in the Employee entity in all the operations. </b>Make sure this association is applied to all the methods, else you might have issue with the generation of the forms. You can see that, the similar association is done for Deptno parameter while defining association as well in the above XML association snippet. Here is a sample of Create Operation on Employee Entity where we are applying association on Deptno column. This should be done for all the operations ie., Create/Udpate/ReadItem/ReadList, in other words where ever Deptno is being referred.     

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Parameter Direction="In" Name="@Deptno" &gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" CreatorField="true" Name="Deptno" IdentifierName="Deptno" IdentifierEntityName="Department" IdentifierEntityNamespace="DepartmentDB" ForeignIdentifierAssociationName="DepartmentEmployee Association" &gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>         </td>       </tr>     </tbody></table>

<p><b></b>

Now, the association is ready. Try to add / edit an item on the Employee External List and see that the Picker control is available. Here is the screenshot.

On the click on Show Picker control , you will be able to see the list of Departments from where you can make selection.

You can create a similar association on Jobno as well. You need to create an Entity for Job with ReadItem and ReadList operations and create an association on Department.

Associations can be used to create connections on BDC Webparts and also to display the Picker controls.

<h4><a name="_Toc285830114">Performance Check on BDC Model</a></h4>

Ensure that your BDC Model has undergone the following changes

1) All operations are Stored Procedure based

2) All read list operations must have parameters

3) Stored procedures are internally configured to return a max number of records

4) Or, All read list operation must have filters set on maximum rows to return

5) If you don&rsquo;t have the filter ON on read-list, then during BDC Model import warnings will be generated.

<a name="_Toc285830115">2.3 Importing BDC Model</a>

Now, it is time to import the BDC Model. Open Central Admin, add select from &ldquo;Manage Service Applications&rdquo; under &rdquo;Application Management&rdquo; . Select &ldquo;Business Data Connectivity Services&rdquo; that you configured .Click on Import and Import the BDC Model that you created just now. 

Ensure that 

&middot; You have Secure Store Service turn on 

&middot; you have set the database name correctly in the &ldquo;External System&rdquo; for your imported model

&middot; The model is using SSO

<h4>C<a name="_Toc285830116">reating The External Lists</a></h4>

After importing the BDC Model, let us create External Lists for Department and Employee entities. To create an External List, from Site Actions select View All Site Content and select Create &ldquo;Custom List&rdquo;. Select &ldquo;External List&rdquo;. 

Select the External Content Type as &ldquo;Department&rdquo;. 

Here is the screenshot of how the Department External List would look like.

Similarly, create &ldquo;Employee&rdquo; External List. 

Here is the screenshot of Employee External List.

<b>     <br></b>

<b></b>

<h3>S<a name="_Toc285830117">harePoint InfoPath: For Application Presentation Layer</a></h3>

Observe that in all the operations ie., New/Edit and View forms are automatically generated. Here is the screen shot of how the forms would look like for an Employee External List.

<b>New Item</b>

<b></b>

<b>Edit Item</b>

<b></b>

<b>View Item</b>

<b></b>

<b>     <br></b>

<b></b>

<h4><a name="_Toc285830118">Generating InfoPath for External Lists</a></h4>

<b><u></u></b>

You can observe that all the forms generated look like the normal out of box forms of a custom list. But it is difficult to customize these forms. InfoPath is one of the solutions to customize. Here we will see how InfoPath forms can be generated. 

Open SharePoint Designer and open the Department External list that you&rsquo;ve created. You can see that all the 3 forms are listed in the External list under Forms.

To generate InfoPath forms for all these 3 operations, from &ldquo;List Settings&rdquo; ribbon menu under &ldquo;Design forms in InfoPath Designer&rdquo; select &ldquo;Item&rdquo;.

This option generates all the 3 InfoPath forms and then opens up the InfoPath designer. You can observe that 3 extra infopath forms displayifs.aspx, editifs.aspx and newifs.aspx would be created and they would be marked as default forms. 

Here you can customize the whole form. Here is the screen shot of the InfoPath designer.

<b><u></u></b>

<h4><a name="_Toc285830119">Enabling Search/Filters on External Content Types</a></h4>

<b><u></u></b>

Let us try to search in the Show Picker Dialog box. When you perform a search, this is what you see

This is because filters are not enabled on the External Content Type Read List method. Let us know what needs to be changed for this.

Step 1: Change the stored procedure GetAllEmployees to accept Deptname as a parameter and write the query accordingly. 

Step 2: Update the ReadList with the Filter Descriptor as shown below    

<table border="1" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="707">           &lt;Method Name="Read List" DefaultDisplayName="Department Read List"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="BackEndObject" Type="System.String"&gt;GetAllDepartments&lt;/Property&gt;</p>            <p>&lt;Property Name="BackEndObjectType" Type="System.String"&gt;SqlServerRoutine&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandText" Type="System.String"&gt;GetAllDepartments&lt;/Property&gt;</p>            <p>&lt;Property Name="RdbCommandType" Type="System.Data.CommandType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;StoredProcedure&lt;/Property&gt;</p>            <p>&lt;Property Name="Schema" Type="System.String"&gt;dbo&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;FilterDescriptors&gt;</p>            <p>&lt;FilterDescriptor Type="Wildcard" FilterField="Deptname" Name="Filter"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="CaseSensitive" Type="System.Boolean"&gt;false&lt;/Property&gt;</p>            <p>&lt;Property Name="IsDefault" Type="System.Boolean"&gt;false&lt;/Property&gt;</p>            <p>&lt;Property Name="UsedForDisambiguation" Type="System.Boolean"&gt;false&lt;/Property&gt;</p>            <p>&lt;Property Name="UseValueAsDontCare" Type="System.Boolean"&gt;false&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;/FilterDescriptor&gt;</p>            <p>&lt;/FilterDescriptors&gt;</p>            <p>&lt;Parameters&gt;</p>            <p>&lt;Parameter Direction="In" Name="@Deptname"&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" AssociatedFilter="Filter" Name="Deptname"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="LogicalOperatorWithPrevious" Type="System.String"&gt;None&lt;/Property&gt;</p>            <p>&lt;Property Name="Order" Type="System.Int32"&gt;0&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;Interpretation&gt;</p>            <p>&lt;NormalizeString FromLOB="NormalizeToNull" ToLOB="NormalizeToEmptyString" /&gt;</p>            <p>&lt;/Interpretation&gt;</p>            <p>&lt;DefaultValues&gt;</p>            <p>&lt;DefaultValue MethodInstanceName="Read List" Type="System.Object" xsi:nil="true" /&gt;</p>            <p>&lt;/DefaultValues&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Read List"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Read ListElement"&gt;</p>            <p>&lt;TypeDescriptors&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Deptno" Name="Deptno" /&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Deptname"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="Location"&gt;</p>            <p>&lt;/TypeDescriptor&gt; </p>            <p>&lt;TypeDescriptor TypeName="System.String" Name="User"&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/TypeDescriptors&gt;</p>            <p>&lt;/TypeDescriptor&gt;</p>            <p>&lt;/Parameter&gt;</p>            <p>&lt;/Parameters&gt;</p>            <p>&lt;MethodInstances&gt;</p>            <p>&lt;MethodInstance Type="Finder" ReturnParameterName="Read List" Default="true" Name="Read List" DefaultDisplayName="Department Read List"&gt;</p>            <p>&lt;Properties&gt;</p>            <p>&lt;Property Name="RootFinder" Type="System.String"&gt;&lt;/Property&gt;</p>            <p>&lt;Property Name="UseClientCachingForSearch" Type="System.String"&gt;&lt;/Property&gt;</p>            <p>&lt;/Properties&gt;</p>            <p>&lt;/MethodInstance&gt;</p>            <p>&lt;/MethodInstances&gt;</p>            <p>&lt;/Method&gt;</p>         </td>       </tr>     </tbody></table>

<p>Now, when you search items in Show Picker dialog, you will be able to get correct results.

<h3><a name="_Toc285830120">The Application: A SharePoint site / Site collection</a></h3>

<b></b>

<h4><a name="_Toc285830121">Creating a Site for Application</a></h4>

Let&rsquo;s say you are planning to create a site, &ldquo;My First BCS Site&rdquo; for your application. Follow the standard site provisioning steps in Central Admin to create your site. (site collection from SharePoint perspective). 

Apply applicable security settings to your site. Once this is done, create a content page to place the external Lists and connect them to show limited amount of data at a time.

<b></b>

<h4><a name="_Toc285830122">Creating An Application Page</a></h4>

Create a &ldquo;New Page&rdquo; (select from &ldquo;Site Actions&rdquo;) with name &ldquo;Employee Master&rdquo; and add the 2 external list. To add the external list in to the page, from &ldquo;Insert &ldquo; ribbon menu select External List and select Department and Employee External Lists. By default, when you add the external list, this is how the page would look like. It would by default display BDC Identity columns

Edit both the web parts and select view as &ldquo;Department Read List&rdquo; and &ldquo;Employee Read List&rdquo;. This is how the screen would look like once the views are applied.

<p>We will include in the blogpost to connect these 2 External lists. </p>]]></content:encoded>
    </item>
    <item>
      <title>Working with Sharepoint 2010 Themes</title>
      <link>https://docs.microsoft.com/archive/blogs/anweshi/working-with-sharepoint-2010-themes</link>
      <pubDate>Thu, 03 Feb 2011 07:56:47 GMT</pubDate>
      <dc:creator><![CDATA[Anweshi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anweshi/2011/02/03/working-with-sharepoint-2010-themes/</guid>
      <description><![CDATA[&nbsp;Check out my blog post about Sharepoint 2010 Themes on Sharepoint Developer Team Blog at...]]></description>
      <content:encoded><![CDATA[&nbsp;<p>Check out my blog post about Sharepoint 2010 Themes on Sharepoint Developer Team Blog at <a title="http://blogs.msdn.com/b/sharepointdev/archive/2011/02/03/working-with-sharepoint-2010-themes.aspx" href="http://blogs.msdn.com/b/sharepointdev/archive/2011/02/03/working-with-sharepoint-2010-themes.aspx">http://blogs.msdn.com/b/sharepointdev/archive/2011/02/03/working-with-sharepoint-2010-themes.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Sharepoint 2010 BCS Object Model Code Snippets</title>
      <link>https://docs.microsoft.com/archive/blogs/anweshi/sharepoint-2010-bcs-object-model-code-snippets</link>
      <pubDate>Mon, 24 Jan 2011 21:22:26 GMT</pubDate>
      <dc:creator><![CDATA[Anweshi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anweshi/2011/01/24/sharepoint-2010-bcs-object-model-code-snippets/</guid>
      <description><![CDATA[&nbsp;

Last year, during the release of Sharepoint 2010 , I have submitted few code samples on BCS...]]></description>
      <content:encoded><![CDATA[&nbsp;

Last year, during the release of Sharepoint 2010 , I have submitted few code samples on BCS to Sharepoint SDK. Here is the link where my code snippets are available.

<a href="http://msdn.microsoft.com/en-us/library/ee557359(v=office.14).aspx">http://msdn.microsoft.com/en-us/library/ee557359(v=office.14).aspx</a>

Let me point you to few other URLs which I have created that will help you executing methods on External Content Type, here they are

Code Snippet: Execute the Creator Method Instance of an External Content Type <a title="http://msdn.microsoft.com/en-us/library/ff464454.aspx" href="http://msdn.microsoft.com/en-us/library/ff464454.aspx">http://msdn.microsoft.com/en-us/library/ff464454.aspx</a>&nbsp;

Code Snippet: Execute an Updater Method Instance of an External Content Type <a title="http://msdn.microsoft.com/en-us/library/ff464403.aspx" href="http://msdn.microsoft.com/en-us/library/ff464403.aspx">http://msdn.microsoft.com/en-us/library/ff464403.aspx</a>

Code Snippet: Execute the Deleter Method Instance of an External Content Type <a title="http://msdn.microsoft.com/en-us/library/ff464351.aspx" href="http://msdn.microsoft.com/en-us/library/ff464351.aspx">http://msdn.microsoft.com/en-us/library/ff464351.aspx</a>

Code Snippet: Execute a Finder Method Instance of an External Content Type 

<a title="http://msdn.microsoft.com/en-us/library/ff464415.aspx" href="http://msdn.microsoft.com/en-us/library/ff464415.aspx">http://msdn.microsoft.com/en-us/library/ff464415.aspx</a>

Code Snippet: Execute the AssociationNavigator Method Instance of an External Content Type <a title="http://msdn.microsoft.com/en-us/library/ff464362.aspx" href="http://msdn.microsoft.com/en-us/library/ff464362.aspx">http://msdn.microsoft.com/en-us/library/ff464362.aspx</a>

Code Snippet: Execute the Associator and Disassociator Method Instances of an External Content Type <a title="http://msdn.microsoft.com/en-us/library/ff464336.aspx" href="http://msdn.microsoft.com/en-us/library/ff464336.aspx">http://msdn.microsoft.com/en-us/library/ff464336.aspx</a>

Code Snippet: Execute the BulkAssociationNavigator Method Instance of an External Content Type <a title="http://msdn.microsoft.com/en-us/library/ff464328.aspx" href="http://msdn.microsoft.com/en-us/library/ff464328.aspx">http://msdn.microsoft.com/en-us/library/ff464328.aspx</a>

Have a look at the BDC Model XML Snippets and the operations on it

<p>Sample BDC Model XML Snippets: Modeling Stereotyped Operations <a title="http://msdn.microsoft.com/en-us/library/ee559335.aspx" href="http://msdn.microsoft.com/en-us/library/ee559335.aspx">http://msdn.microsoft.com/en-us/library/ee559335.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Calling WCF Service using JQuery in Sharepoint Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/anweshi/calling-wcf-service-using-jquery-in-sharepoint-applications</link>
      <pubDate>Tue, 30 Nov 2010 03:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Anweshi]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anweshi/2010/11/30/calling-wcf-service-using-jquery-in-sharepoint-applications/</guid>
      <description><![CDATA[IntroductionThis article explains about how a WCF Service can be called using JQuery in a Sharepoint...]]></description>
      <content:encoded><![CDATA[<p align="justify"><span style="font-family: verdana; font-size: x-small"></span><p align="justify"><b><span style="font-family: verdana; font-size: x-small">Introduction</span></b></p><p align="left"><span style="font-family: verdana; font-size: x-small">This article explains about how a WCF Service can be called using JQuery in a Sharepoint Application.&nbsp; </span></p><p align="left"><span style="font-family: verdana; font-size: x-small"></span><a href="http://blogs.msdn.com#Creating%20a%20WCF%20Service"><span style="font-family: verdana; font-size: x-small">Creating a WCF Service</span></a></p><p align="justify"><a href="http://blogs.msdn.com#Deploying%20WCF%20Service%20in%20Sharepoint%20environment"><span style="font-family: verdana; font-size: x-small">Deploying WCF Service in Sharepoint environment</span></a></p><p align="justify"><span style="font-family: verdana; font-size: x-small"><a href="http://blogs.msdn.com#Testing%20WCF%20Service">Testing WCF Service</a></span></p><p align="justify"><span style="font-family: verdana; font-size: x-small"><a href="http://blogs.msdn.com#Accessing%20WCF%20Service%20using%20JQuery%20from%20a%20Sharepoint%20site">Accessing WCF Service using JQuery from a Sharepoint page</a></span></p><p align="justify"><span style="font-family: verdana; font-size: x-small"></span><span style="font-family: verdana; font-size: x-small"><a href="http://blogs.msdn.com#Contents%20of%20JS%20File">Contents of JS File</a></span></p><p align="justify"><span style="font-family: verdana; font-size: x-small"></span></p><p align="justify"><b><a name="Creating%20a%20WCF%20Service"><span style="font-family: verdana"></span></a><span style="font-family: ; font-size: x-small"></span></b></p><p align="justify"><b><span style="font-family: verdana; font-size: x-small">Creating a WCF Service</span></b></p><p align="justify"><span style="font-family: verdana; font-size: x-small">Let us start with the creation of Data Access Layer. Create a class library with name &ldquo;DatabaseManager&rdquo; with a class &ldquo;ProductsManager&rdquo;. The ProductsManager class has a function &ldquo;GetProducts&rdquo; which gets the list of all Products from the database as given below. </span></p><p align="justify"><span style="font-family: verdana; font-size: x-small">/// &lt;summary&gt;&nbsp; <br>/// Gets all the Products from the Database       <br>/// &lt;/summary&gt;       <br>/// &lt;returns&gt;Returns List of Products&lt;/returns&gt; </span><span style="font-family: ; font-size: x-small">     <br><span style="font-family: verdana">public List&lt;Products&gt; GetProducts()        <br>{ </span></span><span style="font-family: ; font-size: x-small">     <br><span style="font-family: verdana">List&lt;Products&gt; productsList = new List&lt;Products&gt;();</span></span></p><p align="justify"><span style="font-family: verdana; font-size: x-small">Database DatabaseInstance = DatabaseFactory.CreateDatabase(ConnectionStringkey);&nbsp;&nbsp; <br>DbCommand DatabaseCommand;</span></p><p align="justify"><span style="font-family: verdana; font-size: x-small">using (DatabaseCommand = DatabaseInstance.GetStoredProcCommand(SP_GetProducts))&nbsp;&nbsp; <br>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; using (IDataReader reader = DatabaseInstance.ExecuteReader(DatabaseCommand))&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; {&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (reader.Read())&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Products products = new Products();&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; products.ProductName = reader["ProductName"].ToString();&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; products.ProductDesc = reader["ProductDesc"].ToString();&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; products.Price = reader["Price"].ToString();&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; products.Quantity = reader["Quantity"].ToString();&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; productsList.Add(products);&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return productsList;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br>&nbsp;&nbsp; }</span></p><p align="justify"><span style="font-family: verdana; font-size: x-small">Add a strong name to this assembly.</span></p><p align="justify"><span style="font-family: verdana; font-size: x-small">Now, create a WCF Service with name &ldquo;SampleWCFService&rdquo; and add a reference to &ldquo;DatabaseManager&rdquo;. As we are going to deploy this Service in sharepoint 2010 application, change the target .Netframework to 3.5. Now rename the IService1 file to IProductsService and Service1 to ProductsService. Make sure it&rsquo;s updated in all the places. Add a strong name to this assembly.</span></p><p align="justify"><span style="font-family: verdana; font-size: x-small">Follow the below steps to implement WCF Service</span></p><p align="left"><span style="font-family: verdana; font-size: x-small">1. Add a reference to Microsoft.SharePoint.Client.ServerRuntime.dll and open ProductsService.cs using &ldquo;View Map&rdquo; option to add the Factory Attribute as given below. This will reduce the Web.config entries for configuring the WCF Service. </span></p><p align="left"><span style="font-family: verdana; font-size: x-small">&lt;%@ ServiceHost Language="C#" Debug="true" Service="SampleWCFService.ProductService" CodeBehind="ProductService.svc.cs" Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%&gt; </span></p><p align="left"><span style="font-family: verdana; font-size: x-small">2. Add the following highlighted attribute with a new method GetProducts in <strong>ProductsService.cs</strong> file </span></p>

<span style="font-family: ; font-size: x-small"><span style="background-color: #cccccc; font-family: verdana">[BasicHttpBindingServiceMetadataExchangeEndpoint]&nbsp; <br></span></span><span style="font-family: ; font-size: x-small"><span style="font-family: verdana"><span style="background-color: #cccccc; font-family: ">[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]&nbsp; <br></span>public class ProductService : IProductService&nbsp; <br>{</span></span>

<span style="font-family: verdana; font-size: x-small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt;      <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// Gets the list of Products       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt;       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;returns&gt;Returns the List of Products&lt;/returns&gt;       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public List&lt;Products&gt; GetProducts()       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProductsManager productsManager = new ProductsManager();       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return productsManager.GetProducts();       <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </span>

<span style="font-family: verdana; font-size: x-small">}      <br></span></p>

<p align="justify"><span style="font-family: ; font-size: x-small"><span style="font-family: verdana">3. Add a new Contract GetProducts in <strong>IProductService.cs</strong></span></span>

<span style="font-family: verdana; font-size: x-small">[OperationContract]&nbsp; <br>[WebGet(UriTemplate = "/GetProducts", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]&nbsp; <br>List&lt;Products&gt; GetProducts();</span>

<span style="font-family: verdana; font-size: x-small"></span>

<span style="font-family: verdana; font-size: x-small"></span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small"><strong><a name="Deploying%20WCF%20Service%20in%20Sharepoint%20environment"></a>Deploying WCF Service in Sharepoint environment</strong></span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">Follow the blow steps to deploy the WCF Service</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">1. Deploy DatabaseManager and SampleWCFService dlls into GAC</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">2. Copy the SampleWCFService dll into the Virtual directory bin folder</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">3. Copy the ProductService.svc into Layouts folder.</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small"></span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small"><strong><a name="Testing%20WCF%20Service"></a>Testing WCF Service</strong></span></p>

<p align="left"><span style="font-family: verdana; font-size: x-small">In order to check whether the Service is up, navigate to ProductService.SVC file ie., </span><a href="http://siteurl/_layouts/ProductService.svc"><span style="font-family: verdana; font-size: x-small">http://siteurl/_layouts/ProductService.svc</span></a><span style="font-family: verdana"><font size="1">&nbsp;<span style="font-family: ; font-size: x-small">from browser. You will see a message &ldquo;No End Point&rdquo; on the screen. Now let&rsquo;s try to access the method GetProducts ie., </span></font></span><a href="http://siteurl/_layouts/ProductService.svc/GetProducts"><span style="font-family: verdana; font-size: x-small">http://siteurl/_layouts/ProductService.svc/GetProducts</span></a><span style="font-family: verdana; font-size: x-small"> from the browser again. It pops up the resultant file. Following is what you see set in the file. </span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">[{"Price":"100","ProductDesc":"This is product1","ProductName":"Product1","Quantity":"10"},</span>

<span style="font-family: verdana; font-size: x-small">{"Price":"200","ProductDesc":"This is product2","ProductName":"Product2","Quantity":"5"},</span>

<span style="font-family: verdana; font-size: x-small">{"Price":"250","ProductDesc":"This is product3","ProductName":"Product3","Quantity":"6"}]</span>

<span style="font-family: verdana; font-size: x-small"></span>

<span style="font-family: verdana; font-size: x-small"></span></p>

<p align="justify"><a name="Accessing%20WCF%20Service%20using%20JQuery%20from%20a%20Sharepoint%20site"></a><span style="font-family: verdana; font-size: x-small"><strong>Accessing WCF Service using JQuery from a Sharepoint site</strong></span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">Now, its time to access this WCF Service using JQuery.</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">Create a JS file with name &ldquo;CallWCFService.Js&rdquo; and use the following snippets to call the service.</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">1. Create a function object Product to hold each Product details. </span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">//Function object for Product</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">function Product(ProductName,ProductDesc,Price,Quantity)</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">{</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">this.ProductName=ProductName;</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">this.ProductDesc=ProductDesc;</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">this.Price=Price;</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">this.Quantity=Quantity;</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">}</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">2. Call the WCF Service using an AJAX Call</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">function CallWCFService(WCFServiceURL) { </span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">$.ajax({</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">type: "GET",</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">url: WCFServiceURL,</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">contentType: "application/json; charset=utf-8",</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">dataType: '{}',</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">processdata: true,</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">success: function (msg) {</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">WCFServiceSucceeded(msg);</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">},</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">error: WCFServiceFailed </span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">});</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">2. On successful call use the below code to populate the result set in to Products Array object</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">//On Successful WCF Service call</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">function WCFServiceSucceeded(result) {</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">var productsArray = new Array();</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">//Gets the Products</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">$.each(result, function (i, Product) {</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">productsArray[i]=Product;</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">});</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">//Print all the product details</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">$.each(productsArray,function(i,Product)</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">{</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">alert(Product.ProductName + ' ' + Product.ProductDesc + ' ' + Product.Price + ' ' + Product.Quantity)</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">});</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">}</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">Now, include this JS file into your sharepoint page as given below. Make sure you have included the JQuery.binray file.</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">&lt;script src="/Style Library/callwcfservice.js" type="text/javascript"&gt;&lt;/script&gt;</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small">This is the way how a WCF Service can be called using JQuery from any Sharepoint page.</span></p>

<p align="justify"><span style="font-family: verdana; font-size: x-small"><strong><a name="Contents%20of%20JS%20File"></a>Contents of JS File</strong></span></p>

<p align="justify"><span style="font-family: verdana"><span style="font-family: ; font-size: x-small">Please find the enclosed JS file for your reference.</span></span><span style="font-family: verdana"></span></p>

</p>

<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/09/82/48/CallWCFService.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-09-82-48/CallWCFService.zip">CallWCFService.zip</a>]]></content:encoded>
    </item>
  </channel>
</rss>