<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Pragmatic Design And Coding By Manish Singh</title>
    <link>http://manishsingh.net/blogs/</link>
    <description>Blog !</description>
    <language>en-us</language>
    <copyright>Manish Kumar Singh</copyright>
    <lastBuildDate>Sun, 07 Jun 2009 06:07:50 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>msingh.www@gmail.com</managingEditor>
    <webMaster>msingh.www@gmail.com</webMaster>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=42928043-f931-451f-aa63-899af494bfe3</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,42928043-f931-451f-aa63-899af494bfe3.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,42928043-f931-451f-aa63-899af494bfe3.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=42928043-f931-451f-aa63-899af494bfe3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h3>Find N<sup>th</sup> Max or Min Record
</h3>
This query gets the N<sup>th</sup> highest salary from the emp table. You can replace
the Max function with Min to obtain N<sup>th</sup> lowest salary. <font color="#0000ff" size="2"><font color="#808080" size="2"><font color="#0000ff" size="2"><p><font face="Courier New">SELECT</font></p></font><font face="Courier New"><font color="#000000" size="2"> Eno</font><font color="#808080" size="2">,</font><font color="#000000" size="2"> Ename</font><font color="#808080" size="2">,</font><font color="#000000" size="2"> Desig</font><font color="#808080" size="2">,</font><font color="#000000" size="2"> Sal</font><font color="#808080" size="2">,</font><font color="#000000" size="2"> Mgr</font><font color="#808080" size="2">,</font></font><font face="Courier New"><font size="2"><font color="#000000"> DNO 
<br /></font></font><font color="#0000ff" size="2">FROM</font><font color="#000000" size="2"> dbo</font><font color="#808080" size="2">.</font><font color="#000000" size="2">Emp </font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"><font color="#000000"> E1 
<br /></font></font><font color="#0000ff" size="2">WHERE</font><font color="#000000" size="2"></font><font color="#808080" size="2">(</font><font color="#000000" size="2">N </font><font color="#808080" size="2">-</font><font color="#000000" size="2"> 1 </font><font color="#808080" size="2">=</font></font><font face="Courier New"><font size="2"><font color="#000000"> <br /></font></font><font color="#808080" size="2">         (</font><font color="#0000ff" size="2">SELECT</font><font size="2"></font><font color="#ff00ff" size="2">COUNT</font><font color="#808080" size="2">(</font><font color="#0000ff" size="2">DISTINCT</font><font size="2"> Sal</font><font color="#808080" size="2">)</font><font size="2"></font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"> DistinctSal <br /></font><font color="#0000ff" size="2">            FROM</font><font size="2"> dbo</font><font color="#808080" size="2">.</font><font size="2">Emp </font><font color="#0000ff" size="2">AS</font><font size="2"> E2 </font><font color="#0000ff" size="2">WHERE</font><font size="2"></font><font color="#808080" size="2">(</font><font size="2">Sal </font><font color="#808080" size="2">&gt;</font><font size="2"> E1</font><font color="#808080" size="2">.</font><font size="2">Sal</font><font color="#808080" size="2">)))
</font></font></font></font><h3>Row Number
</h3>
This query generates the row number for the records fetched. <font color="#0000ff" size="2"><p><font face="Courier New">SELECT</font></p></font><font face="Courier New"><font size="2"><font color="#000000"></font></font><font color="#808080" size="2">(</font><font color="#0000ff" size="2">SELECT</font><font size="2"></font><font color="#ff00ff" size="2">COUNT</font><font color="#808080" size="2">(*)</font><font size="2"></font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"> Counter <br /></font><font color="#0000ff" size="2">               FROM</font><font size="2"> dbo</font><font color="#808080" size="2">.</font><font size="2">Emp </font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"> e2 <br /></font><font color="#0000ff" size="2">               WHERE</font><font size="2"></font><font color="#808080" size="2">(</font><font size="2">e2</font><font color="#808080" size="2">.</font><font size="2">Eno </font><font color="#808080" size="2">&lt;=</font><font size="2"> e</font><font color="#808080" size="2">.</font><font size="2">Eno</font><font color="#808080" size="2">))</font><font size="2"></font><font color="#0000ff" size="2">AS</font><font size="2"> RowNumber</font><font color="#808080" size="2">,</font></font><font face="Courier New"><font size="2"> <br />
            </font><font size="2">Ename</font><font color="#808080" size="2">,</font><font size="2"> Desig</font><font color="#808080" size="2">,</font></font><font face="Courier New"><font size="2"> Sal <br /></font><font color="#0000ff" size="2">            FROM</font><font size="2"> dbo</font><font color="#808080" size="2">.</font><font size="2">Emp </font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"> e <br />
            </font><font color="#0000ff" size="2">ORDER</font><font size="2"></font><font color="#0000ff" size="2">BY</font></font><font size="2"><font face="Courier New"> RowNumber </font></font><h3 style="FONT-FAMILY: 'Courier New'"><font face="Verdana">Running Total</font></h3>
This query computes the running total on salary for the records in Emp table. <font color="#0000ff" size="2"><p><font face="Courier New">SELECT</font></p></font><font face="Courier New"><font color="#000000" size="2"> a</font><font color="#808080" size="2">.</font><font color="#000000" size="2">Ename</font><font color="#808080" size="2">,</font><font color="#000000" size="2"></font><font color="#ff00ff" size="2">SUM</font><font color="#808080" size="2">(</font><font color="#000000" size="2">b</font><font color="#808080" size="2">.</font><font color="#000000" size="2">Sal</font><font color="#808080" size="2">)</font><font color="#000000" size="2"></font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"><font color="#000000"> RunningTotal<br /></font></font><font color="#0000ff" size="2">FROM</font><font color="#000000" size="2"> dbo</font><font color="#808080" size="2">.</font><font color="#000000" size="2">Emp </font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"><font color="#000000"> a 
<br /></font></font><font color="#808080" size="2">INNER</font><font color="#000000" size="2"></font><font color="#808080" size="2">JOIN</font><font color="#000000" size="2"> dbo</font><font color="#808080" size="2">.</font><font color="#000000" size="2">Emp </font><font color="#0000ff" size="2">AS</font><font color="#000000" size="2"> b </font><font color="#0000ff" size="2">ON</font><font color="#000000" size="2"> a</font><font color="#808080" size="2">.</font><font color="#000000" size="2">Ename </font><font color="#808080" size="2">&gt;=</font><font color="#000000" size="2"> b</font><font color="#808080" size="2">.</font></font><font face="Courier New"><font size="2"><font color="#000000">Ename<br /></font></font><font color="#0000ff" size="2">GROUP</font><font color="#000000" size="2"></font><font color="#0000ff" size="2">BY</font><font color="#000000" size="2"> a</font><font color="#808080" size="2">.</font><font size="2"><font color="#000000">Ename</font></font></font><h3>Find Duplicates
</h3><p>
This query finds the duplicate records in Emp table. 
</p><font color="#000000" size="2"><font color="#0000ff" size="2"><p><font face="Courier New">SELECT</font></p></font><font face="Courier New"><font size="2"> Ename</font><font color="#808080" size="2">,</font><font size="2"> Desig</font><font color="#808080" size="2">,</font><font size="2"> Sal</font><font color="#808080" size="2">,</font><font size="2"></font><font color="#ff00ff" size="2">COUNT</font><font color="#808080" size="2">(*)</font><font size="2"></font><font color="#0000ff" size="2">AS</font></font><font face="Courier New"><font size="2"> Duplicate<br /></font><font color="#0000ff" size="2">FROM</font><font size="2"> dbo</font><font color="#808080" size="2">.</font></font><font face="Courier New"><font size="2">Emp<br /></font><font color="#0000ff" size="2">GROUP</font><font size="2"></font><font color="#0000ff" size="2">BY</font><font size="2"> Ename</font><font color="#808080" size="2">,</font><font size="2"> Desig</font><font color="#808080" size="2">,</font></font><font face="Courier New"><font size="2"> Sal<br /></font><font color="#0000ff" size="2">HAVING</font><font size="2"></font><font color="#808080" size="2">(</font><font color="#ff00ff" size="2">COUNT</font><font color="#808080" size="2">(*)</font><font size="2"></font><font color="#808080" size="2">&gt;</font><font size="2"> 1</font></font><font face="Courier New"><font color="#808080" size="2">)<br /></font><font color="#0000ff" size="2">ORDER</font><font size="2"></font><font color="#0000ff" size="2">BY</font><font size="2"> Duplicate </font><font color="#0000ff" size="2">DESC</font><font color="#808080" size="2">,</font><font size="2"> Ename
</font></font></font><h3>Let SQL Generate SQL
</h3><p>
This query emits SQL queries as records fetched. 
</p><font color="#000000" size="2"><font color="#0000ff" size="2"><font face="Courier New"><font color="#0000ff" size="2"><p>
Select
</p></font><font color="#000000" size="2"></font><font color="#ff0000" size="2">'Select
DName from Dept where Dno='</font><font color="#000000" size="2"></font><font color="#808080" size="2">+</font><font color="#000000" size="2"></font><font color="#ff00ff" size="2">CAST</font><font color="#808080" size="2">(</font><font color="#000000" size="2">DNO </font><font color="#0000ff" size="2">as</font><font color="#000000" size="2"></font><font color="#0000ff" size="2">varchar</font><font color="#808080" size="2">)</font><font color="#000000" size="2"></font><font color="#0000ff" size="2">from</font><font size="2"><font color="#000000"> Emp</font></font></font></font></font><img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=42928043-f931-451f-aa63-899af494bfe3" /><br /><hr />
Manish Kumar Singh</body>
      <title>Fun with SQL Query</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,42928043-f931-451f-aa63-899af494bfe3.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/06/07/FunWithSQLQuery.aspx</link>
      <pubDate>Sun, 07 Jun 2009 06:07:50 GMT</pubDate>
      <description>&lt;h3&gt;Find N&lt;sup&gt;th&lt;/sup&gt; Max or Min Record
&lt;/h3&gt;
This query gets the N&lt;sup&gt;th&lt;/sup&gt; highest salary from the emp table. You can replace
the Max function with Min to obtain N&lt;sup&gt;th&lt;/sup&gt; lowest salary. &lt;font color=#0000ff size=2&gt;&lt;font color=#808080 size=2&gt;&lt;font color=#0000ff size=2&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;SELECT&lt;/font&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#000000 size=2&gt; Eno&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font color=#000000 size=2&gt; Ename&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font color=#000000 size=2&gt; Desig&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font color=#000000 size=2&gt; Sal&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font color=#000000 size=2&gt; Mgr&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; DNO 
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;FROM&lt;/font&gt;&lt;font color=#000000 size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font color=#000000 size=2&gt;Emp &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; E1 
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;WHERE&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font color=#000000 size=2&gt;N &lt;/font&gt;&lt;font color=#808080 size=2&gt;-&lt;/font&gt;&lt;font color=#000000 size=2&gt; 1 &lt;/font&gt;&lt;font color=#808080 size=2&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;&amp;nbsp;&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color=#808080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;SELECT&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff00ff size=2&gt;COUNT&lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;DISTINCT&lt;/font&gt;&lt;font size=2&gt; Sal&lt;/font&gt;&lt;font color=#808080 size=2&gt;)&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; DistinctSal&amp;nbsp;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM&lt;/font&gt;&lt;font size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;Emp &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;font size=2&gt; E2 &lt;/font&gt;&lt;font color=#0000ff size=2&gt;WHERE&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font size=2&gt;Sal &lt;/font&gt;&lt;font color=#808080 size=2&gt;&amp;gt;&lt;/font&gt;&lt;font size=2&gt; E1&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;Sal&lt;/font&gt;&lt;font color=#808080 size=2&gt;)))&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; 
&lt;h3&gt;Row Number
&lt;/h3&gt;
This query generates the row number for the records fetched. &lt;font color=#0000ff size=2&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;SELECT&lt;/font&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font color=#0000ff size=2&gt;SELECT&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff00ff size=2&gt;COUNT&lt;/font&gt;&lt;font color=#808080 size=2&gt;(*)&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; Counter&amp;nbsp;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM&lt;/font&gt;&lt;font size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;Emp &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; e2&amp;nbsp;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font size=2&gt;e2&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;Eno &lt;/font&gt;&lt;font color=#808080 size=2&gt;&amp;lt;=&lt;/font&gt;&lt;font size=2&gt; e&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;Eno&lt;/font&gt;&lt;font color=#808080 size=2&gt;))&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;font size=2&gt; RowNumber&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font size=2&gt;Ename&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font size=2&gt; Desig&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; Sal&amp;nbsp;&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM&lt;/font&gt;&lt;font size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;Emp &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; e&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;ORDER&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;BY&lt;/font&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;font face="Courier New"&gt; RowNumber &lt;/font&gt;&gt;
&lt;/font&gt; 
&lt;h3 style="FONT-FAMILY: 'Courier New'"&gt;&lt;font face=Verdana&gt;Running Total&lt;/font&gt;
&lt;/h3&gt;
This query computes the running total on salary for the records in Emp table. &lt;font color=#0000ff size=2&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;SELECT&lt;/font&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#000000 size=2&gt; a&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font color=#000000 size=2&gt;Ename&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#ff00ff size=2&gt;SUM&lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font color=#000000 size=2&gt;b&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font color=#000000 size=2&gt;Sal&lt;/font&gt;&lt;font color=#808080 size=2&gt;)&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; RunningTotal&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;FROM&lt;/font&gt;&lt;font color=#000000 size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font color=#000000 size=2&gt;Emp &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; a 
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color=#808080 size=2&gt;INNER&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;JOIN&lt;/font&gt;&lt;font color=#000000 size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font color=#000000 size=2&gt;Emp &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;font color=#000000 size=2&gt; b &lt;/font&gt;&lt;font color=#0000ff size=2&gt;ON&lt;/font&gt;&lt;font color=#000000 size=2&gt; a&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font color=#000000 size=2&gt;Ename &lt;/font&gt;&lt;font color=#808080 size=2&gt;&amp;gt;=&lt;/font&gt;&lt;font color=#000000 size=2&gt; b&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;Ename&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color=#0000ff size=2&gt;GROUP&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;BY&lt;/font&gt;&lt;font color=#000000 size=2&gt; a&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;font size=2&gt;&lt;font color=#000000&gt;Ename&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&gt;
&lt;h3&gt;Find Duplicates
&lt;/h3&gt;
&lt;p&gt;
This query finds the duplicate records in Emp table. 
&lt;/p&gt;
&lt;font color=#000000 size=2&gt;&lt;font color=#0000ff size=2&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;SELECT&lt;/font&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; Ename&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font size=2&gt; Desig&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font size=2&gt; Sal&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff00ff size=2&gt;COUNT&lt;/font&gt;&lt;font color=#808080 size=2&gt;(*)&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; Duplicate&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;FROM&lt;/font&gt;&lt;font size=2&gt; dbo&lt;/font&gt;&lt;font color=#808080 size=2&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt;Emp&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;GROUP&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;BY&lt;/font&gt;&lt;font size=2&gt; Ename&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font size=2&gt; Desig&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size=2&gt; Sal&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;HAVING&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font color=#ff00ff size=2&gt;COUNT&lt;/font&gt;&lt;font color=#808080 size=2&gt;(*)&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;&amp;gt;&lt;/font&gt;&lt;font size=2&gt; 1&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#808080 size=2&gt;)&lt;br&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;ORDER&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;BY&lt;/font&gt;&lt;font size=2&gt; Duplicate &lt;/font&gt;&lt;font color=#0000ff size=2&gt;DESC&lt;/font&gt;&lt;font color=#808080 size=2&gt;,&lt;/font&gt;&lt;font size=2&gt; Ename&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; 
&lt;h3&gt;Let SQL Generate SQL
&lt;/h3&gt;
&lt;p&gt;
This query emits SQL queries as records fetched. 
&lt;/p&gt;
&lt;font color=#000000 size=2&gt;&lt;font color=#0000ff size=2&gt;&lt;font face="Courier New"&gt;&lt;font color=#0000ff size=2&gt; 
&lt;p&gt;
Select
&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;'Select DName
from Dept where Dno='&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#808080 size=2&gt;+&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#ff00ff size=2&gt;CAST&lt;/font&gt;&lt;font color=#808080 size=2&gt;(&lt;/font&gt;&lt;font color=#000000 size=2&gt;DNO &lt;/font&gt;&lt;font color=#0000ff size=2&gt;as&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;varchar&lt;/font&gt;&lt;font color=#808080 size=2&gt;)&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;from&lt;/font&gt;&lt;font size=2&gt;&lt;font color=#000000&gt; Emp&lt;/font&gt;&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=42928043-f931-451f-aa63-899af494bfe3" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,42928043-f931-451f-aa63-899af494bfe3.aspx</comments>
      <category>SQL</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=6b8c0b2a-12af-4142-9a2e-85defc09db3d</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,6b8c0b2a-12af-4142-9a2e-85defc09db3d.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,6b8c0b2a-12af-4142-9a2e-85defc09db3d.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=6b8c0b2a-12af-4142-9a2e-85defc09db3d</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h3>WCF Kick Start
</h3>
        <p>
In this article I would be describing the simplest form of WCF (<a href="http://en.wikipedia.org/wiki/Windows_Communication_Foundation" target="_blank">Windows
Communication Foundation</a>) project which would get you started with the WCF concepts
and best practices. The purpose is to minimise the confusion from code and configuration and
explain the idea along with the best practice. I would also provide
description and links to help you move to a more advanced WCF topics as and when required. 
</p>
        <p>
For the sake of kick start I would be using <code>basicHttpBinding</code> for the
service and consumer, which does not require any kind of authentication when accessing
the service. It is kind of open to all. 
</p>
        <p>
Below is an overall image of the solution, projects and project files that I have
used to demonstrate the simplest form of WCF implementation. 
</p>
        <table cellspacing="4" cellpadding="4" width="100%" border="0">
          <tbody>
            <tr>
              <td valign="top" align="left">
                <img height="536" alt="solution" src="http://manishsingh.net/blogs/shared/solutionwcf.jpg" width="272" />
              </td>
              <td valign="top" align="left">
                <p>
The solution contains a project <code>WcfServiceOne</code> which defines types for
contracts exposed by the service. The person class is the data contract, <code>MyService</code> is
the service and <code>IMyService</code> is an interface acting as a service contract.
This project acts as an API for the services. 
</p>
                <p>
The <code>ServiceOneHost</code> is the service exposed to the client. It references
the project <code>WcfServiceOne</code> which the actual implementation of the Service
as an API. Though, I could have had the service implementation written in the same
project, I preferred following the best practices, by implementing the Service and
Service API (contracts and its implementation) in a separate project. One advantage
of doing this is that, you have decoupled service and Service API, which simplifies
using the API in a non-WCF environment by directly referencing it. The <code>web.config</code> file
in this project contains the binding information for the service which I will be explaining
later in this article. 
</p>
                <p>
The <code>ServiceOneConsumer</code> is a simple ASP.Net web application consuming
the service exposed by <code>ServiceOneHost</code>. The <code>web.config</code> in
this web application contains the binding information defined by the host. 
</p>
                <h3>WcfServiceOne
</h3>
                <p>
WcfServiceOne project contains: 
</p>
                <ul>
                  <li>
Data Contract - <code>Person.cs</code></li>
                  <li>
Service Contract - <code>IMyService.cs</code></li>
                  <li>
Service Implementation - <code>IMyService.cs</code></li>
                </ul>
Also notice that the project references <code>System.ServiceModel</code> and <code>System.Runtime.Serialization</code> which
are required to assign attributes like <code>ServiceContract</code>, <code>OperationContract</code>, <code>DataContract</code> and <code>DataMember</code>. 
</td>
            </tr>
          </tbody>
        </table>
        <h3>Person.cs
</h3>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> System.Runtime.Serialization;
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">namespace</span> WcfServiceOne
</p>
          <p style="MARGIN: 0px">
{
</p>
          <p style="MARGIN: 0px">
    [<span style="COLOR: #2b91af">DataContract</span>]
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">public</span><span style="COLOR: blue">class</span><span style="COLOR: #2b91af">Person</span></p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        [<span style="COLOR: #2b91af">DataMember</span>]
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">public</span><span style="COLOR: blue">string</span> FullName
{ <span style="COLOR: blue">get</span>; <span style="COLOR: blue">set</span>; }
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
        [<span style="COLOR: #2b91af">DataMember</span>]
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">public</span><span style="COLOR: blue">string</span> Gender
{ <span style="COLOR: blue">get</span>; <span style="COLOR: blue">set</span>; }
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
}
</p>
        </div>
        <h3>IMyService.cs
</h3>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> System.ServiceModel;
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">namespace</span> WcfServiceOne
</p>
          <p style="MARGIN: 0px">
{
</p>
          <p style="MARGIN: 0px">
    [<span style="COLOR: #2b91af">ServiceContract</span>]
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">public</span><span style="COLOR: blue">interface</span><span style="COLOR: #2b91af">IMyService</span></p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        [<span style="COLOR: #2b91af">OperationContract</span>]
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">string</span> Callme(<span style="COLOR: #2b91af">Person</span> p);
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
}
</p>
        </div>
        <h3>MyService
</h3>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">namespace</span> WcfServiceOne
</p>
          <p style="MARGIN: 0px">
{
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">public</span><span style="COLOR: blue">class</span><span style="COLOR: #2b91af">MyService</span> : <span style="COLOR: #2b91af">IMyService</span></p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">public</span><span style="COLOR: blue">string</span> Callme(<span style="COLOR: #2b91af">Person</span> p)
</p>
          <p style="MARGIN: 0px">
        {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">return</span><span style="COLOR: #a31515">"Hello
"</span> + p.FullName + <span style="COLOR: #a31515">"  "</span> + <span style="COLOR: #a31515">"
you are a "</span> + p.Gender;
</p>
          <p style="MARGIN: 0px">
        }
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
}
</p>
        </div>
        <h3>ServiceOneHost
</h3>
        <p>
Add a reference to <code>WcfServiceOne</code> and then right click on the project.
Select "Add New Item" from the context menu and select "WCF Service" templates. Name
the new file <code>ServiceOneHost.svc</code>. The template would also create the code
files for you in the App_Code folder. You can delete it, the code file is not required.
Open the <code>ServiceOneHost.svc</code> and change the line to: 
</p>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="BACKGROUND: #ffee62">&lt;%</span>
            <span style="COLOR: blue">@</span>
            <span style="COLOR: #a31515">ServiceHost</span>
            <span style="COLOR: red">Language</span>
            <span style="COLOR: blue">="C#"</span>
            <span style="COLOR: red">Debug</span>
            <span style="COLOR: blue">="true"</span>
            <span style="COLOR: red">Service</span>
            <span style="COLOR: blue">="WcfServiceOne.MyService"</span>
            <span style="BACKGROUND: #ffee62">%&gt;</span>
          </p>
          <p style="MARGIN: 0px">
 
</p>
        </div>
        <p>
Now open the <code>web.config</code> file in this project and add the following block
at the last within the closing of <code>configuration</code> tag. 
</p>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">  &lt;</span>
            <span style="COLOR: #a31515">system.serviceModel</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">    &lt;</span>
            <span style="COLOR: #a31515">behaviors</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">      &lt;</span>
            <span style="COLOR: #a31515">serviceBehaviors</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;</span>
            <span style="COLOR: #a31515">behavior</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">name</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">ServiceOneHostBehavior</span>"<span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">          &lt;</span>
            <span style="COLOR: #a31515">serviceMetadata</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">httpGetEnabled</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">true</span>"<span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">          &lt;</span>
            <span style="COLOR: #a31515">serviceDebug</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">includeExceptionDetailInFaults</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">false</span>"<span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;/</span>
            <span style="COLOR: #a31515">behavior</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">      &lt;/</span>
            <span style="COLOR: #a31515">serviceBehaviors</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">    &lt;/</span>
            <span style="COLOR: #a31515">behaviors</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">    &lt;</span>
            <span style="COLOR: #a31515">services</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">      &lt;</span>
            <span style="COLOR: #a31515">service</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">behaviorConfiguration</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">ServiceOneHostBehavior</span>"<span style="COLOR: blue"></span><span style="COLOR: red">name</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">WcfServiceOne.MyService</span>"<span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;</span>
            <span style="COLOR: #a31515">endpoint</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">address</span>
            <span style="COLOR: blue">=</span>""<span style="COLOR: blue"></span><span style="COLOR: red">binding</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">basicHttpBinding</span>"<span style="COLOR: blue"></span><span style="COLOR: red">contract</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">WcfServiceOne.IMyService</span>"<span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">          &lt;</span>
            <span style="COLOR: #a31515">identity</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">            &lt;</span>
            <span style="COLOR: #a31515">dns</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">value</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">localhost</span>"<span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">          &lt;/</span>
            <span style="COLOR: #a31515">identity</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;/</span>
            <span style="COLOR: #a31515">endpoint</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;</span>
            <span style="COLOR: #a31515">endpoint</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">address</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">mex</span>"<span style="COLOR: blue"></span><span style="COLOR: red">binding</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">mexHttpBinding</span>"<span style="COLOR: blue"></span><span style="COLOR: red">contract</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">IMetadataExchange</span>"<span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">      &lt;/</span>
            <span style="COLOR: #a31515">service</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">    &lt;/</span>
            <span style="COLOR: #a31515">services</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">  &lt;/</span>
            <span style="COLOR: #a31515">system.serviceModel</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
        </div>
        <p>
          <code>system.servicemodel</code>tag defines how the consumer is going to connect to
the service exposed here. When you add a "WCF service" to the project using template,
it responds with adding the above <code>system.servicemodel</code> in the <code>web.config</code>,
except the following two lines. 
</p>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">      &lt;</span>
            <span style="COLOR: #a31515">service</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">behaviorConfiguration</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">ServiceOneHostBehavior</span>"<span style="COLOR: blue"></span><span style="COLOR: red">name</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">WcfServiceOne.MyService</span>"<span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;</span>
            <span style="COLOR: #a31515">endpoint</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">address</span>
            <span style="COLOR: blue">=</span>""<span style="COLOR: blue"></span><span style="COLOR: red">binding</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">basicHttpBinding</span>"<span style="COLOR: blue"></span><span style="COLOR: red">contract</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">WcfServiceOne.IMyService</span>"<span style="COLOR: blue">&gt;</span></p>
        </div>
        <p>
Change the name, contract and binding information as shown above. The <code>wsHttpBinding</code> is
used to provide more secured communication using certificate. Visit <a href="http://www.codeplex.com/WCFSecurity" target="_blank">The
pattern and practices for WCF security</a> at <a href="http://www.codeplex.com" target="_blank">Codeplex</a> for
further guidance on how to implement <code>wsHttpBinding</code> using certificates. 
</p>
        <h3>ServiceOneConsumer
</h3>
        <p>
Before you proceed with consumer, you need to generate a proxy for the service and
define how it connects, in the <code>web.config</code> file. To generate the proxy
and the configuration block we would use <code>svcutil</code>. Open the Visual studio
command prompt from Visual Studio Tools and use the following command to generate
the proxy and configuration. 
<br /><br /><code>svcutil http://localhost/ServiceOneHost/ServiceOneHost.svc /Language:C# /out:ServiceHostProxy.cs
/config:ServiceHost.config </code></p>
        <p>
This will create a <code>ServiceHostProxy.cs</code> and <code>ServiceHost.config</code>.
Open the <code>ServiceHost.config</code> and copy the block. Now open the <code>web.config</code> file
and paste the block at the end before the closing tag of <code>configuration</code>.
The endpoint address might differ depending your host and consumer address URL. 
</p>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">    &lt;</span>
            <span style="COLOR: #a31515">system.serviceModel</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;</span>
            <span style="COLOR: #a31515">bindings</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">            &lt;</span>
            <span style="COLOR: #a31515">basicHttpBinding</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
&lt;</span>
            <span style="COLOR: #a31515">binding</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">name</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">BasicHttpBinding_IMyService</span>"<span style="COLOR: blue"></span><span style="COLOR: red">closeTimeout</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">00:01:00</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">openTimeout</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">00:01:00</span>"<span style="COLOR: blue"></span><span style="COLOR: red">receiveTimeout</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">00:10:00</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">sendTimeout</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">00:01:00</span>"<span style="COLOR: blue"></span><span style="COLOR: red">allowCookies</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">false</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">bypassProxyOnLocal</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">false</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">hostNameComparisonMode</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">StrongWildcard</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">maxBufferSize</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">65536</span>"<span style="COLOR: blue"></span><span style="COLOR: red">maxBufferPoolSize</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">524288</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">maxReceivedMessageSize</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">65536</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">messageEncoding</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">Text</span>"<span style="COLOR: blue"></span><span style="COLOR: red">textEncoding</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">utf-8</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">transferMode</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">Buffered</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
         </span>
            <span style="COLOR: red">useDefaultWebProxy</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">true</span>"<span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
    &lt;</span>
            <span style="COLOR: #a31515">readerQuotas</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">maxDepth</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">32</span>"<span style="COLOR: blue"></span><span style="COLOR: red">maxStringContentLength</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">8192</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
                  </span>
            <span style="COLOR: red">maxArrayLength</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">16384</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
                  </span>
            <span style="COLOR: red">maxBytesPerRead</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">4096</span>"<span style="COLOR: blue"></span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
                  </span>
            <span style="COLOR: red">maxNameTableCharCount</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">16384</span>"<span style="COLOR: blue"> /&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
    &lt;</span>
            <span style="COLOR: #a31515">security</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">mode</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">None</span>"<span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
        &lt;</span>
            <span style="COLOR: #a31515">transport</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">clientCredentialType</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">None</span>"<span style="COLOR: blue"></span><span style="COLOR: red">proxyCredentialType</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">None</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
            </span>
            <span style="COLOR: red">realm</span>
            <span style="COLOR: blue">=</span>""<span style="COLOR: blue"> /&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
        &lt;</span>
            <span style="COLOR: #a31515">message</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">clientCredentialType</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">UserName</span>"<span style="COLOR: blue"></span><span style="COLOR: red">algorithmSuite</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Default</span>"<span style="COLOR: blue"> /&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
    &lt;/</span>
            <span style="COLOR: #a31515">security</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">               
&lt;/</span>
            <span style="COLOR: #a31515">binding</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">            &lt;/</span>
            <span style="COLOR: #a31515">basicHttpBinding</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;/</span>
            <span style="COLOR: #a31515">bindings</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;</span>
            <span style="COLOR: #a31515">client</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">            &lt;</span>
            <span style="COLOR: #a31515">endpoint</span>
            <span style="COLOR: blue">
            </span>
            <span style="COLOR: red">address</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">http://localhost/ServiceOneHost/ServiceOneHost.svc</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">                </span>
            <span style="COLOR: red">binding</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">basicHttpBinding</span>"<span style="COLOR: blue"></span><span style="COLOR: red">bindingConfiguration</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">BasicHttpBinding_IMyService</span>"
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">                </span>
            <span style="COLOR: red">contract</span>
            <span style="COLOR: blue">=</span>"<span style="COLOR: blue">IMyService</span>"<span style="COLOR: blue"></span><span style="COLOR: red">name</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">BasicHttpBinding_IMyService</span>"<span style="COLOR: blue"> /&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">        &lt;/</span>
            <span style="COLOR: #a31515">client</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">    &lt;/</span>
            <span style="COLOR: #a31515">system.serviceModel</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
        </div>
        <h3>Default.aspx
</h3>
        <p>
Now add the following UI in the home page of your consumer site. In this case it is <code>Default.aspx</code>. 
</p>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;</span>
            <span style="COLOR: #a31515">table</span>
            <span style="COLOR: red">style</span>
            <span style="COLOR: blue">="</span>
            <span style="COLOR: red">width</span>: <span style="COLOR: blue">400px</span>;<span style="COLOR: blue">"</span><span style="COLOR: red">cellspacing</span><span style="COLOR: blue">="0"</span><span style="COLOR: red">cellpadding</span><span style="COLOR: blue">="0"&gt;</span></p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">tr</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">style</span><span style="COLOR: blue">="</span><span style="COLOR: red">width</span>:<span style="COLOR: blue">100px</span>; <span style="COLOR: red">vertical-align</span>:<span style="COLOR: blue">top</span>; <span style="COLOR: red">text-align</span>:<span style="COLOR: blue">left</span>;<span style="COLOR: blue">"&gt;</span></p>
          <p style="MARGIN: 0px">
            Your Name
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">style</span><span style="COLOR: blue">="</span><span style="COLOR: red">width</span>:<span style="COLOR: blue">10px</span>; <span style="COLOR: red">vertical-align</span>:<span style="COLOR: blue">top</span>; <span style="COLOR: red">text-align</span>:<span style="COLOR: blue">left</span>;<span style="COLOR: blue">"&gt;</span></p>
          <p style="MARGIN: 0px">
            :
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">style</span><span style="COLOR: blue">="</span><span style="COLOR: red">width</span>:<span style="COLOR: blue">290px</span>; <span style="COLOR: red">vertical-align</span>:<span style="COLOR: blue">top</span>; <span style="COLOR: red">text-align</span>:<span style="COLOR: blue">left</span>;<span style="COLOR: blue">"&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">TextBox</span><span style="COLOR: red">ID</span><span style="COLOR: blue">="txtName"</span><span style="COLOR: red">runat</span><span style="COLOR: blue">="server"</span><span style="COLOR: red">Width</span><span style="COLOR: blue">="200"&gt;&lt;/</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">TextBox</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">tr</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">tr</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">style</span><span style="COLOR: blue">="</span><span style="COLOR: red">vertical-align</span>:<span style="COLOR: blue">top</span>; <span style="COLOR: red">text-align</span>:<span style="COLOR: blue">left</span>;<span style="COLOR: blue">"&gt;</span></p>
          <p style="MARGIN: 0px">
            Gender
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">style</span><span style="COLOR: blue">="</span><span style="COLOR: red">vertical-align</span>:<span style="COLOR: blue">top</span>; <span style="COLOR: red">text-align</span>:<span style="COLOR: blue">left</span>;<span style="COLOR: blue">"&gt;</span></p>
          <p style="MARGIN: 0px">
            :
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">style</span><span style="COLOR: blue">="</span><span style="COLOR: red">vertical-align</span>:<span style="COLOR: blue">top</span>; <span style="COLOR: red">text-align</span>:<span style="COLOR: blue">left</span>;<span style="COLOR: blue">"&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">DropDownList</span><span style="COLOR: red">ID</span><span style="COLOR: blue">="ddlGender"</span><span style="COLOR: red">runat</span><span style="COLOR: blue">="server"&gt;</span></p>
          <p style="MARGIN: 0px">
                <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">ListItem</span><span style="COLOR: red">Selected</span><span style="COLOR: blue">="True"</span><span style="COLOR: red">Text</span><span style="COLOR: blue">="Male"</span><span style="COLOR: red">Value</span><span style="COLOR: blue">="male"</span><span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
                <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">ListItem</span><span style="COLOR: red">Text</span><span style="COLOR: blue">="Female"</span><span style="COLOR: red">Value</span><span style="COLOR: blue">="female"</span><span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">DropDownList</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">Button</span><span style="COLOR: red">ID</span><span style="COLOR: blue">="btnSubmit"</span><span style="COLOR: red">runat</span><span style="COLOR: blue">="server"</span><span style="COLOR: red">Text</span><span style="COLOR: blue">="Submit"</span></p>
          <p style="MARGIN: 0px">
                <span style="COLOR: red">onclick</span><span style="COLOR: blue">="btnSubmit_Click"</span><span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">tr</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">tr</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">td</span><span style="COLOR: red">colspan</span><span style="COLOR: blue">="3"&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">br</span><span style="COLOR: blue">/&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">Label</span><span style="COLOR: red">ID</span><span style="COLOR: blue">="lblResult"</span><span style="COLOR: red">runat</span><span style="COLOR: blue">="server"</span><span style="COLOR: red">Text</span><span style="COLOR: blue">=""</span><span style="COLOR: red">Font-Bold</span><span style="COLOR: blue">="true"</span><br />
                    <span style="COLOR: red">Font-Size</span><span style="COLOR: blue">="Large"&gt;&lt;/</span><span style="COLOR: #a31515">asp</span><span style="COLOR: blue">:</span><span style="COLOR: #a31515">Label</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">td</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">&lt;/</span><span style="COLOR: #a31515">tr</span><span style="COLOR: blue">&gt;</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">&lt;/</span>
            <span style="COLOR: #a31515">table</span>
            <span style="COLOR: blue">&gt;</span>
          </p>
        </div>
        <h3>Default.aspx.cs - Code Behind
</h3>
        <div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> System;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">using</span> WcfServiceOne;
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: blue">public</span>
            <span style="COLOR: blue">partial</span>
            <span style="COLOR: blue">class</span>
            <span style="COLOR: #2b91af">_Default</span> :
System.Web.UI.<span style="COLOR: #2b91af">Page</span></p>
          <p style="MARGIN: 0px">
{
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">protected</span><span style="COLOR: blue">void</span> Page_Load(<span style="COLOR: blue">object</span> sender, <span style="COLOR: #2b91af">EventArgs</span> e)
</p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        txtName.Text = <span style="COLOR: #a31515">"Manish
Kumar Singh"</span>;
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
    <span style="COLOR: blue">protected</span><span style="COLOR: blue">void</span> btnSubmit_Click(<span style="COLOR: blue">object</span> sender, <span style="COLOR: #2b91af">EventArgs</span> e)
</p>
          <p style="MARGIN: 0px">
    {
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">var</span> p = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">Person</span> {FullName
= txtName.Text, Gender = ddlGender.SelectedValue};
</p>
          <p style="MARGIN: 0px">
 
</p>
          <p style="MARGIN: 0px">
        <span style="COLOR: blue">var</span> proxy = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">MyServiceClient</span>();
</p>
          <p style="MARGIN: 0px">
        lblResult.Text = proxy.Callme(p);
</p>
          <p style="MARGIN: 0px">
    }
</p>
          <p style="MARGIN: 0px">
}
</p>
        </div>
        <p>
That's it. Now run the consumer site and give it a try. 
</p>
        <p>
Enjoy!<br />
Manish 
</p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=6b8c0b2a-12af-4142-9a2e-85defc09db3d" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Getting Started with WCF</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,6b8c0b2a-12af-4142-9a2e-85defc09db3d.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/05/17/GettingStartedWithWCF.aspx</link>
      <pubDate>Sun, 17 May 2009 17:42:17 GMT</pubDate>
      <description>&lt;h3&gt;WCF Kick Start
&lt;/h3&gt;
&lt;p&gt;
In this article I would be describing the simplest form of WCF (&lt;a href="http://en.wikipedia.org/wiki/Windows_Communication_Foundation" target=_blank&gt;Windows
Communication Foundation&lt;/a&gt;) project which would get you started with the WCF concepts
and best practices. The purpose is to minimise the confusion&amp;nbsp;from code and configuration&amp;nbsp;and
explain the&amp;nbsp;idea along with&amp;nbsp;the best practice.&amp;nbsp;I would also provide
description and links to help you move to a more advanced WCF topics as and when required. 
&lt;/p&gt;
&lt;p&gt;
For the sake of kick start I would be using &lt;code&gt;basicHttpBinding&lt;/code&gt; for the
service and consumer, which does not require any kind of authentication when accessing
the service. It is kind of open to all. 
&lt;/p&gt;
&lt;p&gt;
Below is an overall image of the solution, projects and project files that I have
used to demonstrate the simplest form of WCF implementation. 
&lt;/p&gt;
&lt;table cellspacing=4 cellpadding=4 width="100%" border=0&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign=top align=left&gt;
&lt;img height=536 alt=solution src="http://manishsingh.net/blogs/shared/solutionwcf.jpg" width=272&gt; 
&lt;/td&gt;
&lt;td valign=top align=left&gt;
&lt;p&gt;
The solution contains a project &lt;code&gt;WcfServiceOne&lt;/code&gt; which defines types for
contracts exposed by the service. The person class is the data contract, &lt;code&gt;MyService&lt;/code&gt; is
the service and &lt;code&gt;IMyService&lt;/code&gt; is an interface acting as a service contract.
This project acts as an API for the services. 
&lt;/p&gt;
&lt;p&gt;
The &lt;code&gt;ServiceOneHost&lt;/code&gt; is the service exposed to the client. It references
the project &lt;code&gt;WcfServiceOne&lt;/code&gt; which the actual implementation of the Service
as an API. Though, I could have had the service implementation written in the same
project, I preferred following the best practices, by implementing the Service and
Service API (contracts and its implementation) in a separate project. One advantage
of doing this is that, you have decoupled service and Service API, which simplifies
using the API in a non-WCF environment by directly referencing it. The &lt;code&gt;web.config&lt;/code&gt; file
in this project contains the binding information for the service which I will be explaining
later in this article. 
&lt;/p&gt;
&lt;p&gt;
The &lt;code&gt;ServiceOneConsumer&lt;/code&gt; is a simple ASP.Net web application consuming
the service exposed by &lt;code&gt;ServiceOneHost&lt;/code&gt;. The &lt;code&gt;web.config&lt;/code&gt; in
this web application contains the binding information defined by the host. 
&lt;/p&gt;
&lt;h3&gt;WcfServiceOne
&lt;/h3&gt;
&lt;p&gt;
WcfServiceOne project contains: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Data Contract - &lt;code&gt;Person.cs&lt;/code&gt; 
&lt;li&gt;
Service Contract - &lt;code&gt;IMyService.cs&lt;/code&gt; 
&lt;li&gt;
Service Implementation - &lt;code&gt;IMyService.cs&lt;/code&gt; 
&lt;/li&gt;
&lt;/ul&gt;
Also notice that the project references &lt;code&gt;System.ServiceModel&lt;/code&gt; and &lt;code&gt;System.Runtime.Serialization&lt;/code&gt; which
are required to assign attributes like &lt;code&gt;ServiceContract&lt;/code&gt;, &lt;code&gt;OperationContract&lt;/code&gt;, &lt;code&gt;DataContract&lt;/code&gt; and &lt;code&gt;DataMember&lt;/code&gt;. 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Person.cs
&lt;/h3&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Runtime.Serialization;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; WcfServiceOne
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="COLOR: #2b91af"&gt;DataContract&lt;/span&gt;]
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;class&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Person&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="COLOR: #2b91af"&gt;DataMember&lt;/span&gt;]
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; FullName
{ &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;set&lt;/span&gt;; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="COLOR: #2b91af"&gt;DataMember&lt;/span&gt;]
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Gender
{ &lt;span style="COLOR: blue"&gt;get&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;set&lt;/span&gt;; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;IMyService.cs
&lt;/h3&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.ServiceModel;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; WcfServiceOne
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="COLOR: #2b91af"&gt;ServiceContract&lt;/span&gt;]
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;interface&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;IMyService&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="COLOR: #2b91af"&gt;OperationContract&lt;/span&gt;]
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Callme(&lt;span style="COLOR: #2b91af"&gt;Person&lt;/span&gt; p);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;MyService
&lt;/h3&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; WcfServiceOne
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;class&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;MyService&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;IMyService&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Callme(&lt;span style="COLOR: #2b91af"&gt;Person&lt;/span&gt; p)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;"Hello
"&lt;/span&gt; + p.FullName + &lt;span style="COLOR: #a31515"&gt;"&amp;nbsp; "&lt;/span&gt; + &lt;span style="COLOR: #a31515"&gt;"
you are a "&lt;/span&gt; + p.Gender;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;ServiceOneHost
&lt;/h3&gt;
&lt;p&gt;
Add a reference to &lt;code&gt;WcfServiceOne&lt;/code&gt; and then right click on the project.
Select "Add New Item" from the context menu and select "WCF Service" templates. Name
the new file &lt;code&gt;ServiceOneHost.svc&lt;/code&gt;. The template would also create the code
files for you in the App_Code folder. You can delete it, the code file is not required.
Open the &lt;code&gt;ServiceOneHost.svc&lt;/code&gt; and change the line to: 
&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="BACKGROUND: #ffee62"&gt;&amp;lt;%&lt;/span&gt; &lt;span style="COLOR: blue"&gt;@&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;ServiceHost&lt;/span&gt; &lt;span style="COLOR: red"&gt;Language&lt;/span&gt; &lt;span style="COLOR: blue"&gt;="C#"&lt;/span&gt; &lt;span style="COLOR: red"&gt;Debug&lt;/span&gt; &lt;span style="COLOR: blue"&gt;="true"&lt;/span&gt; &lt;span style="COLOR: red"&gt;Service&lt;/span&gt; &lt;span style="COLOR: blue"&gt;="WcfServiceOne.MyService"&lt;/span&gt; &lt;span style="BACKGROUND: #ffee62"&gt;%&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
Now open the &lt;code&gt;web.config&lt;/code&gt; file in this project and add the following block
at the last within the closing of &lt;code&gt;configuration&lt;/code&gt; tag. 
&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;system.serviceModel&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;behaviors&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;serviceBehaviors&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;behavior&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;ServiceOneHostBehavior&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;serviceMetadata&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;httpGetEnabled&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;serviceDebug&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;includeExceptionDetailInFaults&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;behavior&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;serviceBehaviors&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;behaviors&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;services&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;service&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;behaviorConfiguration&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;ServiceOneHostBehavior&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfServiceOne.MyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;endpoint&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;address&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;""&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;basicHttpBinding&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;contract&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfServiceOne.IMyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;identity&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;dns&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;value&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;localhost&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;identity&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;endpoint&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;endpoint&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;address&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;mex&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;mexHttpBinding&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;contract&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;IMetadataExchange&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;service&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;services&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;system.serviceModel&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;code&gt;system.servicemodel&lt;/code&gt;tag defines how the consumer is going to connect to
the service exposed here. When you add a "WCF service" to the project using template,
it responds with adding the above &lt;code&gt;system.servicemodel&lt;/code&gt; in the &lt;code&gt;web.config&lt;/code&gt;,
except the following two lines. 
&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;service&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;behaviorConfiguration&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;ServiceOneHostBehavior&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfServiceOne.MyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;endpoint&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;address&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;""&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;basicHttpBinding&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;contract&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfServiceOne.IMyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
Change the name, contract and binding information as shown above. The &lt;code&gt;wsHttpBinding&lt;/code&gt; is
used to provide more secured communication using certificate. Visit &lt;a href="http://www.codeplex.com/WCFSecurity" target=_blank&gt;The
pattern and practices for WCF security&lt;/a&gt; at &lt;a href="http://www.codeplex.com" target=_blank&gt;Codeplex&lt;/a&gt; for
further guidance on how to implement &lt;code&gt;wsHttpBinding&lt;/code&gt; using certificates. 
&lt;/p&gt;
&lt;h3&gt;ServiceOneConsumer
&lt;/h3&gt;
&lt;p&gt;
Before you proceed with consumer, you need to generate a proxy for the service and
define how it connects, in the &lt;code&gt;web.config&lt;/code&gt; file. To generate the proxy
and the configuration block we would use &lt;code&gt;svcutil&lt;/code&gt;. Open the Visual studio
command prompt from Visual Studio Tools and use the following command to generate
the proxy and configuration. 
&lt;br&gt;
&lt;br&gt;
&lt;code&gt;svcutil http://localhost/ServiceOneHost/ServiceOneHost.svc /Language:C# /out:ServiceHostProxy.cs
/config:ServiceHost.config &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
This will create a &lt;code&gt;ServiceHostProxy.cs&lt;/code&gt; and &lt;code&gt;ServiceHost.config&lt;/code&gt;.
Open the &lt;code&gt;ServiceHost.config&lt;/code&gt; and copy the block. Now open the &lt;code&gt;web.config&lt;/code&gt; file
and paste the block at the end before the closing tag of &lt;code&gt;configuration&lt;/code&gt;.
The endpoint address might differ depending your host and consumer address URL. 
&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;system.serviceModel&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;bindings&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;basicHttpBinding&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;binding&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;BasicHttpBinding_IMyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;closeTimeout&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;00:01:00&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;openTimeout&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;00:01:00&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;receiveTimeout&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;00:10:00&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;sendTimeout&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;00:01:00&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;allowCookies&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;bypassProxyOnLocal&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;hostNameComparisonMode&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;StrongWildcard&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;maxBufferSize&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;65536&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;maxBufferPoolSize&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;524288&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;maxReceivedMessageSize&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;65536&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;messageEncoding&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;Text&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;textEncoding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;utf-8&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;transferMode&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;Buffered&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;useDefaultWebProxy&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;readerQuotas&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;maxDepth&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;32&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;maxStringContentLength&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;8192&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;maxArrayLength&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;16384&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;maxBytesPerRead&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;4096&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;maxNameTableCharCount&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;16384&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;security&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;mode&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;None&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;transport&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;clientCredentialType&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;None&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;proxyCredentialType&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;None&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;realm&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;""&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;message&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;clientCredentialType&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;UserName&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;algorithmSuite&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;Default&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;security&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;binding&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;basicHttpBinding&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;bindings&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;client&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;endpoint&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;address&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;http://localhost/ServiceOneHost/ServiceOneHost.svc&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;binding&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;basicHttpBinding&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;bindingConfiguration&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;BasicHttpBinding_IMyService&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;contract&lt;/span&gt; &lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;IMyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;BasicHttpBinding_IMyService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;client&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;system.serviceModel&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;Default.aspx
&lt;/h3&gt;
&lt;p&gt;
Now add the following UI in the home page of your consumer site. In this case it is &lt;code&gt;Default.aspx&lt;/code&gt;. 
&lt;/p&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;table&lt;/span&gt; &lt;span style="COLOR: red"&gt;style&lt;/span&gt; &lt;span style="COLOR: blue"&gt;="&lt;/span&gt; &lt;span style="COLOR: red"&gt;width&lt;/span&gt;: &lt;span style="COLOR: blue"&gt;400px&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&lt;/span&gt;&lt;span style="COLOR: red"&gt;cellspacing&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="0"&lt;/span&gt;&lt;span style="COLOR: red"&gt;cellpadding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="0"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="&lt;/span&gt;&lt;span style="COLOR: red"&gt;width&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;100px&lt;/span&gt;; &lt;span style="COLOR: red"&gt;vertical-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;top&lt;/span&gt;; &lt;span style="COLOR: red"&gt;text-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;left&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Your Name
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="&lt;/span&gt;&lt;span style="COLOR: red"&gt;width&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;10px&lt;/span&gt;; &lt;span style="COLOR: red"&gt;vertical-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;top&lt;/span&gt;; &lt;span style="COLOR: red"&gt;text-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;left&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; :
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="&lt;/span&gt;&lt;span style="COLOR: red"&gt;width&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;290px&lt;/span&gt;; &lt;span style="COLOR: red"&gt;vertical-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;top&lt;/span&gt;; &lt;span style="COLOR: red"&gt;text-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;left&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: red"&gt;ID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="txtName"&lt;/span&gt;&lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: red"&gt;Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="200"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="&lt;/span&gt;&lt;span style="COLOR: red"&gt;vertical-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;top&lt;/span&gt;; &lt;span style="COLOR: red"&gt;text-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;left&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Gender
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="&lt;/span&gt;&lt;span style="COLOR: red"&gt;vertical-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;top&lt;/span&gt;; &lt;span style="COLOR: red"&gt;text-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;left&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; :
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;style&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="&lt;/span&gt;&lt;span style="COLOR: red"&gt;vertical-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;top&lt;/span&gt;; &lt;span style="COLOR: red"&gt;text-align&lt;/span&gt;:&lt;span style="COLOR: blue"&gt;left&lt;/span&gt;;&lt;span style="COLOR: blue"&gt;"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;DropDownList&lt;/span&gt;&lt;span style="COLOR: red"&gt;ID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="ddlGender"&lt;/span&gt;&lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ListItem&lt;/span&gt;&lt;span style="COLOR: red"&gt;Selected&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="True"&lt;/span&gt;&lt;span style="COLOR: red"&gt;Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Male"&lt;/span&gt;&lt;span style="COLOR: red"&gt;Value&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="male"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;ListItem&lt;/span&gt;&lt;span style="COLOR: red"&gt;Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Female"&lt;/span&gt;&lt;span style="COLOR: red"&gt;Value&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="female"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;DropDownList&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Button&lt;/span&gt;&lt;span style="COLOR: red"&gt;ID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="btnSubmit"&lt;/span&gt;&lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: red"&gt;Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Submit"&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: red"&gt;onclick&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="btnSubmit_Click"&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: red"&gt;colspan&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="3"&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;br&lt;/span&gt;&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Label&lt;/span&gt;&lt;span style="COLOR: red"&gt;ID&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="lblResult"&lt;/span&gt;&lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: red"&gt;Text&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=""&lt;/span&gt;&lt;span style="COLOR: red"&gt;Font-Bold&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="true"&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: red"&gt;Font-Size&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="Large"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;asp&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;Label&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;td&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;tr&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt; &lt;span style="COLOR: #a31515"&gt;table&lt;/span&gt; &lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; 
&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;Default.aspx.cs - Code Behind
&lt;/h3&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; WcfServiceOne;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;_Default&lt;/span&gt; :
System.Web.UI.&lt;span style="COLOR: #2b91af"&gt;Page&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;protected&lt;/span&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Page_Load(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt; e)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; txtName.Text = &lt;span style="COLOR: #a31515"&gt;"Manish
Kumar Singh"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;protected&lt;/span&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt; btnSubmit_Click(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt; e)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; p = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Person&lt;/span&gt; {FullName
= txtName.Text, Gender = ddlGender.SelectedValue};
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; proxy = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;MyServiceClient&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; lblResult.Text = proxy.Callme(p);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
That's it. Now run the consumer site and give it a try. 
&lt;/p&gt;
&lt;p&gt;
Enjoy!&lt;br&gt;
Manish 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=6b8c0b2a-12af-4142-9a2e-85defc09db3d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,6b8c0b2a-12af-4142-9a2e-85defc09db3d.aspx</comments>
      <category>.Net</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=95f55377-81cc-429d-8fe7-c0965514456f</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,95f55377-81cc-429d-8fe7-c0965514456f.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,95f55377-81cc-429d-8fe7-c0965514456f.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=95f55377-81cc-429d-8fe7-c0965514456f</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h3>It was a Dream
</h3>
        <p>
Sometimes a dream seems so neat and well formed in its set of events and story line
up, that it makes one feel like a creative writer. Though, I am nowhere near to good
novel and creative writers, I hope the beauty of this story would appeal to the readers. 
</p>
        <p>
This was a dream that has nothing to do with my real life, but still had a lot of
steam in its story and hidden meaning. This is my first write-up for the same and
I would try to bring it very near to what I dreamt and how I felt while seeing it.
I hope I would be able to generate the same enthusiasm and excitement going ahead. 
</p>
        <p>
Even though, I was playing the role of main character in my dreams, feeling every
part of the emotions gushing through his nerves, in real life, I didn't have any resemblance
to the face, background, nature or story of the character. It is more like as if,
I got attached to this character at a different dimension of time and space (for few
hours), feeling his inner realm without him noticing it. It is like as if, I stayed
as a host inside that character for some time sharing every piece of his thoughts
and emotions. The only thing I know better is it was not me still it was me. 
</p>
        <p>
Hence, let’s replace the name to say “John”, and let me take you to meet John, his
emotions, thoughts and his story. 
</p>
        <br />
        <h3>John!
</h3>
        <p>
John was in his teenage happily living with his family. The family consisted of his
father, mother and an elder sister. Everyone in his family was an earning member employed.
John was the only one studying. In his general routines, he used to spend the first
half of the day at his college nearby, and then the rest, either playing basketball
with local friends, or staying back at home doing some studies. He really cherished
the great moments spent together with his family, and eagerly waited for them to return.
John’s dressing sense was like many other teens, wearing rugged jeans, t-shirt and
his favorite red cap having the letter “J” embroidered on the front. He used to wear
it front-side-back. 
</p>
        <p>
John and his family stayed in a beautiful city with a lot of greenery and beautiful
weather. Let me describe the place I visited in my dreams. Let me show you what I
saw. It was a beautiful city having mountain ranges on one side, hazily visible, with
peaks touching the sky. It was a pleasant weather, generally found in cities located
near to major mountain ranges. It was not a place with high rise buildings. In fact
it was a wide open area with condos located at a good 200-300 meter distance from
each other. The area had an uneven slope (common near hilly areas), nicely covered
with evenly cut grass and trees planted randomly all over. It did not seem to be a
crowded place, an area with a small population but well designed and clean. It seemed
it was a time of autumn when I visited the place in my dreams, though in realty it
was winter. The fallen yellow leaves all over the place, including roads supported
my assumption of less traffic here. It was a windy day as well. 
</p>
        <p>
There was a big common play ground at half a mile on left of John’s house. It was
a good hangout for John and his friends. It was the only place where I saw a little
crowd. Children playing outdoor sports, people walking or simply time passing. It
had a basketball court where John used to play with his friends. Located further ahead
of the play ground, maybe another half a mile was a church, clearly visible from John’s
house. As what I read from the illegally invaded thoughts of John, was that a graveyard
was also located behind the church. 
</p>
        <br />
        <h3>Memories
</h3>
        <p>
It was the last working day of the weekend. At 1 pm, John was eagerly waiting for
the last class to get over - the math class. It was not common for John to feel gloomy,
especially in his math classes, which was his favorite subject. He was blaming it
to the weather and his not-so-good night sleep. He was having hard time concentrating
in the class, while his mind today was wandering more on the philosophical side. Memories
from past were dominating his present. Some childhood games, he used to play, the
kind of comics he used to read, how preciously, he used to keep those comics in the
drawer, places he remembered, the things of his childhood, precious memories of friends
and family get together, all this were hovering inside his head, one after another
like several movie clips knitted into a sequence. 
</p>
        <p>
His mind was wandering in his past while his eyes were looking outside the classroom
window where some kids were playing near a tree located few meters away. Those kids
were playing with the fallen leaves, arranging them on the ground to form an art work
like house, tree, animal and other nice things. One of the kids had scribbled a word
out of those fallen leaves. It read “Happy Birthday”. Seeing, this John’s mind started
knitting the memories of his birthdays he had enjoyed the most. Then suddenly he remembered
the date today – It felt like an important day, it appeared as a day, having some
event associated with it. “Was it someone’s birthday?” …. “Something, forgotten falls
on this day”. John was trying hard to remember, but somehow, he was not able to recollect
any event associated with this date. Yet the date was hovering like a feeling of Déjàvu.
The shadows of past memory had now stopped disturbing him and the date had taken its
place. John was now randomly picking up his family, friends and relatives to figure
out whether today was associated to any of these people. 
</p>
        <p>
The class had ended and his colleagues were all packing up their bags. John too started
packing his bag and wishing his friends. One of his friends had probably noticed his
state of absence in the class. Peter came to John and enquired – “Hey John, something
wrong? You seem a bit disturbed today.” “Oh no, nothing serious”, replied John. They
walked out of the class together while John explained him about his mood swing and
past memories. Soon, they were on the street and walking towards home. John’s house
was just a mile away and he preferred walk down. Peter usually accompanied John, till
the nearby bus stop, from where he used to take a bus to his house. 
</p>
        <p>
After Peter had left, John started walking down towards his house. On his way to home,
and, even while he was talking to Peter, his mind was busy figuring out any event
associate with today. He was sure that today was some important day, and he was trying
hard to remember any event associated to this day. The feeling of Déjàvu was strong
yet the answer seemed far away. 
</p>
        <br />
        <h3>Déjàvu
</h3>
        <p>
After arriving home John threw his bag on his bed and picked up the TV remote to watch
some of his favorite channels. He pushed himself into a comfortable couch in front
of the television and started playing with the remote. John was glad to find a sports
channel showing a basket ball tournament. John made himself comfortable, almost in
a lying position, concentrating on the match. The match kept him glued to the television
till it ended in a tie. It was a great match, the game was now over and the commentator
was uttering his final speech. Before, ending his speech the commentator revealed
that the captains of both teams were a childhood friends and also, one of the captain
was having his birthday anniversary today. On hearing this, the Dejavu effect again
engulfed John’s thought and he started thinking about event that slipped out of his
mind. For few minutes, he concentrated hard thinking about it, but in vain, no auspicious
event he could memorize had a date today. Then he stopped thinking about it and planned
to visit his friends for some refreshment and game at the playground. 
</p>
        <p>
John reached the playground and found three of his friends already practicing basket
ball. John was greeted with warmth and he joined them. He stayed there for an hour
chatting and playing, then decided to go back home. Then suddenly, it clicked to him,
and he asked his friends – By the way! … any Birthday today? I mean do you guys remember
today as any important day? They looked puzzled, and then answered in chorus – No,
Nope, Why? John knew they could not remember any important event for today and thus
confused, so he said – Just a thought, forget it – and then left for his home. 
</p>
        <p>
On his way back he saw a person selling flowers on the roadside. He had not seen that
person selling flowers before, here in this place. John kept walking looking at the
person, who noticed his attention, and greeted him – Sir, any occasion today, would
you like to buy some flowers; they are fresh, handpicked! - John was caught in a bit
of surprise, by the coincidences happening one after another, that seemed like pointing
to something that he was unable to remember. 
</p>
        <p>
It was now getting on his nerves, something inside his head was clearly indicating
him that today was special, but it was like pondering in dark, as he had no clue about
the event, its type and whether good or bad. The Dejavu effect felt stronger now,
the birthday written with leaf, birthday of the basketball team captain and now this
person selling flower asking him to buy few for an occasion. 
</p>
        <p>
Something urged John to buy some flowers and he followed his urge. He bought some
flowers and headed to his home. 
</p>
        <br />
        <h3>Revelation
</h3>
        <p>
John kept the flowers on the table and went to bathroom for a shower. After a hot
bath, John felt more relaxed, though he was still wondering about the incidents. It
was already 5 pm now and, he had no clue of any event today. He looked at the flowers
while combing his hairs, as if these flowers might help him to find another clue,
or solve the mystery for him. He did not want to act like a crazy asking people about
any event today, just because he was experiencing a strong force of Dejavu. But, the
day was about to end and soon it would be all over, which made him more impatient.
He was thinking about ways that can help, in revealing the Dejavu effect. At the same
time he did not want to push things beyond logical explanation, making a fool out
of himself. Finally, John decided to give up and stop thinking on the issue. He went
to the kitchen to make some sandwiches for himself. 
</p>
        <p>
It took him just a few minutes to get the grilled vegetable sandwich ready. He took
the sandwich on a plate and came back to his room. He again sat on his couch watching
television and enjoying his sandwich. He had switched on a channel showing the top
number songs. It was an old Phil Collins number playing on the screen “Another day
in paradise…”. John had listened to his song many a times before, and liked it. He
started singing along in a low voice trying to match the words and tune. John remembered
he had performed the same song in school and had received a flower vase as prize for
a good performance. His eyes instantly went to the flowers he had kept on the table,
and then he stood up and headed towards the store room, where he remembered he had
kept his precious belongings – the flower vase too. His whole day spent roaming in
the past and now looking at his belongings were pretty exciting for him. He wanted
to see and cherish few of his memories which had gripped him since morning. 
</p>
        <p>
The store room was small with lot of things stuffed and piled inside. It was untidy
with dust filled all over. Most of the things were John’s childhood possessions. John’s
eyes started searching for the most probable place for the vase. His eyes went to
a box, which was of the size of vase. John immediately recognized it – it was the
vase he had received as a prize. John reached for the vase but, it had other thing
piled upon it. John was careful about taking it out without disturbing the balance
of other items on the top. John almost succeeded except one thing that fell from the
top when he brought out the vase. It was an old album containing photographs. John
stared at the album lying beside his feet filled with dust, quiet old, but he remembered
it. It was his precious procession, and a time to go back into the past. He picked
it up and kept looking at it for a while, then saw up from where it had fallen. Probably,
it had touched his heart. He brought it, along with the vase and cleaned the dust.
After keeping the flowers in the vase, John sat in his couch with his album on his
lap. 
</p>
        <p>
John turned the page and saw young John in a school dress smiling at him. His memories
started sketching scenes he remembered about the photograph and his school. He turned
to next photograph, which was a group photograph of all his class mates and teachers.
He kept looking at the photographs with his finger touching every person in the photograph.
His mind was helping him to regenerate the live moving images of these persons. Suddenly,
his finger stopped at a boy – Steve, his best friend. Steve and he were the one who
had sung this song in school. Steve had also received the same prize. They had spent
a real good time together. In most of the games and plays he was either his partner
or rival of equal potential. Steve was always there to help, whether study or play.
They had even childishly decided to opt for same school, same job and even same city
when they grow up. Unfortunately, Steve had not kept his promises - he had left him
alone and moved to a different world. It was the sample place, same city, John was
still there but Steve had left. John remembered how bad he felt when he heard about
Steve’s demise. It was an unfortunate accident, which had taken Steve away. He remembered
putting flowers on his grave and promising that he would never forget the friendship
and Steve. It had been seven years now, without Steve. 
</p>
        <p>
Suddenly, John jumped out of his couch - the album fell from his lap on the floor.
He was now feeling guilty, he had actually forgotten his promise and not only that,
the Dejavu effect was now very clear to him, it was his birthday today – Steve’s birthday.
The circumstance, past and the clues were all clear and revealed. 
</p>
        <p>
The “Happy Birthday”, with the fallen leaves<br />
The two childhood friends playing basket ball as a rival team captains.<br />
The man selling flowers, the same flowers that he had kept on Steve’s grave.<br /></p>
        <p>
But how was this happening to him, how come the coincidences matched so well, how
can it be logically explained, why was he feeling not-so-good in the college today. 
</p>
        <p>
John was guilty, confused and surprised all at the same time. Lot of emotions were
exchanging hands at the same time, increasing his breathing speed. 
</p>
        <p>
John decided to go to his grave behind the church. It was 6 pm by now; it would take
him around 20 minutes to reach there. He quickly, dressed up, grabbed the flower and
ran to the door. 
</p>
        <br />
        <h3>Forget Me Not
</h3>
        <p>
It was windy evening; the sun had already set, but it was still not dark yet. There
were multiple graves lying in peace, very silent and calm. The sound of wind was loud
and clear. 
</p>
        <p>
John was standing in front of Steve’s grave - his eyes were glimmering with water.
He was thinking about the good times and emotions he had shared with his best friend.
He wanted to ask Steve, why he left and remind his promise. On the other hand his
mature mind was telling him, it is not possible – Steve has gone, gone forever – But,
then why these coincidences, clues and Dejavu. Was it not Steve, who was trying to
remind me of my promise? Why did birthday appeared so many times in front of me, Why
was I feeling gloomy today, Why did I bought flowers today, Why did I thought of the
Vase today – the vase, which we had received as a prize together, Why did the album
fell today – Was it not Steve’s attempt to remind me my promise made at his grave?
Was it really a coincidence and so many of them together? John, was so confused and
affected by the Dejavu effect, that he softly spoke to Steve’s grave – Steve was it
you, did you try to remind me, are you there? There was no reply, John new there won’t
be any. 
</p>
        <p>
After spending some time there – praying for Steve – John decided to go back home.
It was already late and the sky was quiet dark now. John remembered, his family members
would be arriving anytime now, and would get worried not finding him at home. John
kept the flowers on the stone and after giving it a last soft look, turned around.
Suddenly, he felt, a paper fluttering sound behind, he turned again and saw an old
and dusty greeting card stuck on the cross of Steve’s grave making the fluttering
sound due to the wind, causing its edges to strike on the cross. 
</p>
        <p>
John slowly picked up the card removing it from the cross and saw a sketch of two
cute little children embracing each other. It was a friendship card. John was amazed,
and started looking everywhere to see where the card came from. There was no one around.
Can this be another coincidence? He then slowly, with trembling fingers, turned the
card, which had no name but a one liner printed in bold calligraphy “FORGET ME NOT”! 
</p>
        <p>
This was the instance when I woke up and the story ended right there. But I got up
remembering each and every scenes. I decided to blog it, since it was too precious
to loose or forget. 
</p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=95f55377-81cc-429d-8fe7-c0965514456f" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Beautiful Dream</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,95f55377-81cc-429d-8fe7-c0965514456f.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/05/16/BeautifulDream.aspx</link>
      <pubDate>Sat, 16 May 2009 09:16:59 GMT</pubDate>
      <description>&lt;h3&gt;It was a Dream
&lt;/h3&gt;
&lt;p&gt;
Sometimes a dream seems so neat and well formed in its set of events and story line
up, that it makes one feel like a creative writer. Though, I am nowhere near to good
novel and creative writers, I hope the beauty of this story would appeal to the readers. 
&lt;/p&gt;
&lt;p&gt;
This was a dream that has nothing to do with my real life, but still had a lot of
steam in its story and hidden meaning. This is my first write-up for the same and
I would try to bring it very near to what I dreamt and how I felt while seeing it.
I hope I would be able to generate the same enthusiasm and excitement going ahead. 
&lt;/p&gt;
&lt;p&gt;
Even though, I was playing the role of main character in my dreams, feeling every
part of the emotions gushing through his nerves, in real life, I didn't have any resemblance
to the face, background, nature or story of the character. It is more like as if,
I got attached to this character at a different dimension of time and space (for few
hours), feeling his inner realm without him noticing it. It is like as if, I stayed
as a host inside that character for some time sharing every piece of his thoughts
and emotions. The only thing I know better is it was not me still it was me. 
&lt;/p&gt;
&lt;p&gt;
Hence, let’s replace the name to say “John”, and let me take you to meet John, his
emotions, thoughts and his story. 
&lt;/p&gt;
&lt;br&gt;
&lt;h3&gt;John!
&lt;/h3&gt;
&lt;p&gt;
John was in his teenage happily living with his family. The family consisted of his
father, mother and an elder sister. Everyone in his family was an earning member employed.
John was the only one studying. In his general routines, he used to spend the first
half of the day at his college nearby, and then the rest, either playing basketball
with local friends, or staying back at home doing some studies. He really cherished
the great moments spent together with his family, and eagerly waited for them to return.
John’s dressing sense was like many other teens, wearing rugged jeans, t-shirt and
his favorite red cap having the letter “J” embroidered on the front. He used to wear
it front-side-back. 
&lt;/p&gt;
&lt;p&gt;
John and his family stayed in a beautiful city with a lot of greenery and beautiful
weather. Let me describe the place I visited in my dreams. Let me show you what I
saw. It was a beautiful city having mountain ranges on one side, hazily visible, with
peaks touching the sky. It was a pleasant weather, generally found in cities located
near to major mountain ranges. It was not a place with high rise buildings. In fact
it was a wide open area with condos located at a good 200-300 meter distance from
each other. The area had an uneven slope (common near hilly areas), nicely covered
with evenly cut grass and trees planted randomly all over. It did not seem to be a
crowded place, an area with a small population but well designed and clean. It seemed
it was a time of autumn when I visited the place in my dreams, though in realty it
was winter. The fallen yellow leaves all over the place, including roads supported
my assumption of less traffic here. It was a windy day as well. 
&lt;/p&gt;
&lt;p&gt;
There was a big common play ground at half a mile on left of John’s house. It was
a good hangout for John and his friends. It was the only place where I saw a little
crowd. Children playing outdoor sports, people walking or simply time passing. It
had a basketball court where John used to play with his friends. Located further ahead
of the play ground, maybe another half a mile was a church, clearly visible from John’s
house. As what I read from the illegally invaded thoughts of John, was that a graveyard
was also located behind the church. 
&lt;/p&gt;
&lt;br&gt;
&lt;h3&gt;Memories
&lt;/h3&gt;
&lt;p&gt;
It was the last working day of the weekend. At 1 pm, John was eagerly waiting for
the last class to get over - the math class. It was not common for John to feel gloomy,
especially in his math classes, which was his favorite subject. He was blaming it
to the weather and his not-so-good night sleep. He was having hard time concentrating
in the class, while his mind today was wandering more on the philosophical side. Memories
from past were dominating his present. Some childhood games, he used to play, the
kind of comics he used to read, how preciously, he used to keep those comics in the
drawer, places he remembered, the things of his childhood, precious memories of friends
and family get together, all this were hovering inside his head, one after another
like several movie clips knitted into a sequence. 
&lt;/p&gt;
&lt;p&gt;
His mind was wandering in his past while his eyes were looking outside the classroom
window where some kids were playing near a tree located few meters away. Those kids
were playing with the fallen leaves, arranging them on the ground to form an art work
like house, tree, animal and other nice things. One of the kids had scribbled a word
out of those fallen leaves. It read “Happy Birthday”. Seeing, this John’s mind started
knitting the memories of his birthdays he had enjoyed the most. Then suddenly he remembered
the date today – It felt like an important day, it appeared as a day, having some
event associated with it. “Was it someone’s birthday?” …. “Something, forgotten falls
on this day”. John was trying hard to remember, but somehow, he was not able to recollect
any event associated with this date. Yet the date was hovering like a feeling of Déjàvu.
The shadows of past memory had now stopped disturbing him and the date had taken its
place. John was now randomly picking up his family, friends and relatives to figure
out whether today was associated to any of these people. 
&lt;/p&gt;
&lt;p&gt;
The class had ended and his colleagues were all packing up their bags. John too started
packing his bag and wishing his friends. One of his friends had probably noticed his
state of absence in the class. Peter came to John and enquired – “Hey John, something
wrong? You seem a bit disturbed today.” “Oh no, nothing serious”, replied John. They
walked out of the class together while John explained him about his mood swing and
past memories. Soon, they were on the street and walking towards home. John’s house
was just a mile away and he preferred walk down. Peter usually accompanied John, till
the nearby bus stop, from where he used to take a bus to his house. 
&lt;/p&gt;
&lt;p&gt;
After Peter had left, John started walking down towards his house. On his way to home,
and, even while he was talking to Peter, his mind was busy figuring out any event
associate with today. He was sure that today was some important day, and he was trying
hard to remember any event associated to this day. The feeling of Déjàvu was strong
yet the answer seemed far away. 
&lt;/p&gt;
&lt;br&gt;
&lt;h3&gt;Déjàvu
&lt;/h3&gt;
&lt;p&gt;
After arriving home John threw his bag on his bed and picked up the TV remote to watch
some of his favorite channels. He pushed himself into a comfortable couch in front
of the television and started playing with the remote. John was glad to find a sports
channel showing a basket ball tournament. John made himself comfortable, almost in
a lying position, concentrating on the match. The match kept him glued to the television
till it ended in a tie. It was a great match, the game was now over and the commentator
was uttering his final speech. Before, ending his speech the commentator revealed
that the captains of both teams were a childhood friends and also, one of the captain
was having his birthday anniversary today. On hearing this, the Dejavu effect again
engulfed John’s thought and he started thinking about event that slipped out of his
mind. For few minutes, he concentrated hard thinking about it, but in vain, no auspicious
event he could memorize had a date today. Then he stopped thinking about it and planned
to visit his friends for some refreshment and game at the playground. 
&lt;/p&gt;
&lt;p&gt;
John reached the playground and found three of his friends already practicing basket
ball. John was greeted with warmth and he joined them. He stayed there for an hour
chatting and playing, then decided to go back home. Then suddenly, it clicked to him,
and he asked his friends – By the way! … any Birthday today? I mean do you guys remember
today as any important day? They looked puzzled, and then answered in chorus – No,
Nope, Why? John knew they could not remember any important event for today and thus
confused, so he said – Just a thought, forget it – and then left for his home. 
&lt;/p&gt;
&lt;p&gt;
On his way back he saw a person selling flowers on the roadside. He had not seen that
person selling flowers before, here in this place. John kept walking looking at the
person, who noticed his attention, and greeted him – Sir, any occasion today, would
you like to buy some flowers; they are fresh, handpicked! - John was caught in a bit
of surprise, by the coincidences happening one after another, that seemed like pointing
to something that he was unable to remember. 
&lt;/p&gt;
&lt;p&gt;
It was now getting on his nerves, something inside his head was clearly indicating
him that today was special, but it was like pondering in dark, as he had no clue about
the event, its type and whether good or bad. The Dejavu effect felt stronger now,
the birthday written with leaf, birthday of the basketball team captain and now this
person selling flower asking him to buy few for an occasion. 
&lt;/p&gt;
&lt;p&gt;
Something urged John to buy some flowers and he followed his urge. He bought some
flowers and headed to his home. 
&lt;/p&gt;
&lt;br&gt;
&lt;h3&gt;Revelation
&lt;/h3&gt;
&lt;p&gt;
John kept the flowers on the table and went to bathroom for a shower. After a hot
bath, John felt more relaxed, though he was still wondering about the incidents. It
was already 5 pm now and, he had no clue of any event today. He looked at the flowers
while combing his hairs, as if these flowers might help him to find another clue,
or solve the mystery for him. He did not want to act like a crazy asking people about
any event today, just because he was experiencing a strong force of Dejavu. But, the
day was about to end and soon it would be all over, which made him more impatient.
He was thinking about ways that can help, in revealing the Dejavu effect. At the same
time he did not want to push things beyond logical explanation, making a fool out
of himself. Finally, John decided to give up and stop thinking on the issue. He went
to the kitchen to make some sandwiches for himself. 
&lt;/p&gt;
&lt;p&gt;
It took him just a few minutes to get the grilled vegetable sandwich ready. He took
the sandwich on a plate and came back to his room. He again sat on his couch watching
television and enjoying his sandwich. He had switched on a channel showing the top
number songs. It was an old Phil Collins number playing on the screen “Another day
in paradise…”. John had listened to his song many a times before, and liked it. He
started singing along in a low voice trying to match the words and tune. John remembered
he had performed the same song in school and had received a flower vase as prize for
a good performance. His eyes instantly went to the flowers he had kept on the table,
and then he stood up and headed towards the store room, where he remembered he had
kept his precious belongings – the flower vase too. His whole day spent roaming in
the past and now looking at his belongings were pretty exciting for him. He wanted
to see and cherish few of his memories which had gripped him since morning. 
&lt;/p&gt;
&lt;p&gt;
The store room was small with lot of things stuffed and piled inside. It was untidy
with dust filled all over. Most of the things were John’s childhood possessions. John’s
eyes started searching for the most probable place for the vase. His eyes went to
a box, which was of the size of vase. John immediately recognized it – it was the
vase he had received as a prize. John reached for the vase but, it had other thing
piled upon it. John was careful about taking it out without disturbing the balance
of other items on the top. John almost succeeded except one thing that fell from the
top when he brought out the vase. It was an old album containing photographs. John
stared at the album lying beside his feet filled with dust, quiet old, but he remembered
it. It was his precious procession, and a time to go back into the past. He picked
it up and kept looking at it for a while, then saw up from where it had fallen. Probably,
it had touched his heart. He brought it, along with the vase and cleaned the dust.
After keeping the flowers in the vase, John sat in his couch with his album on his
lap. 
&lt;/p&gt;
&lt;p&gt;
John turned the page and saw young John in a school dress smiling at him. His memories
started sketching scenes he remembered about the photograph and his school. He turned
to next photograph, which was a group photograph of all his class mates and teachers.
He kept looking at the photographs with his finger touching every person in the photograph.
His mind was helping him to regenerate the live moving images of these persons. Suddenly,
his finger stopped at a boy – Steve, his best friend. Steve and he were the one who
had sung this song in school. Steve had also received the same prize. They had spent
a real good time together. In most of the games and plays he was either his partner
or rival of equal potential. Steve was always there to help, whether study or play.
They had even childishly decided to opt for same school, same job and even same city
when they grow up. Unfortunately, Steve had not kept his promises - he had left him
alone and moved to a different world. It was the sample place, same city, John was
still there but Steve had left. John remembered how bad he felt when he heard about
Steve’s demise. It was an unfortunate accident, which had taken Steve away. He remembered
putting flowers on his grave and promising that he would never forget the friendship
and Steve. It had been seven years now, without Steve. 
&lt;/p&gt;
&lt;p&gt;
Suddenly, John jumped out of his couch - the album fell from his lap on the floor.
He was now feeling guilty, he had actually forgotten his promise and not only that,
the Dejavu effect was now very clear to him, it was his birthday today – Steve’s birthday.
The circumstance, past and the clues were all clear and revealed. 
&lt;/p&gt;
&lt;p&gt;
The “Happy Birthday”, with the fallen leaves&lt;br&gt;
The two childhood friends playing basket ball as a rival team captains.&lt;br&gt;
The man selling flowers, the same flowers that he had kept on Steve’s grave.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
But how was this happening to him, how come the coincidences matched so well, how
can it be logically explained, why was he feeling not-so-good in the college today. 
&lt;/p&gt;
&lt;p&gt;
John was guilty, confused and surprised all at the same time. Lot of emotions were
exchanging hands at the same time, increasing his breathing speed. 
&lt;/p&gt;
&lt;p&gt;
John decided to go to his grave behind the church. It was 6 pm by now; it would take
him around 20 minutes to reach there. He quickly, dressed up, grabbed the flower and
ran to the door. 
&lt;/p&gt;
&lt;br&gt;
&lt;h3&gt;Forget Me Not
&lt;/h3&gt;
&lt;p&gt;
It was windy evening; the sun had already set, but it was still not dark yet. There
were multiple graves lying in peace, very silent and calm. The sound of wind was loud
and clear. 
&lt;/p&gt;
&lt;p&gt;
John was standing in front of Steve’s grave - his eyes were glimmering with water.
He was thinking about the good times and emotions he had shared with his best friend.
He wanted to ask Steve, why he left and remind his promise. On the other hand his
mature mind was telling him, it is not possible – Steve has gone, gone forever – But,
then why these coincidences, clues and Dejavu. Was it not Steve, who was trying to
remind me of my promise? Why did birthday appeared so many times in front of me, Why
was I feeling gloomy today, Why did I bought flowers today, Why did I thought of the
Vase today – the vase, which we had received as a prize together, Why did the album
fell today – Was it not Steve’s attempt to remind me my promise made at his grave?
Was it really a coincidence and so many of them together? John, was so confused and
affected by the Dejavu effect, that he softly spoke to Steve’s grave – Steve was it
you, did you try to remind me, are you there? There was no reply, John new there won’t
be any. 
&lt;/p&gt;
&lt;p&gt;
After spending some time there – praying for Steve – John decided to go back home.
It was already late and the sky was quiet dark now. John remembered, his family members
would be arriving anytime now, and would get worried not finding him at home. John
kept the flowers on the stone and after giving it a last soft look, turned around.
Suddenly, he felt, a paper fluttering sound behind, he turned again and saw an old
and dusty greeting card stuck on the cross of Steve’s grave making the fluttering
sound due to the wind, causing its edges to strike on the cross. 
&lt;/p&gt;
&lt;p&gt;
John slowly picked up the card removing it from the cross and saw a sketch of two
cute little children embracing each other. It was a friendship card. John was amazed,
and started looking everywhere to see where the card came from. There was no one around.
Can this be another coincidence? He then slowly, with trembling fingers, turned the
card, which had no name but a one liner printed in bold calligraphy “FORGET ME NOT”! 
&lt;/p&gt;
&lt;p&gt;
This was the instance when I woke up and the story ended right there. But I got up
remembering each and every scenes. I decided to blog it, since it was too precious
to loose or forget. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=95f55377-81cc-429d-8fe7-c0965514456f" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,95f55377-81cc-429d-8fe7-c0965514456f.aspx</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=1188f9ae-1236-4ea1-b5eb-2153b20c29d8</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,1188f9ae-1236-4ea1-b5eb-2153b20c29d8.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,1188f9ae-1236-4ea1-b5eb-2153b20c29d8.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=1188f9ae-1236-4ea1-b5eb-2153b20c29d8</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In this section I would like to demonstrate how to compile a .NET code on the fly.
The code has been written in C#. It contains a class "InlineParser" which does the
main job. It mainly, defines the class, does in-memory compilation and exposes a method
for the execution of an inner method defined in the class. It also supports a choice
of language whether C# or VB.NET for compilation. 
</p>
        <div style="PADDING-LEFT: 15px; FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; PADDING-BOTTOM: 15px; COLOR: black; PADDING-TOP: 15px; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    1</span> <span style="COLOR: blue">using</span> System;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    2</span> <span style="COLOR: blue">using</span> System.Collections.Generic;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    3</span> <span style="COLOR: blue">using</span> System.Linq;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    4</span> <span style="COLOR: blue">using</span> System.Text;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    5</span> <span style="COLOR: blue">using</span> Microsoft.CSharp;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    6</span> <span style="COLOR: blue">using</span> Microsoft.VisualBasic;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    7</span> <span style="COLOR: blue">using</span> System.CodeDom.Compiler;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    8</span> <span style="COLOR: blue">using</span> System.Reflection;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">    9</span> <span style="COLOR: blue">using</span> System.Xml.Linq;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   10</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   11</span> <span style="COLOR: blue">namespace</span> com.eforceglobal.crux.bre
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   12</span> {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   13</span>     <span style="COLOR: blue">internal</span><span style="COLOR: blue">class</span><span style="COLOR: #2b91af">InlineParser</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   14</span>     {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   15</span>         <span style="COLOR: blue">string</span> expression
= <span style="COLOR: blue">string</span>.Empty;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   16</span>         <span style="COLOR: blue">string</span> functionArguments
= <span style="COLOR: blue">string</span>.Empty;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   17</span>         <span style="COLOR: blue">string</span> language
= <span style="COLOR: #a31515">"CSharp"</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   18</span>         <span style="COLOR: #2b91af">XDocument</span> paramList
= <span style="COLOR: blue">null</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   19</span>         <span style="COLOR: blue">object</span> objBase
= <span style="COLOR: blue">null</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   20</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   21</span>         <span style="COLOR: blue">public</span> InlineParser(<span style="COLOR: blue">string</span> expr, <span style="COLOR: blue">string</span> functionArgs, <span style="COLOR: #2b91af">XDocument</span> parameters, <span style="COLOR: blue">string</span> lang)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   22</span>        
{
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   23</span>        
    expression = expr;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   24</span>        
    functionArguments = functionArgs;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   25</span>        
    paramList = parameters;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   26</span>        
    language = lang;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   27</span>        
}
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   28</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   29</span>         <span style="COLOR: blue">public</span><span style="COLOR: blue">bool</span> init()
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   30</span>        
{
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   31</span>        
    <span style="COLOR: blue">if</span>(language.ToLower().Equals(<span style="COLOR: #a31515">"csharp"</span>))
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   32</span>        
        <span style="COLOR: blue">return</span> InitCSharp();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   33</span>        
    <span style="COLOR: blue">else</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   34</span>        
        <span style="COLOR: blue">return</span> InitVB();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   35</span>        
}
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   36</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   37</span>         <span style="COLOR: blue">internal</span><span style="COLOR: blue">bool</span> InitCSharp()
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   38</span>        
{
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   39</span>        
    <span style="COLOR: green">// Compile the expression in a class
on the fly</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   40</span>        
    <span style="COLOR: #2b91af">CSharpCodeProvider</span> cp = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">CSharpCodeProvider</span>( 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   41</span>        
        <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">Dictionary</span>&lt;<span style="COLOR: blue">string</span>, <span style="COLOR: blue">string</span>&gt;()
{ { <span style="COLOR: #a31515">"CompilerVersion"</span>, <span style="COLOR: #a31515">"v3.5"</span> }
} );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   42</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   43</span>        
    <span style="COLOR: green">//ICodeCompiler ic = cp.CreateCompiler();</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   44</span>        
    <span style="COLOR: #2b91af">CompilerParameters</span> cparam = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">CompilerParameters</span>();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   45</span>        
    cparam.GenerateInMemory = <span style="COLOR: blue">true</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   46</span>        
    cparam.GenerateExecutable = <span style="COLOR: blue">false</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   47</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   48</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   49</span>        
    <span style="COLOR: green">// Reference Assembly</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   50</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"system.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   51</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"mscorlib.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   52</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"System.Core.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   53</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"System.Xml.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   54</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"System.Xml.Linq.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   55</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   56</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   57</span>        
    <span style="COLOR: green">// Write your code</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   58</span>        
    <span style="COLOR: #2b91af">StringBuilder</span> sb = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">StringBuilder</span>();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   59</span>        
    sb.Append( <span style="COLOR: #a31515">"using System;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   60</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Collections;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   61</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Collections.Generic;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   62</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Text;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   63</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Text.RegularExpressions;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   64</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Reflection;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   65</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Linq;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   66</span>        
    sb.Append( <span style="COLOR: #a31515">"using System.Xml.Linq;\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   67</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   68</span>        
    sb.Append( <span style="COLOR: #a31515">"namespace com.eforceglobal.crux.bre
{\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   69</span>        
    sb.Append( <span style="COLOR: #a31515">"public class EvalClass
{\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   70</span>        
    sb.Append( <span style="COLOR: #a31515">"public EvalClass(){}\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   71</span>        
    sb.Append( <span style="COLOR: #a31515">"public object Evaluate(\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   72</span>        
    sb.Append( functionArguments ).Append( <span style="COLOR: #a31515">"
) {\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   73</span>        
    sb.Append( expression ).Append(<span style="COLOR: #a31515">"\n"</span>);
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   74</span>        
    sb.Append( <span style="COLOR: #a31515">"}\n}\n}"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   75</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   76</span>        
    <span style="COLOR: green">//Console.WriteLine( sb.ToString() );</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   77</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   78</span>        
    <span style="COLOR: blue">string</span> code = sb.ToString();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   79</span>        
    <span style="COLOR: #2b91af">CompilerResults</span> cres = cp.CompileAssemblyFromSource(
cparam, code );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   80</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   81</span>        
    <span style="COLOR: green">// Compilation Unsuccessfull </span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   82</span>        
    <span style="COLOR: #2b91af">StringBuilder</span> errors = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">StringBuilder</span>();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   83</span>        
    <span style="COLOR: blue">foreach</span> ( <span style="COLOR: #2b91af">CompilerError</span> cerr <span style="COLOR: blue">in</span> cres.Errors
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   84</span>        
        errors.Append( cerr.ErrorText );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   85</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   86</span>        
    <span style="COLOR: blue">if</span> ( cres.Errors.Count &gt; 0
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   87</span>        
        <span style="COLOR: blue">throw</span><span style="COLOR: blue">new</span><span style="COLOR: #2b91af">Exception</span>(
errors.ToString() );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   88</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   89</span>        
    <span style="COLOR: green">// Compilation Successfull</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   90</span>        
    <span style="COLOR: blue">if</span> ( cres.Errors.Count == 0 &amp;&amp;
cres.CompiledAssembly != <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   91</span>        
    {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   92</span>        
        <span style="COLOR: #2b91af">Type</span> ClsObj
= cres.CompiledAssembly.GetType( <span style="COLOR: #a31515">"com.eforceglobal.crux.bre.EvalClass"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   93</span>        
        <span style="COLOR: blue">try</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   94</span>        
        {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   95</span>        
            <span style="COLOR: blue">if</span> (
ClsObj != <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   96</span>        
            {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   97</span>        
                objBase
= <span style="COLOR: #2b91af">Activator</span>.CreateInstance( ClsObj );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   98</span>        
            }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">   99</span>        
        }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  100</span>        
        <span style="COLOR: blue">catch</span> ( <span style="COLOR: #2b91af">Exception</span> ex
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  101</span>        
        {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  102</span>        
            <span style="COLOR: blue">throw</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  103</span>        
        }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  104</span>        
        <span style="COLOR: blue">return</span><span style="COLOR: blue">true</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  105</span>        
    }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  106</span>        
    <span style="COLOR: blue">else</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  107</span>        
        <span style="COLOR: blue">return</span><span style="COLOR: blue">false</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  108</span>        
}
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  109</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  110</span>         <span style="COLOR: blue">internal</span><span style="COLOR: blue">bool</span> InitVB()
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  111</span>        
{
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  112</span>        
    <span style="COLOR: green">// Compile the expression in a class
on the fly</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  113</span>        
    <span style="COLOR: #2b91af">VBCodeProvider</span> vb = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">VBCodeProvider</span>( 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  114</span>        
        <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">Dictionary</span>&lt;<span style="COLOR: blue">string</span>, <span style="COLOR: blue">string</span>&gt;()
{ { <span style="COLOR: #a31515">"CompilerVersion"</span>, <span style="COLOR: #a31515">"v3.5"</span> }
} );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  115</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  116</span>        
    <span style="COLOR: green">//ICodeCompiler ic = cp.CreateCompiler();</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  117</span>        
    <span style="COLOR: #2b91af">CompilerParameters</span> cparam = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">CompilerParameters</span>();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  118</span>        
    cparam.GenerateInMemory = <span style="COLOR: blue">true</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  119</span>        
    cparam.GenerateExecutable = <span style="COLOR: blue">false</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  120</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  121</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  122</span>        
    <span style="COLOR: green">// Reference Assembly</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  123</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"system.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  124</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"mscorlib.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  125</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"System.Core.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  126</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"System.Xml.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  127</span>        
    cparam.ReferencedAssemblies.Add( <span style="COLOR: #a31515">"System.Xml.Linq.dll"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  128</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  129</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  130</span>        
    <span style="COLOR: green">// Write your code</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  131</span>        
    <span style="COLOR: #2b91af">StringBuilder</span> sb = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">StringBuilder</span>();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  132</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  133</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Collections\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  134</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Collections.Generic\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  135</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Text\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  136</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Text.RegularExpressions\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  137</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Reflection\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  138</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Linq\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  139</span>        
    sb.Append( <span style="COLOR: #a31515">"Imports System.Xml.Linq\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  140</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  141</span>        
    sb.Append( <span style="COLOR: #a31515">"Namespace com.eforceglobal.crux.bre
\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  142</span>        
    sb.Append( <span style="COLOR: #a31515">"Public Class EvalClass
\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  143</span>        
    sb.Append( <span style="COLOR: #a31515">"Public Function Evaluate
( "</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  144</span>        
    sb.Append( functionArguments ).Append(<span style="COLOR: #a31515">"
) As Object\n"</span>);
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  145</span>        
    sb.Append( expression ).Append( <span style="COLOR: #a31515">"\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  146</span>        
    sb.Append( <span style="COLOR: #a31515">"End Function\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  147</span>        
    sb.Append( <span style="COLOR: #a31515">"End Class\n"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  148</span>        
    sb.Append( <span style="COLOR: #a31515">"End Namespace"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  149</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  150</span>        
    <span style="COLOR: green">//Console.WriteLine( sb.ToString() );</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  151</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  152</span>        
    <span style="COLOR: blue">string</span> code = sb.ToString();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  153</span>        
    <span style="COLOR: #2b91af">CompilerResults</span> cres = vb.CompileAssemblyFromSource(
cparam, code );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  154</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  155</span>        
    <span style="COLOR: green">// Compilation Unsuccessfull </span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  156</span>        
    <span style="COLOR: #2b91af">StringBuilder</span> errors = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">StringBuilder</span>();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  157</span>        
    <span style="COLOR: blue">foreach</span> ( <span style="COLOR: #2b91af">CompilerError</span> cerr <span style="COLOR: blue">in</span> cres.Errors
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  158</span>        
        errors.Append( cerr.ErrorText );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  159</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  160</span>        
    <span style="COLOR: blue">if</span> ( cres.Errors.Count &gt; 0
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  161</span>        
        <span style="COLOR: blue">throw</span><span style="COLOR: blue">new</span><span style="COLOR: #2b91af">Exception</span>(
errors.ToString() );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  162</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  163</span>        
    <span style="COLOR: green">// Compilation Successfull</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  164</span>        
    <span style="COLOR: blue">if</span> ( cres.Errors.Count == 0 &amp;&amp;
cres.CompiledAssembly != <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  165</span>        
    {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  166</span>        
        <span style="COLOR: #2b91af">Type</span> ClsObj
= cres.CompiledAssembly.GetType( <span style="COLOR: #a31515">"com.eforceglobal.crux.bre.EvalClass"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  167</span>        
        <span style="COLOR: blue">try</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  168</span>        
        {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  169</span>        
            <span style="COLOR: blue">if</span> (
ClsObj != <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  170</span>        
            {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  171</span>        
                objBase
= <span style="COLOR: #2b91af">Activator</span>.CreateInstance( ClsObj );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  172</span>        
            }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  173</span>        
        }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  174</span>        
        <span style="COLOR: blue">catch</span> ( <span style="COLOR: #2b91af">Exception</span> ex
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  175</span>        
        {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  176</span>        
            <span style="COLOR: blue">throw</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  177</span>        
        }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  178</span>        
        <span style="COLOR: blue">return</span><span style="COLOR: blue">true</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  179</span>        
    }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  180</span>        
    <span style="COLOR: blue">else</span></p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  181</span>        
        <span style="COLOR: blue">return</span><span style="COLOR: blue">false</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  182</span>        
}
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  183</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  184</span>         <span style="COLOR: blue">public</span><span style="COLOR: blue">string</span> Evaluate()
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  185</span>        
{
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  186</span>        
    <span style="COLOR: blue">string</span> result = <span style="COLOR: blue">string</span>.Empty;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  187</span>        
    <span style="COLOR: #2b91af">Type</span> type = objBase.GetType();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  188</span>        
    <span style="COLOR: #2b91af">MethodInfo</span> mInfo = type.GetMethod( <span style="COLOR: #a31515">"Evaluate"</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  189</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  190</span>        
    <span style="COLOR: blue">if</span> ( mInfo != <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  191</span>        
    {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  192</span>        
        <span style="COLOR: #2b91af">ParameterInfo</span>[]
pInfo = mInfo.GetParameters();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  193</span>        
        <span style="COLOR: blue">object</span>[] arguments
= <span style="COLOR: blue">null</span>;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  194</span>        
        <span style="COLOR: blue">if</span>(pInfo!=<span style="COLOR: blue">null</span>)
arguments = <span style="COLOR: blue">new</span><span style="COLOR: blue">object</span>[pInfo.Length];
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  195</span>        
        <span style="COLOR: blue">if</span> ( pInfo
!= <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  196</span>        
        {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  197</span>        
            <span style="COLOR: blue">foreach</span>(<span style="COLOR: #2b91af">ParameterInfo</span> p <span style="COLOR: blue">in</span> pInfo
)
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  198</span>        
                <span style="COLOR: blue">if</span> (
paramList.Element( <span style="COLOR: #a31515">"arguments"</span> ).Elements( p.Name
) != <span style="COLOR: blue">null</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  199</span>        
                {
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  200</span>        
                   
arguments[p.Position] = (paramList.Element( <span style="COLOR: #a31515">"arguments"</span> )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  201</span>        
                   
    .Elements( p.Name ).Single().Value);
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  202</span>        
                }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  203</span>        
            <span style="COLOR: blue">if</span> (
pInfo.Length != arguments.Length )
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  204</span>        
                <span style="COLOR: blue">throw</span><span style="COLOR: blue">new</span><span style="COLOR: #2b91af">ArgumentException</span>( <span style="COLOR: #a31515">"Insufficient
parameters."</span> );
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  205</span>        
        }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  206</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  207</span>        
        result = mInfo.Invoke( objBase, arguments ).ToString();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  208</span>        
    }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  209</span> 
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  210</span>        
    <span style="COLOR: blue">return</span> result;
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  211</span>        
}
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  212</span>     }
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  213</span> }
</p>
        </div>
        <p>
          <font size="2">Notice that the class name of the class to be compiled is "EvalClass"
and the inner method of the class is "Evaluate". Calling the "Evaluate()" method requires
you to execute the following lines of code.</font>
        </p>
        <div style="PADDING-LEFT: 15px; FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; PADDING-BOTTOM: 15px; COLOR: black; PADDING-TOP: 15px; FONT-FAMILY: Courier New">
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  1</span> <span style="COLOR: blue">var</span> parser
= <span style="COLOR: blue">new</span><span style="COLOR: #2b91af">InlineParser</span>(subExpression,
funcArgs, Arguments.Document, lang);
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  2</span> parser.init();
</p>
          <p style="MARGIN: 0px">
            <span style="COLOR: #2b91af">  3</span> retString = parser.Evaluate();
</p>
        </div>
        <p>
Manish
</p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=1188f9ae-1236-4ea1-b5eb-2153b20c29d8" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Compile .NET code on the fly</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,1188f9ae-1236-4ea1-b5eb-2153b20c29d8.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/05/09/CompileNETCodeOnTheFly.aspx</link>
      <pubDate>Sat, 09 May 2009 06:21:03 GMT</pubDate>
      <description>&lt;p&gt;
In this section I would like to demonstrate how to compile a .NET code on the fly.
The code has been written in C#. It contains a class "InlineParser" which does the
main job. It mainly, defines the class, does in-memory compilation and exposes a method
for the execution of an inner method defined in the class. It also supports a choice
of language whether C# or VB.NET for compilation. 
&lt;/p&gt;
&lt;div style="PADDING-LEFT: 15px; FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; PADDING-BOTTOM: 15px; COLOR: black; PADDING-TOP: 15px; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Linq;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Text;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; Microsoft.CSharp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; Microsoft.VisualBasic;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.CodeDom.Compiler;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Reflection;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;using&lt;/span&gt; System.Xml.Linq;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;namespace&lt;/span&gt; com.eforceglobal.crux.bre
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;internal&lt;/span&gt;&lt;span style="COLOR: blue"&gt;class&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;InlineParser&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; expression
= &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.Empty;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; functionArguments
= &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.Empty;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; language
= &lt;span style="COLOR: #a31515"&gt;"CSharp"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;XDocument&lt;/span&gt; paramList
= &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;object&lt;/span&gt; objBase
= &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; InlineParser(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; expr, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; functionArgs, &lt;span style="COLOR: #2b91af"&gt;XDocument&lt;/span&gt; parameters, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; lang)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; expression = expr;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; functionArguments = functionArgs;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; paramList = parameters;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; language = lang;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; init()
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt;(language.ToLower().Equals(&lt;span style="COLOR: #a31515"&gt;"csharp"&lt;/span&gt;))
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; InitCSharp();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;else&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; InitVB();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;internal&lt;/span&gt;&lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; InitCSharp()
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Compile the expression in a class
on the fly&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;CSharpCodeProvider&lt;/span&gt; cp = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;CSharpCodeProvider&lt;/span&gt;( 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;()
{ { &lt;span style="COLOR: #a31515"&gt;"CompilerVersion"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"v3.5"&lt;/span&gt; }
} );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//ICodeCompiler ic = cp.CreateCompiler();&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;CompilerParameters&lt;/span&gt; cparam = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;CompilerParameters&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.GenerateInMemory = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.GenerateExecutable = &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Reference Assembly&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"system.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;51&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"mscorlib.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;52&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"System.Core.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;53&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"System.Xml.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;54&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"System.Xml.Linq.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;55&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;56&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;57&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Write your code&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;58&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;59&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;60&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Collections;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;61&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Collections.Generic;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;62&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Text;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;63&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Text.RegularExpressions;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;64&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Reflection;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;65&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Linq;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;66&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"using System.Xml.Linq;\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;67&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;68&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"namespace com.eforceglobal.crux.bre
{\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;69&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"public class EvalClass
{\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;70&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"public EvalClass(){}\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;71&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"public object Evaluate(\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;72&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( functionArguments ).Append( &lt;span style="COLOR: #a31515"&gt;"
) {\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;73&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( expression ).Append(&lt;span style="COLOR: #a31515"&gt;"\n"&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;74&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"}\n}\n}"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;75&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;76&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//Console.WriteLine( sb.ToString() );&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;77&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;78&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; code = sb.ToString();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;79&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;CompilerResults&lt;/span&gt; cres = cp.CompileAssemblyFromSource(
cparam, code );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;80&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;81&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Compilation Unsuccessfull &lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;82&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt; errors = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;83&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt; ( &lt;span style="COLOR: #2b91af"&gt;CompilerError&lt;/span&gt; cerr &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; cres.Errors
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;84&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; errors.Append( cerr.ErrorText );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;85&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;86&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ( cres.Errors.Count &amp;gt; 0
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;87&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt;(
errors.ToString() );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;88&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;89&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Compilation Successfull&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;90&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ( cres.Errors.Count == 0 &amp;amp;&amp;amp;
cres.CompiledAssembly != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;91&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;92&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Type&lt;/span&gt; ClsObj
= cres.CompiledAssembly.GetType( &lt;span style="COLOR: #a31515"&gt;"com.eforceglobal.crux.bre.EvalClass"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;93&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;try&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;94&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;95&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (
ClsObj != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;96&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;97&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; objBase
= &lt;span style="COLOR: #2b91af"&gt;Activator&lt;/span&gt;.CreateInstance( ClsObj );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;98&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;99&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;100&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;catch&lt;/span&gt; ( &lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt; ex
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;101&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;102&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;103&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;104&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;105&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;106&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;else&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;107&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;108&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;109&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;110&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;internal&lt;/span&gt;&lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; InitVB()
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;111&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;112&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Compile the expression in a class
on the fly&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;113&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;VBCodeProvider&lt;/span&gt; vb = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;VBCodeProvider&lt;/span&gt;( 
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;114&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;()
{ { &lt;span style="COLOR: #a31515"&gt;"CompilerVersion"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"v3.5"&lt;/span&gt; }
} );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;115&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;116&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//ICodeCompiler ic = cp.CreateCompiler();&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;117&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;CompilerParameters&lt;/span&gt; cparam = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;CompilerParameters&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;118&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.GenerateInMemory = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;119&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.GenerateExecutable = &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;120&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;121&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;122&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Reference Assembly&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;123&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"system.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;124&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"mscorlib.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;125&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"System.Core.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;126&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"System.Xml.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;127&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cparam.ReferencedAssemblies.Add( &lt;span style="COLOR: #a31515"&gt;"System.Xml.Linq.dll"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;128&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;129&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;130&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Write your code&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;131&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;132&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;133&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Collections\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;134&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Collections.Generic\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;135&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Text\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;136&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Text.RegularExpressions\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;137&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Reflection\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;138&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Linq\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;139&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Imports System.Xml.Linq\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;140&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;141&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Namespace com.eforceglobal.crux.bre
\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;142&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Public Class EvalClass
\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;143&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"Public Function Evaluate
( "&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;144&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( functionArguments ).Append(&lt;span style="COLOR: #a31515"&gt;"
) As Object\n"&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;145&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( expression ).Append( &lt;span style="COLOR: #a31515"&gt;"\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;146&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"End Function\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;147&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"End Class\n"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;148&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append( &lt;span style="COLOR: #a31515"&gt;"End Namespace"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;149&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;150&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;//Console.WriteLine( sb.ToString() );&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;151&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;152&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; code = sb.ToString();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;153&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;CompilerResults&lt;/span&gt; cres = vb.CompileAssemblyFromSource(
cparam, code );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;154&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;155&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Compilation Unsuccessfull &lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;156&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt; errors = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;157&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt; ( &lt;span style="COLOR: #2b91af"&gt;CompilerError&lt;/span&gt; cerr &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; cres.Errors
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;158&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; errors.Append( cerr.ErrorText );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;159&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;160&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ( cres.Errors.Count &amp;gt; 0
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;161&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt;(
errors.ToString() );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;162&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;163&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: green"&gt;// Compilation Successfull&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;164&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ( cres.Errors.Count == 0 &amp;amp;&amp;amp;
cres.CompiledAssembly != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;165&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;166&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Type&lt;/span&gt; ClsObj
= cres.CompiledAssembly.GetType( &lt;span style="COLOR: #a31515"&gt;"com.eforceglobal.crux.bre.EvalClass"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;167&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;try&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;168&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;169&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (
ClsObj != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;170&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;171&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; objBase
= &lt;span style="COLOR: #2b91af"&gt;Activator&lt;/span&gt;.CreateInstance( ClsObj );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;172&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;173&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;174&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;catch&lt;/span&gt; ( &lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt; ex
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;175&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;176&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;177&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;178&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;179&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;180&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;else&lt;/span&gt;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;181&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;182&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;183&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;184&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Evaluate()
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;185&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;186&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; result = &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.Empty;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;187&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;Type&lt;/span&gt; type = objBase.GetType();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;188&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;MethodInfo&lt;/span&gt; mInfo = type.GetMethod( &lt;span style="COLOR: #a31515"&gt;"Evaluate"&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;189&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;190&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ( mInfo != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;191&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;192&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: #2b91af"&gt;ParameterInfo&lt;/span&gt;[]
pInfo = mInfo.GetParameters();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;193&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;object&lt;/span&gt;[] arguments
= &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;194&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt;(pInfo!=&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;)
arguments = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: blue"&gt;object&lt;/span&gt;[pInfo.Length];
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;195&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; ( pInfo
!= &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;196&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;197&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;ParameterInfo&lt;/span&gt; p &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; pInfo
)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;198&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (
paramList.Element( &lt;span style="COLOR: #a31515"&gt;"arguments"&lt;/span&gt; ).Elements( p.Name
) != &lt;span style="COLOR: blue"&gt;null&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;199&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;200&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
arguments[p.Position] = (paramList.Element( &lt;span style="COLOR: #a31515"&gt;"arguments"&lt;/span&gt; )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;201&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .Elements( p.Name ).Single().Value);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;202&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;203&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (
pInfo.Length != arguments.Length )
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;204&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ArgumentException&lt;/span&gt;( &lt;span style="COLOR: #a31515"&gt;"Insufficient
parameters."&lt;/span&gt; );
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;205&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;206&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;207&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; result = mInfo.Invoke( objBase, arguments ).ToString();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;208&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;209&lt;/span&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;210&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; result;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;211&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;212&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;213&lt;/span&gt;&amp;nbsp;}
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;font size=2&gt;Notice that the class name of the class to be compiled is "EvalClass"
and the inner method of the class is "Evaluate". Calling the "Evaluate()" method requires
you to execute the following lines of code.&lt;/font&gt; 
&lt;/p&gt;
&lt;div style="PADDING-LEFT: 15px; FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; PADDING-BOTTOM: 15px; COLOR: black; PADDING-TOP: 15px; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;1&lt;/span&gt;&amp;nbsp;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; parser
= &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;InlineParser&lt;/span&gt;(subExpression,
funcArgs, Arguments.Document, lang);
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;2&lt;/span&gt;&amp;nbsp;parser.init();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;3&lt;/span&gt; retString = parser.Evaluate();
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
Manish
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=1188f9ae-1236-4ea1-b5eb-2153b20c29d8" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,1188f9ae-1236-4ea1-b5eb-2153b20c29d8.aspx</comments>
      <category>.Net</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h3>Introduction 
</h3>
        <p>
          <img style="MARGIN-TOP: 0px; FLOAT: left; MARGIN-BOTTOM: 0px; MARGIN-RIGHT: 10px" height="129" alt="Microsoft Surface Touch Table" src="http://www.manishsingh.net/blogs/shared/surface/touchtable.jpg" width="163" />I
was hearing about <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a> far last few months, but did not get much information. Recently, I saw
a post "<a href="http://channel9.msdn.com/pdc2008/PC17/">PDC 2008</a>" by Robert Levy
and Brad Carpenter having a video session demonstrating the capabilities of Microsoft
Session. The demonstrate the unique attributes of <a href="http://en.wikipedia.org/wiki/Microsoft_Surface">Microsoft
Surface computing</a>, with a dive into vision-based object recognition and core controls
like ScatterView, and how the Surface SDK aligns with the multi-touch developer roadmap
for <a href="http://www.microsoft.com/windows/windows-7/">Windows 7</a> and <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a>.
The software giant has built a new touch screen computer — a coffee table that will
change the world. Forget the keyboard and mouse, the next generation of computer interfaces
will be <a href="http://en.wikipedia.org/wiki/Natural_User_Interface">NUI</a> (Natural
User Interface) which uses natural motions, hand gesture and real world physical objects.
The surface is capable of object recognition, object/finger orientation recognition
and tracking, and is multi-touch and is multi-user. Users can interact with the machine
by touching or dragging their fingertips and objects such as paintbrushes across the
screen, or by placing and moving placed objects. This paradigm of interaction with
computers is known as a natural user interface (<a href="http://en.wikipedia.org/wiki/Natural_User_Interface">NUI</a>).
Surface has been optimized to respond to 52 touches at a time. 
</p>
        <p>
          <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft Surface</a> applications
can be written in Windows Presentation Foundation (<a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a>)
and .Net language like C# or VB.Net. It is nicely integrated with Visual Studio 2008
following the same pattern of programming paradigms the .Net developers are used to.
However it has custom WPF controls to allow programming for the unique interface of
Surface. Developers already proficient in <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a> can
utilize the SDK to write Surface apps. 
</p>
        <table cellspacing="0" cellpadding="0" width="70%" align="center" border="0">
          <tbody>
            <tr>
              <td valign="top" align="middle">
                <img height="134" alt="Object Recognition" src="http://www.manishsingh.net/blogs/shared/surface/surface1.jpg" width="200" />
              </td>
              <td valign="top" align="middle">
                <img height="152" alt="Multi User Application" src="http://www.manishsingh.net/blogs/shared/surface/360deg.jpg" width="200" />
              </td>
            </tr>
          </tbody>
        </table>
        <h4>Microsoft Surface SDK 1.0 
</h4>
        <p>
Right now, <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft Surface</a> SDK
is not available for public. It has been distributed only to some of the <a href="http://www.microsoft.com/SURFACE/Find-a-Partner.aspx">Microsoft
partners</a>. I am eagerly waiting to get my hands on the SDK once it is launched.
Since, I have already worked with <a href="http://www.microsoft.com/SILVERLIGHT/">SilverLight</a> and <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a>,
I think, it would be quite easy to pick <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a>. This is true for every developer worked on <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a> and
used <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a>.
However, there is a small catch ... Working for surface would require more creativity
and unlearning the GUI which we are used to. The new interface requires us to think
about the UI from entirely a new perspective ... a 360 degree multi-touch perspective. 
</p>
        <p>
I am sure the developers deep in love with .NET programming and having high respect
for Microsoft Technologies, would be very excited after seeing the video session of <a href="http://channel9.msdn.com/pdc2008/PC17/">PDC
2008</a>. The features demonstrated, and the ease of programming together with seamless
process of learning would make you sit up staright on your seat, open <a href="http://www.google.com">Google</a> to
find out whether you can get hold of <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a> SDK. Hmm! As you might be thinking after watching the video, whether you
need the touch screen device which costs $10K-15K, to practice <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a>? The answer is No! Microsoft has a simulator for Surface which would allow
you to deploy and play around with your surface code. Unfortunately, that too is not
available to public right now. So you might have to wait a little more, until of course
you are working for the company included in the Microsoft's <a href="http://www.microsoft.com/SURFACE/Find-a-Partner.aspx">Partner
list</a>, currently allowed to download and use <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a> SDK and Simulator. 
</p>
        <h4>It Is Not Just Another Glorified And Hyped Touch Screen Computer 
</h4>
        <p>
Many had a wrong impression about <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a> thinking it to be another glorified and hyped touch screen computer. The
touch screen computers enable users to do away with keyboard and mouse. They can navigate
the menu by touching various options to reach a logical end of viewing data or printing.
And there ends the comparison. <a href="http://www.microsoft.com/surface/Default.aspx">Microsoft
Surface</a> device also known as Microsoft Tabletop can do many more things, which
you might think are not possible! 
</p>
        <p>
The three main components that differentiates it from a regular Touch-Screen device,
Direct interaction, Multi-Touch Contact and Object Recognition. 
</p>
        <table cellspacing="0" cellpadding="0" width="50%" align="center" border="0">
          <tbody>
            <tr>
              <td valign="top" align="middle" width="15%">
 </td>
              <td valign="top" align="middle">
                <img height="134" alt="Object Recognition" src="http://www.manishsingh.net/blogs/shared/surface/objectreg.jpg" width="200" />
              </td>
            </tr>
          </tbody>
        </table>
        <ul>
          <li>
            <b>Multi-touch contact:</b> User need not use only one finger to manage digital data.
If user dips five fingers in five different colors in the on screen paint palette
and draws five lines with five fingers, you get five lines with five colors . . . 
</li>
          <li>
            <b>Direct interaction:</b> Facility to manage digital information with hand gestures
and touch instead on mouse and keyboard. 
</li>
          <li>
            <b>Object Recognition:</b> This technology allows non-digital objects to be used as
input devices. This means that the input source does not necessarily have to be digital
in form. 
</li>
        </ul>
        <h4>This Is The Future 
</h4>
        <p>
Companies are putting in millions of dollar in research for <a href="http://en.wikipedia.org/wiki/Natural_User_Interface">NUI</a>.
There is a nice video "<a href="http://www.ted.com/index.php/talks/pattie_maes_demos_the_sixth_sense.html">TED:
Sixth Sense</a>" from Pattie Maes' lab at MIT, spearheaded by Pranav Mistry. It's
a wearable device with a projector that paves the way for profound interaction with
our environment. It demonstrates a device which responds to natural gestures of hand
which is read by a camera. The UI is developed and projected using a small projector
fitted in the same device. If you guys have seen movies like "Minority Report", see
these technologies nearing to the imaginations. 
</p>
        <p>
The <a href="http://en.wikipedia.org/wiki/Natural_User_Interface">NUI</a> immensely
increases interaction with digital contents in a more simplified manner. One does
not need to practice with mouse. It won't be a single user interface anymore. Two
users can open two different menus at the same time .... (Right now your application
would open one menu at a time). A 360 degree interaction, with each person using the
same application independently. Surely, we need to think and see the UI very differently
now and you are bound only by your imaginations. 
</p>
        <p>
So friend's start unlearning the GUI you are accustomed to, and buckle your seat
belts for the next gen -- <a href="http://en.wikipedia.org/wiki/Natural_User_Interface">NUI</a>. 
</p>
        <p>
Manish
</p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Microsoft Surface ... CLI to GUI and Now NUI (Natural User Interface)</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/03/29/MicrosoftSurfaceCLIToGUIAndNowNUINaturalUserInterface.aspx</link>
      <pubDate>Sun, 29 Mar 2009 09:26:22 GMT</pubDate>
      <description>&lt;h3&gt;Introduction 
&lt;/h3&gt;
&lt;p&gt;
&lt;img style="MARGIN-TOP: 0px; FLOAT: left; MARGIN-BOTTOM: 0px; MARGIN-RIGHT: 10px" height=129 alt="Microsoft Surface Touch Table" src="http://www.manishsingh.net/blogs/shared/surface/touchtable.jpg" width=163&gt;I
was hearing about &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt; far last few months, but did not get much information. Recently, I saw
a post "&lt;a href="http://channel9.msdn.com/pdc2008/PC17/"&gt;PDC 2008&lt;/a&gt;" by Robert Levy
and Brad Carpenter having a video session demonstrating the capabilities of Microsoft
Session. The demonstrate the unique attributes of &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Surface"&gt;Microsoft
Surface computing&lt;/a&gt;, with a dive into vision-based object recognition and core controls
like ScatterView, and how the Surface SDK aligns with the multi-touch developer roadmap
for &lt;a href="http://www.microsoft.com/windows/windows-7/"&gt;Windows 7&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt;.
The software giant has built a new touch screen computer — a coffee table that will
change the world. Forget the keyboard and mouse, the next generation of computer interfaces
will be &lt;a href="http://en.wikipedia.org/wiki/Natural_User_Interface"&gt;NUI&lt;/a&gt; (Natural
User Interface) which uses natural motions, hand gesture and real world physical objects.
The surface is capable of object recognition, object/finger orientation recognition
and tracking, and is multi-touch and is multi-user. Users can interact with the machine
by touching or dragging their fingertips and objects such as paintbrushes across the
screen, or by placing and moving placed objects. This paradigm of interaction with
computers is known as a natural user interface (&lt;a href="http://en.wikipedia.org/wiki/Natural_User_Interface"&gt;NUI&lt;/a&gt;).
Surface has been optimized to respond to 52 touches at a time. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft Surface&lt;/a&gt; applications
can be written in Windows Presentation Foundation (&lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt;)
and .Net language like C# or VB.Net. It is nicely integrated with Visual Studio 2008
following the same pattern of programming paradigms the .Net developers are used to.
However it has custom WPF controls to allow programming for the unique interface of
Surface. Developers already proficient in &lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt; can
utilize the SDK to write Surface apps. 
&lt;/p&gt;
&lt;table cellspacing=0 cellpadding=0 width="70%" align=center border=0&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign=top align=middle&gt;
&lt;img height=134 alt="Object Recognition" src="http://www.manishsingh.net/blogs/shared/surface/surface1.jpg" width=200&gt; 
&lt;/td&gt;
&lt;td valign=top align=middle&gt;
&lt;img height=152 alt="Multi User Application" src="http://www.manishsingh.net/blogs/shared/surface/360deg.jpg" width=200&gt; 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4&gt;Microsoft Surface SDK 1.0 
&lt;/h4&gt;
&lt;p&gt;
Right now, &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft Surface&lt;/a&gt; SDK
is not available for public. It has been distributed only to some of the &lt;a href="http://www.microsoft.com/SURFACE/Find-a-Partner.aspx"&gt;Microsoft
partners&lt;/a&gt;. I am eagerly waiting to get my hands on the SDK once it is launched.
Since, I have already worked with &lt;a href="http://www.microsoft.com/SILVERLIGHT/"&gt;SilverLight&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt;,
I think, it would be quite easy to pick &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt;. This is true for every developer worked on &lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt; and
used &lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;XAML&lt;/a&gt;.
However, there is a small catch ... Working for surface would require more creativity
and unlearning the GUI which we are used to. The new interface requires us to think
about the UI from entirely a new perspective ... a 360 degree multi-touch perspective. 
&lt;/p&gt;
&lt;p&gt;
I am sure the developers deep in love with .NET programming and having high respect
for Microsoft Technologies, would be very excited after seeing the video session of &lt;a href="http://channel9.msdn.com/pdc2008/PC17/"&gt;PDC
2008&lt;/a&gt;. The features demonstrated, and the ease of programming together with seamless
process of learning would make you sit up staright on your seat, open &lt;a href="http://www.google.com"&gt;Google&lt;/a&gt; to
find out whether you can get hold of &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt; SDK. Hmm! As you might be thinking after watching the video, whether you
need the touch screen device which costs $10K-15K, to practice &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt;? The answer is No! Microsoft has a simulator for Surface which would allow
you to deploy and play around with your surface code. Unfortunately, that too is not
available to public right now. So you might have to wait a little more, until of course
you are working for the company included in the Microsoft's&amp;nbsp;&lt;a href="http://www.microsoft.com/SURFACE/Find-a-Partner.aspx"&gt;Partner
list&lt;/a&gt;, currently allowed to download and use &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt; SDK and Simulator. 
&lt;/p&gt;
&lt;h4&gt;It Is Not Just Another Glorified And Hyped Touch Screen Computer 
&lt;/h4&gt;
&lt;p&gt;
Many had a wrong impression about &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt; thinking it to be another glorified and hyped touch screen computer. The
touch screen computers enable users to do away with keyboard and mouse. They can navigate
the menu by touching various options to reach a logical end of viewing data or printing.
And there ends the comparison. &lt;a href="http://www.microsoft.com/surface/Default.aspx"&gt;Microsoft
Surface&lt;/a&gt; device also known as Microsoft Tabletop can do many more things, which
you might think are not possible! 
&lt;/p&gt;
&lt;p&gt;
The three main components that differentiates it from a regular Touch-Screen device,
Direct interaction, Multi-Touch Contact and Object Recognition. 
&lt;/p&gt;
&lt;table cellspacing=0 cellpadding=0 width="50%" align=center border=0&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign=top align=middle width="15%"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;td valign=top align=middle&gt;
&lt;img height=134 alt="Object Recognition" src="http://www.manishsingh.net/blogs/shared/surface/objectreg.jpg" width=200&gt; 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;Multi-touch contact:&lt;/b&gt; User need not use only one finger to manage digital data.
If user dips five fingers in five different colors in the on screen paint palette
and draws five lines with five fingers, you get five lines with five colors . . . 
&lt;li&gt;
&lt;b&gt;Direct interaction:&lt;/b&gt; Facility to manage digital information with hand gestures
and touch instead on mouse and keyboard. 
&lt;li&gt;
&lt;b&gt;Object Recognition:&lt;/b&gt; This technology allows non-digital objects to be used as
input devices. This means that the input source does not necessarily have to be digital
in form. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;This Is The Future 
&lt;/h4&gt;
&lt;p&gt;
Companies are putting in millions of dollar in research for &lt;a href="http://en.wikipedia.org/wiki/Natural_User_Interface"&gt;NUI&lt;/a&gt;.
There is a nice video "&lt;a href="http://www.ted.com/index.php/talks/pattie_maes_demos_the_sixth_sense.html"&gt;TED:
Sixth Sense&lt;/a&gt;" from Pattie Maes' lab at MIT, spearheaded by Pranav Mistry. It's
a wearable device with a projector that paves the way for profound interaction with
our environment. It demonstrates a device which responds to natural gestures of hand
which is read by a camera. The UI is developed and projected using a small projector
fitted in the same device. If you guys have seen movies like "Minority Report", see
these technologies nearing to the imaginations. 
&lt;/p&gt;
&lt;p&gt;
The &lt;a href="http://en.wikipedia.org/wiki/Natural_User_Interface"&gt;NUI&lt;/a&gt; immensely
increases interaction with digital contents in a more simplified manner. One does
not need to practice with mouse. It won't be a single user interface anymore. Two
users can open two different menus at the same time .... (Right now your application
would open one menu at a time). A 360 degree interaction, with each person using the
same application independently. Surely, we need to think and see the UI very differently
now and you are bound only by your imaginations. 
&lt;/p&gt;
&lt;p&gt;
So friend's start unlearning the GUI you are accustomed&amp;nbsp;to, and buckle your seat
belts for the next gen --&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Natural_User_Interface"&gt;NUI&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Manish
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,40b0bd7e-a7f3-4fe8-b8f7-99c698b5c408.aspx</comments>
      <category>.Net</category>
      <category>Thoughts</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=277f2bd3-3f31-49e6-bb3c-1b9a5be56d71</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,277f2bd3-3f31-49e6-bb3c-1b9a5be56d71.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,277f2bd3-3f31-49e6-bb3c-1b9a5be56d71.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=277f2bd3-3f31-49e6-bb3c-1b9a5be56d71</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h4>Introduction
</h4>
        <p>
Rich media advertisement is a buzz word today. Organizations are spending a huge amount
to move out from a traditional banner advertisement approach, booklets and television
to a more effective tactics where they can reach out to a wider mass through internet.
Rich media advertisement forms a basis of wider coverage at less cost together with
a wonderful user experience. 
</p>
        <p>
Macromedia Flash, already provides a state-of-art solution for it. However, it is
mostly tied to its proprietary engine for shock wave and interaction. Flash are further,
required to be embedded as a compiled unit. Besides all, it requires you to learn
Flash an extra skill.
</p>
        <p>
Something I like about silverlight is that it supports <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a> based
platform with language support for programming. <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">EXtensible
Application Markup Language (XAML)</a> which is pronounced as Zamel, is used
to define your canvas and storyboard, which are easy to manipulate at runtime using
languages like C# or VB.Net. These are further deployed as a compressed unit rather
than a compiled unit. This is no doubt a step further than what Flash has achieved.
One drawback, however, is, adoption among wide number of serious users. I don't see
it as a big drawback as long as Microsoft is serious about this product. 
</p>
        <h4>Silverlight Kickstart
</h4>
        <p>
My silverlight development environment includes VS2008 with SP1, Framework 3.5, Silverlight
SDK and Microsoft Expression Encoder. I would not get into these details for the scope
of this article. You may refer to <a href="http://silverlight.net/GetStarted/">Getting
Started</a> article for Silverlight, to setup your development environment. Further,
if you donot want to get into the intrecacies of XAML, then you might also require
Microsoft Expression Blend. 
</p>
        <h4>WMV for streaming Video with Silverlight
</h4>
        <p>
Silverlight supports WMV format for videos. Using <a href="http://www.microsoft.com/expression/products/overview.aspx?key=encoder">Microsoft
Expression Encoder</a> these WMV files can be encoded to have markers on their
timelines. These markers can be used by siliverlight for interaction. The markers
are simply names given to a time in the video's timeline. Silverlight raises <strong><em>MarkerReached</em></strong> event
(if registered) when a marker is reached while playing the video. This forms the basis
of interaction between silverlight and streaming videos. There is a nice <a href="http://www.5min.com/Video/How-to-Add-Metadata-and-Markers-in-Microsoft-Expression-Encoder-2-80716108">video
tutorial</a> explaining, how to add a marker using <a href="http://www.microsoft.com/expression/products/overview.aspx?key=encoder">Microsoft
Expression Encoder</a>. 
</p>
        <h4>Silverlight UI
</h4>
        <p>
          <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a> in
Silverlight allows you to do a lot of stuffs with the UI using its declarative tags.
Few, real interesting things you can do, without any extra skill required, includes,
drawing a curve, masking, controlling opacity, define animation ... all through XML
like declarative tags ... Wow!. In this tutorial, I will be showing you how to create
an interactive overlay on a running video. For this, I have a video with three markers
defined on it (using Encoder). Now let us first examine the UI. 
</p>
        <h5 style="MARGIN-LEFT: 30px">The UI
</h5>
        <iframe style="MARGIN-LEFT: 30px" marginwidth="0" marginheight="0" src="/blogs/shared/theUI.htm" frameborder="0" width="90%" height="280">
        </iframe>
        <p style="MARGIN-LEFT: 30px">
Few things, I would like to explain here, before we proceed to next step, since they
have been referred ahead. Take a sneak into the code for things, I have marked in
bold. Notice that:<br /></p>
        <ul style="MARGIN-LEFT: 50px">
          <li>
Movie name is "MainMovieStream" defined as an attribute "x:Name". 
</li>
          <li>
The "MarkerReached" event is registered for the movie as "MainMovieStream_MarkerReached". 
</li>
          <li>
Canvas with a name "TopOverlay" which is placed -325 pixels on the left. 
</li>
          <li>
"TopOverlay" canvas has an inner element "TopText" with an event "MouseLeftButtonDown"
handled by "TopText_MouseLeftButtonDown" function 
</li>
          <li>
A Canvas "BottomOverlay" is defined in a similar faishon except its top is "131". 
</li>
        </ul>
        <h5 style="MARGIN-LEFT: 30px">Silverlight Story Board
</h5>
        <iframe style="MARGIN-LEFT: 30px" marginwidth="0" marginheight="0" src="/blogs/shared/storybrd.htm" frameborder="0" width="85%" height="195">
        </iframe>
        <p style="MARGIN-LEFT: 30px">
Take a sneak into the code for things, I have marked in bold. Notice that:<br /></p>
        <ul style="MARGIN-LEFT: 50px">
          <li>
Storyboard "TopOverlayIn" targets the canvas "TopOverlay". 
</li>
          <li>
The "Storyboard.TargetProperty" tells us that the "Left" property has to be changed. 
</li>
          <li>
The "SplineDoubleKeyFrame" defines, that after every 1 sec the target property moves
near to the "Value=0". Hence, the Canvas.Left moves from -325 to 0 
</li>
          <li>
The Storyboard "TopOverlayOut" does exactly the opposite of "TopOverlayIn". 
</li>
        </ul>
        <p>
        </p>
        <h4>MediaControl.xaml
</h4>
        <p style="MARGIN: 0px">
The Storyboards are treated as Canvas resource which would be used when required.
Let us see the complete <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a> for
our tutorial. 
</p>
        <iframe style="MARGIN-TOP: 5px; MARGIN-LEFT: 30px" marginwidth="0" marginheight="0" src="/blogs/shared/medctrl.htm" frameborder="0" width="85%" height="400">
        </iframe>
        <h4>C# Code
</h4>
        <p>
When you add a <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a> file
into your solution, visual studio responds with adding an associated code behind file
for the <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a>.
Besides, you would also find a <b>App.xaml</b> and its code behind file with
same name. While doing any development on Silverlight, most of the time you would
ask "How can I pass values to Silverlight application at runtime" or in another way
"How can I make it as a component to be used in other projects?". This is done through
parameter passing at the time of initialization. 
</p>
        <h4>App.xaml.cs
</h4>
        <p>
Let us sneak into <b>App.xaml.cs</b> file where the necessary changes has been
made for the same. The only changes required in the <b>App.xaml.cs</b> file are: 
</p>
        <ul>
          <li>
Declare an "<b>IDictionary</b>" object for paramters as a class variable<br /><div style="FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; WIDTH: 80%; COLOR: black; FONT-FAMILY: Courier New"><p style="MARGIN: 0px"><span style="COLOR: blue">public partial class</span><span style="COLOR: #2b91af"> App</span> : <span style="COLOR: #2b91af">Application</span> {
</p><p style="MARGIN: 0px">
    <span style="COLOR: blue">private </span><span style="COLOR: #2b91af">IDictionary</span>&lt;<span style="COLOR: blue">string</span>, <span style="COLOR: blue">string</span>&gt;
initParams;
</p><br />
... 
</div><br /></li>
          <li>
Initialize it in the "<b>Application_Startup</b>"<br /><div style="FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; WIDTH: 80%; COLOR: black; FONT-FAMILY: Courier New"><p style="MARGIN: 0px"><span style="COLOR: blue">private void</span> Application_Startup(<span style="COLOR: blue">object</span> sender, <span style="COLOR: #2b91af">StartupEventArgs</span> e)
</p><p style="MARGIN: 0px">
{
</p><p style="MARGIN: 0px">
    <span style="COLOR: blue">this</span>.RootVisual = <span style="COLOR: blue">new</span><span style="COLOR: #2b91af"> MediaControl</span>();
</p><p style="MARGIN: 0px">
    InitParams = e.InitParams;
</p><p style="MARGIN: 0px">
}
</p></div></li>
        </ul>
        <h4>MediaControl.xaml.cs
</h4>
        <p>
Now let us sneak into the <b>MediaControl.xaml.cs</b> file to see how we collect
the parameters and how we handle the animation and events. 
</p>
        <iframe style="MARGIN-LEFT: 30px" marginwidth="0" marginheight="0" src="/blogs/shared/medctrlcs.htm" frameborder="0" width="85%" height="400">
        </iframe>
        <p>
In the code above we get the reference of the Silverlight application using "Application.Current
as App" (marked in bold) in the "Page_Loaded" event. Once we have got the handle of
the application we can access its public properties. In this case the parameters.
As you can see, I am iterating through each parameters and storing the values into
my local variables. The marker parameters here contains the storyboard names that
we would see in the next section. Also notice, how I am handling the "MarkerReached"
event and the "MouseLeftButtonDown" events. The actions are self explanatory here. 
</p>
        <h4>Embedding Silverlight RichMediaAd Control
</h4>
        <p>
Once you have done with this code, your control is ready to be used. When you compile
a Silverlight application, you would notice that it generates a <b>RichMediaAd.xap</b> file
under <b>ClientBin</b> folder of your web application which references the Silverlight
application. This .xap file is nothing but a compressed file containing your application
manifest and the DLL. You can use a simple un-zip command to view the files inside.
In the page 
</p>
        <p>
Now let us see the code where we embed this Silverlight control we made. 
</p>
        <iframe style="MARGIN-LEFT: 30px" marginwidth="0" marginheight="0" src="/blogs/shared/embed.htm" frameborder="0" width="85%" height="200">
        </iframe>
        <p>
Once you have embedded the XAP file. It is ready to run. Notice, that I am sending
all necessary parameters at runtime, including the media I want to use.<br /><br /><em>Happy Silverlight Programming !!</em></p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=277f2bd3-3f31-49e6-bb3c-1b9a5be56d71" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Interactive Video Advertising With Silverlight 2</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,277f2bd3-3f31-49e6-bb3c-1b9a5be56d71.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/02/23/InteractiveVideoAdvertisingWithSilverlight2.aspx</link>
      <pubDate>Mon, 23 Feb 2009 14:14:53 GMT</pubDate>
      <description>&lt;h4&gt;Introduction
&lt;/h4&gt;
&lt;p&gt;
Rich media advertisement is a buzz word today. Organizations are spending a huge amount
to move out from a traditional banner advertisement approach, booklets and television
to a more effective tactics where they can reach out to a wider mass through internet.
Rich media advertisement forms a basis of wider coverage at less cost together with
a wonderful user experience. 
&lt;/p&gt;
&lt;p&gt;
Macromedia Flash, already provides a state-of-art solution for it. However, it is
mostly tied to its proprietary engine for shock wave and interaction. Flash are further,
required to be embedded as a compiled unit. Besides all, it requires you to learn
Flash an extra skill.
&lt;/p&gt;
&lt;p&gt;
Something I like about silverlight is that it supports &lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;XAML&lt;/a&gt;&amp;nbsp;based
platform with language support for programming. &lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;EXtensible
Application Markup Language (XAML)&lt;/a&gt;&amp;nbsp;which is pronounced as Zamel, is used
to define your canvas and storyboard, which are easy to manipulate at runtime using
languages like C# or VB.Net. These are further deployed as a compressed unit rather
than a compiled unit. This is no doubt a step further than what Flash has achieved.
One drawback, however, is, adoption among wide number of serious users. I don't see
it as a big drawback as long as Microsoft is serious about this product. 
&lt;/p&gt;
&lt;h4&gt;Silverlight Kickstart
&lt;/h4&gt;
&lt;p&gt;
My silverlight development environment includes VS2008 with SP1, Framework 3.5, Silverlight
SDK and Microsoft Expression Encoder. I would not get into these details for the scope
of this article. You may refer to &lt;a href="http://silverlight.net/GetStarted/"&gt;Getting
Started&lt;/a&gt;&amp;nbsp;article for Silverlight, to setup your development environment. Further,
if you donot want to get into the intrecacies of XAML, then you might also require
Microsoft Expression Blend. 
&lt;/p&gt;
&lt;h4&gt;WMV for streaming Video with Silverlight
&lt;/h4&gt;
&lt;p&gt;
Silverlight supports WMV format for videos. Using &lt;a href="http://www.microsoft.com/expression/products/overview.aspx?key=encoder"&gt;Microsoft
Expression Encoder&lt;/a&gt;&amp;nbsp;these WMV files can be encoded to have markers on their
timelines. These markers can be used by siliverlight for interaction. The markers
are simply names given to a time in the video's timeline. Silverlight raises &lt;strong&gt;&lt;em&gt;MarkerReached&lt;/em&gt;&lt;/strong&gt;&amp;nbsp;event
(if registered) when a marker is reached while playing the video. This forms the basis
of interaction between silverlight and streaming videos. There is a nice &lt;a href="http://www.5min.com/Video/How-to-Add-Metadata-and-Markers-in-Microsoft-Expression-Encoder-2-80716108"&gt;video
tutorial&lt;/a&gt;&amp;nbsp;explaining, how to add a marker using &lt;a href="http://www.microsoft.com/expression/products/overview.aspx?key=encoder"&gt;Microsoft
Expression Encoder&lt;/a&gt;. 
&lt;/p&gt;
&lt;h4&gt;Silverlight UI
&lt;/h4&gt;
&lt;p&gt;
&lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;XAML&lt;/a&gt; in
Silverlight allows you to do a lot of stuffs with the UI using its declarative tags.
Few, real interesting things you can do, without any extra skill required, includes,
drawing a curve, masking, controlling opacity, define animation ... all through XML
like declarative tags ... Wow!. In this tutorial, I will be showing you how to create
an interactive overlay on a running video. For this, I have a video with three markers
defined on it (using Encoder). Now let us first examine the UI. 
&lt;/p&gt;
&lt;h5 style="MARGIN-LEFT: 30px"&gt;The UI
&lt;/h5&gt;
&lt;iframe style="MARGIN-LEFT: 30px" marginwidth=0 marginheight=0 src="/blogs/shared/theUI.htm" frameborder=0 width="90%" height=280&gt;
&lt;/iframe&gt;
&lt;p style="MARGIN-LEFT: 30px"&gt;
Few things, I would like to explain here, before we proceed to next step, since they
have been referred ahead. Take a sneak into the code for things, I have marked in
bold. Notice that:&lt;br&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 50px"&gt;
&lt;li&gt;
Movie name is "MainMovieStream" defined as an attribute "x:Name". 
&lt;li&gt;
The "MarkerReached" event is registered for the movie as "MainMovieStream_MarkerReached". 
&lt;li&gt;
Canvas with a name "TopOverlay" which is placed -325 pixels on the left. 
&lt;li&gt;
"TopOverlay" canvas has an inner element "TopText" with an event "MouseLeftButtonDown"
handled by "TopText_MouseLeftButtonDown" function 
&lt;li&gt;
A Canvas "BottomOverlay" is defined in a similar faishon except its top is "131". 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 style="MARGIN-LEFT: 30px"&gt;Silverlight Story Board
&lt;/h5&gt;
&lt;iframe style="MARGIN-LEFT: 30px" marginwidth=0 marginheight=0 src="/blogs/shared/storybrd.htm" frameborder=0 width="85%" height=195&gt;
&lt;/iframe&gt;
&lt;p style="MARGIN-LEFT: 30px"&gt;
Take a sneak into the code for things, I have marked in bold. Notice that:&lt;br&gt;
&lt;/p&gt;
&lt;ul style="MARGIN-LEFT: 50px"&gt;
&lt;li&gt;
Storyboard "TopOverlayIn" targets the canvas "TopOverlay". 
&lt;li&gt;
The "Storyboard.TargetProperty" tells us that the "Left" property has to be changed. 
&lt;li&gt;
The "SplineDoubleKeyFrame" defines, that after every 1 sec the target property moves
near to the "Value=0". Hence, the Canvas.Left moves from -325 to 0 
&lt;li&gt;
The Storyboard "TopOverlayOut" does exactly the opposite of "TopOverlayIn". 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;h4&gt;MediaControl.xaml
&lt;/h4&gt;
&lt;p style="MARGIN: 0px"&gt;
The Storyboards are treated as Canvas resource which would be used when required.
Let us see the complete &lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;XAML&lt;/a&gt;&amp;nbsp;for
our tutorial. 
&lt;/p&gt;
&lt;iframe style="MARGIN-TOP: 5px; MARGIN-LEFT: 30px" marginwidth=0 marginheight=0 src="/blogs/shared/medctrl.htm" frameborder=0 width="85%" height=400&gt;
&lt;/iframe&gt;
&lt;h4&gt;C# Code
&lt;/h4&gt;
&lt;p&gt;
When you add a &lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;XAML&lt;/a&gt;&amp;nbsp;file
into your solution, visual studio responds with adding an associated code behind file
for the &lt;a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language"&gt;XAML&lt;/a&gt;.
Besides, you would also find a &lt;b&gt;App.xaml&lt;/b&gt;&amp;nbsp;and its code behind file with
same name. While doing any development on Silverlight, most of the time you would
ask "How can I pass values to Silverlight application at runtime" or in another way
"How can I make it as a component to be used in other projects?". This is done through
parameter passing at the time of initialization. 
&lt;/p&gt;
&lt;h4&gt;App.xaml.cs
&lt;/h4&gt;
&lt;p&gt;
Let us sneak into &lt;b&gt;App.xaml.cs&lt;/b&gt;&amp;nbsp;file where the necessary changes has been
made for the same. The only changes required in the &lt;b&gt;App.xaml.cs&lt;/b&gt;&amp;nbsp;file are: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Declare an "&lt;b&gt;IDictionary&lt;/b&gt;" object for paramters as a class variable&lt;br&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; WIDTH: 80%; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;public partial class&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;App&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;Application&lt;/span&gt;&amp;nbsp;{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;private &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
initParams;
&lt;/p&gt;
&lt;br&gt;
... 
&lt;/div&gt;
&lt;br&gt;
&lt;li&gt;
Initialize it in the "&lt;b&gt;Application_Startup&lt;/b&gt;"&lt;br&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: #e7e7e7; WIDTH: 80%; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;p style="MARGIN: 0px"&gt;
&lt;span style="COLOR: blue"&gt;private void&lt;/span&gt;&amp;nbsp;Application_Startup(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;StartupEventArgs&lt;/span&gt;&amp;nbsp;e)
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.RootVisual = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;&amp;nbsp;MediaControl&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; InitParams = e.InitParams;
&lt;/p&gt;
&lt;p style="MARGIN: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;MediaControl.xaml.cs
&lt;/h4&gt;
&lt;p&gt;
Now let us sneak into the &lt;b&gt;MediaControl.xaml.cs&lt;/b&gt;&amp;nbsp;file to see how we collect
the parameters and how we handle the animation and events. 
&lt;/p&gt;
&lt;iframe style="MARGIN-LEFT: 30px" marginwidth=0 marginheight=0 src="/blogs/shared/medctrlcs.htm" frameborder=0 width="85%" height=400&gt;
&lt;/iframe&gt;
&lt;p&gt;
In the code above we get the reference of the Silverlight application using "Application.Current
as App" (marked in bold) in the "Page_Loaded" event. Once we have got the handle of
the application we can access its public properties. In this case the parameters.
As you can see, I am iterating through each parameters and storing the values into
my local variables. The marker parameters here contains the storyboard names that
we would see in the next section. Also notice, how I am handling the "MarkerReached"
event and the "MouseLeftButtonDown" events. The actions are self explanatory here. 
&lt;/p&gt;
&lt;h4&gt;Embedding Silverlight RichMediaAd Control
&lt;/h4&gt;
&lt;p&gt;
Once you have done with this code, your control is ready to be used. When you compile
a Silverlight application, you would notice that it generates a &lt;b&gt;RichMediaAd.xap&lt;/b&gt; file
under &lt;b&gt;ClientBin&lt;/b&gt;&amp;nbsp;folder of your web application which references the Silverlight
application. This .xap file is nothing but a compressed file containing your application
manifest and the DLL. You can use a simple un-zip command to view the files inside.
In the page 
&lt;/p&gt;
&lt;p&gt;
Now let us see the code where we embed this Silverlight control we made. 
&lt;/p&gt;
&lt;iframe style="MARGIN-LEFT: 30px" marginwidth=0 marginheight=0 src="/blogs/shared/embed.htm" frameborder=0 width="85%" height=200&gt;
&lt;/iframe&gt;
&lt;p&gt;
Once you have embedded the XAP file. It is ready to run. Notice, that I am sending
all necessary parameters at runtime, including the media I want to use.&lt;br&gt;
&lt;br&gt;
&lt;em&gt;Happy Silverlight Programming !!&lt;/em&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=277f2bd3-3f31-49e6-bb3c-1b9a5be56d71" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,277f2bd3-3f31-49e6-bb3c-1b9a5be56d71.aspx</comments>
      <category>.Net</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=b9b6ad70-7008-4921-973f-2c63310cc3de</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,b9b6ad70-7008-4921-973f-2c63310cc3de.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,b9b6ad70-7008-4921-973f-2c63310cc3de.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=b9b6ad70-7008-4921-973f-2c63310cc3de</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
Skillz is my current project, where I have been involved for over 6 months now. The
core part of Skillz is to do a Talent Management while additionally it supports performance
management. 
</p>
        <p align="justify">
This is a breed of very interesting project for me with lot of grilling, learning
and testing one’s self Talent Quotient. We faced lots of challenges and kept working
our ways through to achieve what we initially set out to achieve. With time the product
evolved as we developed a stronger understanding of the requirements across industries
and formed our own opinions on how these should be addressed. It has been a real interesting
journey, delving into unknowns, digging out answers and putting it into implementations.
I feel like sharing some of my experiences with Skillz here for benefit of all developers
and architects, trying to decipher the same unknowns.
</p>
        <p align="justify">
          <strong>
            <font size="4">The Challenges<br /></font>
          </strong>
        </p>
        <p align="justify">
          <strong>The First Challenge<br /></strong>
        </p>
        <p align="justify">
On this project the biggest challenge was the need to correctly understand what Talent
Management is and what is really expected of a Talent Management application. While
researching, I found many articles and blogs explaining Talent management.
</p>
        <p align="justify">
The problem with the information and articles out there is that it creates a fair
amount of confusion between talent management and performance management. Both are
fairly inter linked. So much so that at times it becomes hard to differentiate between
the two. It is like you have been asked to differentiate between the words [opinion,
attitude, belief and faith]. We compared few products currently available. Some of
them were far from catering the actual need of talent management, while others offered
a wide range of tools most of which, would be of no use to most organizations. 
</p>
        <p align="justify">
Only some were quite near to what was expected. There are quiet good articles out
there on the web, worth mentioning here. <strong>Tony DiRomualdo</strong> in one of
his article defines <a href="http://wistechnology.com/articles/2854/">seven management
practices that matters</a>. He is in a view that for becoming a well rounded talent
requires continuous learning and development of knowledge and skills. One of the articles
published by Nasscom and written by <strong>Prof. Peter Cappelli</strong>, Center
for Human Resources, University of Pennsylvania, explains the more subtle difference
between Performance and Talent Management titled <a href="http://www.nasscom.in/Nasscom/templates/NormalPage.aspx?id=51772">Talent
Management is a business problem</a>.
</p>
        <p align="justify">
          <strong>The Second Challenge</strong>
        </p>
        <p align="justify">
Another, challenge was about architecting Skillz, such that, it fits into the requirement
posed by different industries. A skill itself varies hugely from industry to industry.
To explain this, try comparing some common skills for a Doctor, Bank Manager and a
Software Developer. Specializations for a doctor (like MD, MBBS etc), matters much more,
than it does for a Bank Manager or a Software Developer. Similarly, Global Client
Exposures for a Software Developer is more important than it is for a bank
manager or for that matter, a doctor. Accounting exposures stands more important for
a bank manager. Thus a common skill like education or experience needs different design
for different industry/practices. This is because individual professions and verticals
vary hugely from each other. This leads to a fresh challenge; the very fundamental
nomenclatures used in the application, changes completely depending on which vertical
the system is deployed in.  A classic example for this is the entity <strong><em>‘user’</em></strong>.
For every vertical where skillz is implemented, the very meaning and attributes for
a <strong><em>‘user’</em></strong> changes drastically. Attributes like medical registration
number and Medical Specializations make more sense for doctors than they do for developer
or a bank manager. Rank/Grade does not imply to a doctor or a software developer. 
</p>
        <p align="justify">
Further, aspects like Security, Reporting, Usability together with the nature
of Talent Management, additively, pushed the design of Skillz to a level of challenge.
</p>
        <p align="justify">
          <strong>
            <font size="4">Solving the challenges</font>
          </strong>
        </p>
        <p align="justify">
          <strong>Solving First Challenge</strong>
        </p>
        <p align="justify">
The first challenge took the major portion of our time; which was spent in  
discovering the true nature and taste of Talent Management vis-a-vis differentiating
it with performance. Talent Management is all about getting the right people with
right skills into the right job by measuring the following quotients:
</p>
        <ol>
          <li>
            <div align="justify">Learning Quotient (LQ): Measures how an individual learns and
improves
</div>
          </li>
          <li>
            <div align="justify">Conceptual Quotient (CQ): Measures the ability of thought
process in solving a problem.
</div>
          </li>
          <li>
            <div align="justify">Relationship Quotient (RQ): Measures how an individual behaves
in a group
</div>
          </li>
          <li>
            <div align="justify">Action Quotient (AQ): Measures the individual as a team
member by his actions.
</div>
          </li>
        </ol>
        <p align="justify">
For an individual the Talent Quotient (TQ) = (LQ+CQ+RQ+AQ) * Values.
</p>
        <p align="justify">
Well, how do we measure it? I am sure our HR would be highly interested and can add
another hundred paragraphs here about these quotients, process of measuring it,
appraisal, questionnaires and many more.
</p>
        <p align="justify">
Different companies have adopted different techniques to measure the TQ. The
most common techniques  used are appraisals, interviews, trainings and feedbacks.
But, seldom people understand the continuous nature and difference between the talent
management and performance.
</p>
        <p align="justify">
Now the most interesting part, Talent Management is not only about measuring TQ. It
is about Identifying TQ, Acquiring TQ, measuring TQ, mentoring TQ and Retention of
TQ. So where does Performance comes in? The answer is:  
</p>
        <p align="center">
          <strong>TALENT MANAGEMENT + PERFORMANCE MANAGEMENT = PERFORMANCE</strong>
        </p>
        <p align="justify">
Put simply, tracking ‘performance’ is much more than most people think of it. It doesn’t
start and end with performance management. Talent management which involves acquiring,
goal setting, training, mentoring and retaining individuals also forms a huge part
of tracking their performance.
</p>
        <p align="justify">
Building a system which allows administrators and implementers to capture talent management
and beyond was our initial design goal for skillz and after months of hard work, eating
our own dog food and months of testing with a couple of beta customers, we believe
we’ve come decently close to achieving it.
</p>
        <p align="justify">
This solves the first challenge!
</p>
        <p align="justify">
          <strong>Solving Second Challenge</strong>
        </p>
        <p align="justify">
The second challenge was to design a system which fits into various industries catering
to their unique needs. We decided to have a core system and extend it according to
the organizational need. User, Skills, Activities, Trainings are entities within the
system which are simple, flexible and easy to extend.
</p>
        <p align="justify">
Security within individual organizations can be easily configured and tweaked by individual
organizational administrators. Skillz is designed to be offered as a service (<a href="http://en.wikipedia.org/wiki/Software_as_a_service" target="_blank">SaaS</a>).
For us this means easier deployments for all our customers and for our customers it
means easy updates to newer versions as we continue to work on newer versions and
add new functionality. 
</p>
        <p align="justify">
Skillz is a result of months of hard work, countless brainstorming sessions and a
lot of thought that has gone into areas like security, reporting and usability. We’ve
given special attention to extendibility so that customers can tweak skillz to fit
their requirements.<br />
  
<br />
The following diagram defines some interesting prepositions that are uniquely available
in Skillz.
</p>
        <p align="justify">
        </p>
        <div align="center">
          <img height="457" alt="Skillz Features" src="/blogs/shared/skillzUSP.jpg" width="700" />
        </div>
        <p>
Even though we’ve been using it within small teams @ eFORCE and with some of our beta
customers, the official launch date for a public beta will be announced soon. 
</p>
        <p>
The entire team is very excited about its acceptance, performance and criticism in
the world of <strong>PERFORMANCE</strong>. This release for me is the starting of
the race which we struggled to qualify and it took us almost one full year. 
</p>
        <p>
I hope this article is helpful for those working in similar areas. I would keep posting
more about Skillz as and when time permits.
</p>
        <p align="justify">
Thanks,<br />
Manish<br /></p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=b9b6ad70-7008-4921-973f-2c63310cc3de" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Life full of Talents and Skillz</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,b9b6ad70-7008-4921-973f-2c63310cc3de.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/01/19/LifeFullOfTalentsAndSkillz.aspx</link>
      <pubDate>Mon, 19 Jan 2009 14:14:29 GMT</pubDate>
      <description>&lt;p align=justify&gt;
Skillz is my current project, where I have been involved for over 6 months now. The
core part of Skillz is to do a Talent Management while additionally it supports performance
management. 
&lt;/p&gt;
&lt;p align=justify&gt;
This is a breed of very interesting project for me with lot of grilling, learning
and testing one’s self Talent Quotient. We faced lots of challenges and kept working
our ways through to achieve what we initially set out to achieve. With time the product
evolved as we developed a stronger understanding of the requirements across industries
and formed our own opinions on how these should be addressed. It has been a real interesting
journey, delving into unknowns, digging out answers and putting it into implementations.
I feel like sharing some of my experiences with Skillz here for benefit of all developers
and architects, trying to decipher the same unknowns.
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;strong&gt;&lt;font size=4&gt;The Challenges&lt;br&gt;
&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;strong&gt;The First Challenge&lt;br&gt;
&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
On this project the biggest challenge was the need to correctly understand what Talent
Management is and what is really expected of a Talent Management application. While
researching, I found many articles and blogs explaining Talent management.
&lt;/p&gt;
&lt;p align=justify&gt;
The problem with the information and articles out there is that it creates a fair
amount of confusion between talent management and performance management. Both are
fairly inter linked. So much so that at times it becomes hard to differentiate between
the two. It is like you have been asked to differentiate between the words [opinion,
attitude, belief and faith]. We compared few products currently available. Some of
them were far from catering the actual need of talent management, while others offered
a wide range of tools most of which, would be of no use to most organizations. 
&lt;/p&gt;
&lt;p align=justify&gt;
Only some were quite near to what was expected. There are quiet good articles out
there on the web, worth mentioning here. &lt;strong&gt;Tony DiRomualdo&lt;/strong&gt; in one of
his article defines &lt;a href="http://wistechnology.com/articles/2854/"&gt;seven management
practices that matters&lt;/a&gt;. He is in a view that for becoming a well rounded talent
requires continuous learning and development of knowledge and skills. One of the articles
published by Nasscom and written by &lt;strong&gt;Prof. Peter Cappelli&lt;/strong&gt;, Center
for Human Resources, University of Pennsylvania,&amp;nbsp;explains the more subtle difference
between Performance and Talent Management titled &lt;a href="http://www.nasscom.in/Nasscom/templates/NormalPage.aspx?id=51772"&gt;Talent
Management is a business problem&lt;/a&gt;.
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;strong&gt;The Second Challenge&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
Another, challenge was about architecting Skillz, such that, it fits into the requirement
posed by different industries. A skill itself varies hugely from industry to industry.
To explain this, try comparing some common skills for a Doctor, Bank Manager and a
Software Developer. Specializations for a doctor (like MD, MBBS etc), matters much&amp;nbsp;more,
than it does for a Bank Manager or a Software Developer. Similarly, Global Client
Exposures for a Software Developer is more important than&amp;nbsp;it is for a&amp;nbsp;bank
manager or for that matter, a doctor. Accounting exposures stands more important for
a bank manager. Thus a common skill like education or experience needs different design
for different industry/practices. This is because individual professions and verticals
vary hugely from each other. This leads to a fresh challenge; the very fundamental
nomenclatures used in the application, changes completely depending on which vertical
the system is deployed in.&amp;nbsp; A classic example for this is the entity &lt;strong&gt;&lt;em&gt;‘user’&lt;/em&gt;&lt;/strong&gt;.
For every vertical where skillz is implemented, the very meaning and attributes for
a &lt;strong&gt;&lt;em&gt;‘user’&lt;/em&gt;&lt;/strong&gt; changes drastically. Attributes like medical registration
number and Medical Specializations make more sense for doctors than they do for developer
or a bank manager. Rank/Grade does not imply to a doctor or a software developer. 
&lt;/p&gt;
&lt;p align=justify&gt;
Further, aspects like Security, Reporting, Usability&amp;nbsp;together with&amp;nbsp;the nature
of Talent Management, additively, pushed the design of Skillz to a level of challenge.
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;strong&gt;&lt;font size=4&gt;Solving the challenges&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;strong&gt;Solving First Challenge&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
The first challenge took the major portion of our time; which was spent in&amp;nbsp;&amp;nbsp;
discovering the true nature and taste of Talent Management vis-a-vis differentiating
it with performance. Talent Management is all about getting the right people with
right skills into the right job by measuring the following quotients:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div align=justify&gt;Learning Quotient (LQ): Measures how an individual learns and improves
&lt;/div&gt;
&lt;li&gt;
&lt;div align=justify&gt;Conceptual Quotient (CQ):&amp;nbsp;Measures the ability of thought
process in solving a problem.
&lt;/div&gt;
&lt;li&gt;
&lt;div align=justify&gt;Relationship Quotient (RQ):&amp;nbsp;Measures how an individual behaves
in a group
&lt;/div&gt;
&lt;li&gt;
&lt;div align=justify&gt;Action Quotient (AQ):&amp;nbsp;Measures the individual as a team member
by his actions.
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p align=justify&gt;
For an individual the Talent Quotient (TQ) = (LQ+CQ+RQ+AQ) * Values.
&lt;/p&gt;
&lt;p align=justify&gt;
Well, how do we measure it? I am sure our HR would be highly interested and can add
another&amp;nbsp;hundred paragraphs here about these quotients, process of measuring it,
appraisal, questionnaires and many more.
&lt;/p&gt;
&lt;p align=justify&gt;
Different companies have adopted different&amp;nbsp;techniques to measure the TQ. The
most common techniques&amp;nbsp; used are appraisals, interviews, trainings and feedbacks.
But, seldom people understand the continuous nature and difference between the talent
management and performance.
&lt;/p&gt;
&lt;p align=justify&gt;
Now the most interesting part, Talent Management is not only about measuring TQ. It
is about Identifying TQ, Acquiring TQ, measuring TQ, mentoring TQ and Retention of
TQ. So where does Performance comes in? The answer is:&amp;nbsp;&amp;nbsp;
&lt;/p&gt;
&lt;p align=center&gt;
&lt;strong&gt;TALENT MANAGEMENT + PERFORMANCE MANAGEMENT = PERFORMANCE&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
Put simply, tracking ‘performance’ is much more than most people think of it. It doesn’t
start and end with performance management. Talent management which involves acquiring,
goal setting, training, mentoring and retaining individuals also forms a huge part
of tracking their performance.
&lt;/p&gt;
&lt;p align=justify&gt;
Building a system which allows administrators and implementers to capture talent management
and beyond was our initial design goal for skillz and after months of hard work, eating
our own dog food and months of testing with a couple of beta customers, we believe
we’ve come decently close to achieving it.
&lt;/p&gt;
&lt;p align=justify&gt;
This solves the first challenge!
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;strong&gt;Solving Second Challenge&lt;/strong&gt;
&lt;/p&gt;
&lt;p align=justify&gt;
The second challenge was to design a system which fits into various industries catering
to their unique needs. We decided to have a core system and extend it according to
the organizational need. User, Skills, Activities, Trainings are entities within the
system which are simple, flexible and easy to extend.
&lt;/p&gt;
&lt;p align=justify&gt;
Security within individual organizations can be easily configured and tweaked by individual
organizational administrators. Skillz is designed to be offered as a service (&lt;a href="http://en.wikipedia.org/wiki/Software_as_a_service" target=_blank&gt;SaaS&lt;/a&gt;).
For us this means easier deployments for all our customers and for our customers it
means easy updates to newer versions as we continue to work on newer versions and
add new functionality. 
&lt;/p&gt;
&lt;p align=justify&gt;
Skillz is a result of months of hard work, countless brainstorming sessions and a
lot of thought that has gone into areas like security, reporting and usability. We’ve
given special attention to extendibility so that customers can tweak skillz to fit
their requirements.&lt;br&gt;
&amp;nbsp; 
&lt;br&gt;
The following diagram defines some interesting prepositions that are uniquely available
in Skillz.
&lt;/p&gt;
&lt;p align=justify&gt;
&lt;div align=center&gt;&lt;img height=457 alt="Skillz Features" src="/blogs/shared/skillzUSP.jpg" width=700&gt;
&lt;/div&gt;
&lt;p&gt;
Even though we’ve been using it within small teams @ eFORCE and with some of our beta
customers, the official launch date for a public beta will be announced soon. 
&lt;/p&gt;
&lt;p&gt;
The entire team is very excited about its acceptance, performance and criticism in
the world of &lt;strong&gt;PERFORMANCE&lt;/strong&gt;. This release for me is the starting of
the race which we struggled to qualify and it took us almost one full year. 
&lt;/p&gt;
&lt;p&gt;
I hope this article is helpful for those working in similar areas. I would keep posting
more about Skillz as and when time permits.
&lt;/p&gt;
&lt;p align=justify&gt;
Thanks,&lt;br&gt;
Manish&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=b9b6ad70-7008-4921-973f-2c63310cc3de" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,b9b6ad70-7008-4921-973f-2c63310cc3de.aspx</comments>
      <category>Skillz</category>
    </item>
    <item>
      <trackback:ping>http://manishsingh.net/blogs/Trackback.aspx?guid=8eac131d-2ead-413d-8d71-6929ebad5436</trackback:ping>
      <pingback:server>http://manishsingh.net/blogs/pingback.aspx</pingback:server>
      <pingback:target>http://manishsingh.net/blogs/PermaLink,guid,8eac131d-2ead-413d-8d71-6929ebad5436.aspx</pingback:target>
      <dc:creator>Manish Kumar Singh</dc:creator>
      <wfw:comment>http://manishsingh.net/blogs/CommentView,guid,8eac131d-2ead-413d-8d71-6929ebad5436.aspx</wfw:comment>
      <wfw:commentRss>http://manishsingh.net/blogs/SyndicationService.asmx/GetEntryCommentsRss?guid=8eac131d-2ead-413d-8d71-6929ebad5436</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have seen many programmers and senior programmers showing their prowess in implementing
and justifying a design pattern implementation. Before doing so one should ask a very
simple and honest question to self, “Do I fully understand it?” I am sure many of
you, would say off course, what’s the big deal. Now look at your decision once more
by answering the following questions:
</p>
        <ol>
          <li>
Does your team, working with you also understand the pattern correctly? Are they comfortable
with its implementation?</li>
          <li>
Would you be there till the project reaches its logical end or do you have at least
one successor who would be there and understands the pattern correctly?</li>
          <li>
Does it require other members to follow a set of rules while coding?</li>
          <li>
Do you understand “What it solves” OR “How it solves”?</li>
          <li>
Are you thinking about scalability or maintainability?</li>
        </ol>
        <p>
          <strong>Thoughts on Question 1</strong>
        </p>
        <p>
Most of the serious projects require a team of developers working together on different
modules. If they do not understand the pattern, it is more likely, that you would
encounter chaotic and unorganized codes. The common evils are repetition of codes
which explains the lack of understanding the design pattern, code tweaking to override
design pattern, hard coded lines, code spaghetti and more. Wow these codes could kill.
</p>
        <p>
          <strong>Thoughts on Question 2</strong>
        </p>
        <p>
Something that remains constant in software development is “Change”. It is inevitable
and the requirement itself keeps changing. No doubt the design patterns are there
to help, but when it requires any change, who’s going to do it? In case it falls in
a wrong hand, it would shit all over your effort and logic.
</p>
        <p>
          <strong>Thoughts on Question 3</strong>
        </p>
        <p>
If your answer to this question is YES, then you must ensure you understand question
one, and keep a constant vigil or do a knowledge sharing for your team to bring them
on the same page, else the errors and problem can pretty quickly escalate making your
module a piece of shit. If your answer is NO, then you need to worry about question
two only.
</p>
        <p>
          <strong>Thoughts on Question 4</strong>
        </p>
        <p>
A big question! It is really easy to say what it solves, but knowing how it solves
is entirely a different ball game. You need to think on what is the price you need
to pay for implementing it, what are the other alternatives, is there a mix and match
of patterns to suit your need, does it increases the complexity of the module or simplifies
it, what is the cost of maintaining it, how frequently it is expected to change, what
are the impact points etc. etc. I am sure it would make you crazy, at first it seemed
to me as a simple question but later wow!
</p>
        <p>
          <strong>Thoughts on Question 5</strong>
        </p>
        <p>
You must read what other people think about scalablability. <a title="Damien Katz" href="http://damienkatz.net/2006/05/signs_youre_a_c.html" target="_blank"><span class="linkx">Damien
Katz</span></a>, in his post, writes about crappy programmers, boasting about concepts
like enterprise, scalability and patterns without actually understanding it. Another
hilarious and a bit “PG” post by <a title="Ted Dziuba" href="http://teddziuba.com/2008/04/im-going-to-scale-my-foot-up-y.html" target="_blank"><span class="linkx">Ted
Dziuba</span></a>, where he is really pissed off and frustrated with people talking
about scalability without having a good knowledge of it. In sync, there is another
post by <a title="Rajiv Popat" href="http://www.thousandtyone.com/blog/StopWhiningAboutScalabilityBestPracticesAndEnterpriseApplicationDevelopment.aspx" target="_blank"><span class="linkx">Rajiv
Popat</span></a> where he talks about the best practices and people who seriously
talk about such concepts but are not able to answer the simplest questions he asked. 
</p>
        <p>
Design patterns are not meant for scalability. It is about extension and maintenance.
It should reduce the impact of change, help in decoupling the elements of module interacting
with each other, reduce maintenance cost, provide extra room for extension.<br /></p>
        <img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=8eac131d-2ead-413d-8d71-6929ebad5436" />
        <br />
        <hr />
Manish Kumar Singh</body>
      <title>Do not implement Design Patterns - if you do not understand it</title>
      <guid isPermaLink="false">http://manishsingh.net/blogs/PermaLink,guid,8eac131d-2ead-413d-8d71-6929ebad5436.aspx</guid>
      <link>http://manishsingh.net/blogs/2009/01/13/DoNotImplementDesignPatternsIfYouDoNotUnderstandIt.aspx</link>
      <pubDate>Tue, 13 Jan 2009 05:17:12 GMT</pubDate>
      <description>&lt;p&gt;
I have seen many programmers and senior programmers showing their prowess in implementing
and justifying a design pattern implementation. Before doing so one should ask a very
simple and honest question to self, “Do I fully understand it?” I am sure many of
you, would say off course, what’s the big deal. Now look at your decision once more
by answering the following questions:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Does your team, working with you also understand the pattern correctly? Are they comfortable
with its implementation?&lt;/li&gt;
&lt;li&gt;
Would you be there till the project reaches its logical end or do you have at least
one successor who would be there and understands the pattern correctly?&lt;/li&gt;
&lt;li&gt;
Does it require other members to follow a set of rules while coding?&lt;/li&gt;
&lt;li&gt;
Do you understand “What it solves” OR “How it solves”?&lt;/li&gt;
&lt;li&gt;
Are you thinking about scalability or maintainability?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;strong&gt;Thoughts on Question 1&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
Most of the serious projects require a team of developers working together on different
modules. If they do not understand the pattern, it is more likely, that you would
encounter chaotic and unorganized codes. The common evils are repetition of codes
which explains the lack of understanding the design pattern, code tweaking to override
design pattern, hard coded lines, code spaghetti and more. Wow these codes could kill.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Thoughts on Question 2&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
Something that remains constant in software development is “Change”. It is inevitable
and the requirement itself keeps changing. No doubt the design patterns are there
to help, but when it requires any change, who’s going to do it? In case it falls in
a wrong hand, it would shit all over your effort and logic.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Thoughts on Question 3&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
If your answer to this question is YES, then you must ensure you understand question
one, and keep a constant vigil or do a knowledge sharing for your team to bring them
on the same page, else the errors and problem can pretty quickly escalate making your
module a piece of shit. If your answer is NO, then you need to worry about question
two only.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Thoughts on Question 4&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
A big question! It is really easy to say what it solves, but knowing how it solves
is entirely a different ball game. You need to think on what is the price you need
to pay for implementing it, what are the other alternatives, is there a mix and match
of patterns to suit your need, does it increases the complexity of the module or simplifies
it, what is the cost of maintaining it, how frequently it is expected to change, what
are the impact points etc. etc. I am sure it would make you crazy, at first it seemed
to me as a simple question but later wow!
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Thoughts on Question 5&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
You must read what other people think about scalablability. &lt;a title="Damien Katz" href="http://damienkatz.net/2006/05/signs_youre_a_c.html" target="_blank"&gt;&lt;span class="linkx"&gt;Damien
Katz&lt;/span&gt;&lt;/a&gt;, in his post, writes about crappy programmers, boasting about concepts
like enterprise, scalability and patterns without actually understanding it. Another
hilarious and a bit “PG” post by &lt;a title="Ted Dziuba" href="http://teddziuba.com/2008/04/im-going-to-scale-my-foot-up-y.html" target="_blank"&gt;&lt;span class="linkx"&gt;Ted
Dziuba&lt;/span&gt;&lt;/a&gt;, where he is really pissed off and frustrated with people talking
about scalability without having a good knowledge of it. In sync, there is another
post by &lt;a title="Rajiv Popat" href="http://www.thousandtyone.com/blog/StopWhiningAboutScalabilityBestPracticesAndEnterpriseApplicationDevelopment.aspx" target="_blank"&gt;&lt;span class="linkx"&gt;Rajiv
Popat&lt;/span&gt;&lt;/a&gt; where he talks about the best practices and people who seriously
talk about such concepts but are not able to answer the simplest questions he asked. 
&lt;/p&gt;
&lt;p&gt;
Design patterns are not meant for scalability. It is about extension and maintenance.
It should reduce the impact of change, help in decoupling the elements of module interacting
with each other, reduce maintenance cost, provide extra room for extension.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manishsingh.net/blogs/aggbug.ashx?id=8eac131d-2ead-413d-8d71-6929ebad5436" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Manish Kumar Singh</description>
      <comments>http://manishsingh.net/blogs/CommentView,guid,8eac131d-2ead-413d-8d71-6929ebad5436.aspx</comments>
      <category>Thoughts</category>
    </item>
  </channel>
</rss>