<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mohammed Atef's Technical blog</title>
	<atom:link href="http://mohammedatef.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mohammedatef.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sun, 25 Dec 2011 05:59:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mohammedatef.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/74a5245077c9bb7bcc1ff018d04e956a?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Mohammed Atef's Technical blog</title>
		<link>http://mohammedatef.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mohammedatef.wordpress.com/osd.xml" title="Mohammed Atef&#039;s Technical blog" />
	<atom:link rel='hub' href='http://mohammedatef.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Link Asp.net Dynamic Data Entity item to customized web pages</title>
		<link>http://mohammedatef.wordpress.com/2011/05/10/link-asp-net-dynamic-data-entity-item-to-customized-screens/</link>
		<comments>http://mohammedatef.wordpress.com/2011/05/10/link-asp-net-dynamic-data-entity-item-to-customized-screens/#comments</comments>
		<pubDate>Tue, 10 May 2011 13:27:22 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[Asp.net]]></category>
		<category><![CDATA[asp.net 4.0]]></category>
		<category><![CDATA[Dynamic data]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2011/05/10/link-asp-net-dynamic-data-entity-item-to-customized-screens/</guid>
		<description><![CDATA[Introduction When we build ASP.NET applications that sit on top of a data store of some kind, there are always a set of common tasks that we need to provide a UI for. Just a few of these patterns are listed here: Entity Lists — Display a list of rows in a table. Detail Form [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=460&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size:12px;">Introduction</span></strong></p>
<p><span style="font-size:11px;">When we build ASP.NET applications that sit on top of a data store of some kind, there are always a set of common tasks that we need to provide a UI for. Just a few of these patterns are listed here:<br />
<strong>Entity Lists </strong>— Display a list of rows in a table.<br />
<strong>Detail Form </strong>— Displays the details of a single entity.<br />
<strong>Edit Form </strong>— Enables the user to edit the details of a single entity.<br />
<strong>Create </strong>— Adds a new entity to a list.<br />
<strong>Delete </strong>— Deletes an entity from a list.<br />
<strong>Navigation </strong>— Provides Search, Filter, Sort, and Paginate lists of entities.</span></p>
<p><span style="font-size:12px;"><strong>Problem definition<br />
</strong></span><span style="font-size:12px;"><br />
</span><span style="font-size:11px;">sometimes we need to link one of entity list to another customized screens we have implemented before, so how we can do this task?</span></p>
<p><strong><span style="font-size:12px;">Solution</span></strong></p>
<p><span style="font-size:11px;">Here we are going to link one of listed entities in web application entities list to another existing or customized page throw the binding event of Grid View of listed entities.</span></p>
<p><span style="font-size:12px;"><span style="font-size:11px;">so if we have assumed that the entity name called Site and the customized page called siteslist.aspx, we can write the following lines of codes to redirect to this customized page when user select Site entity from entities list<br />
</span></span></p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 1:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Menu1_RowDataBound(<span style="color:#0000ff;">object</span> sender, System.Web.UI.WebControls.GridViewRowEventArgs e)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 2:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 3:</span>             <span style="color:#0000ff;">if</span>(e.Row.RowIndex!=-1)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 4:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 5:</span>                <span style="color:#0000ff;">if</span> (((System.Web.DynamicData.DynamicHyperLink)e.Row.Cells[0].Controls[1]).Text == <span style="color:#006080;">"Site"</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 6:</span>                 {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 7:</span>                     ((System.Web.DynamicData.DynamicHyperLink)e.Row.Cells[0].Controls[1]).NavigateUrl = Request.Url.ToString().Trim().ToLower().Replace(<span style="color:#006080;">"default.aspx"</span>,<span style="color:#006080;">"SitesList.aspx"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 8:</span>                 }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 9:</span>              }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 10:</span>         }</pre>
</div>
</div>
<p><span style="font-size:11px;">I think these few lines of code is very clear as shown above i have get the grid view row that has Site entity and replaced it’s NavigateUrl with the new siteslist.aspx page.</span></p>
<p><span style="font-size:11px;">Note, there is very important note that you should use customized screen like siteslist.aspx which note linked to master page if this page in the same web application else you can use any kind of web pages.</span></p>
<p>I Hope that helped</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/460/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=460&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2011/05/10/link-asp-net-dynamic-data-entity-item-to-customized-screens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow Foundation 4.0 Web Service</title>
		<link>http://mohammedatef.wordpress.com/2011/05/10/workflow-foundation-4-0-web-service/</link>
		<comments>http://mohammedatef.wordpress.com/2011/05/10/workflow-foundation-4-0-web-service/#comments</comments>
		<pubDate>Tue, 10 May 2011 12:19:41 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WFF]]></category>
		<category><![CDATA[WFF4.0]]></category>
		<category><![CDATA[WorkFlow]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2011/05/10/workflow-foundation-4-0-web-service/</guid>
		<description><![CDATA[Introduction The new Workflow has introduced new project type called WCF Workflow Service Application that can be hosted in a web service, which provides an ideal way to expose workflow solutions to non-workflow clients such as web applications. A web service receives a request, performs some appropriate processing, and returns a response. Sample senario The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=457&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>The new Workflow has introduced new project type called WCF Workflow Service Application that can be hosted in a web service, which provides an ideal way to expose workflow solutions to non-workflow clients such as web applications. A web service receives a request, performs some appropriate processing, and returns a response.</p>
<p><strong>Sample senario</strong></p>
<p>The new project we will create is a BookInventory module used for looks up the specified book and returns the status of each copy that the library owns.</p>
<p><strong>Implementation</strong></p>
<p>To start using the new WCF Workflow service open Visual Studio 2010 and select files -&gt;New project and select WCF Workflow service Application from list of project templates available for Workflow as shown in the below picture</p>
<p><a href="http://mohammedatef.files.wordpress.com/2011/05/clip_image002.jpg"><img style="display:inline;border:0;" title="clip_image002" src="http://mohammedatef.files.wordpress.com/2011/05/clip_image002_thumb.jpg?w=559&#038;h=281" alt="clip_image002" width="559" height="281" border="0" /></a></p>
<p>You could name enter project name &#8220;WCFSampleWF&#8221;, once we have created the new project you will find new file added to your project called <em><span style="text-decoration:underline;">BookInventory.xamlx </span></em>this file will contains the following (Sequence, Receive and Send) activities as shown in the below picture</p>
<p><a href="http://mohammedatef.files.wordpress.com/2011/05/clip_image00216.jpg"><img style="display:inline;border:0;" title="clip_image002[16]" src="http://mohammedatef.files.wordpress.com/2011/05/clip_image00216_thumb.jpg?w=364&#038;h=264" alt="clip_image002[16]" width="364" height="264" border="0" /></a></p>
<p>Now we are going to build the service contract Interface and it&#8217;s implementation class also we are going to build class that will hold the Book Info, to do that we are going to add new *.cs file named &#8220;BookInfo&#8221; that will contain the following implementation list of codes.</p>
<div style="font-size:8pt;overflow:auto;width:98.23%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 2:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 3:</span> <span style="color:#0000ff;">using</span> System.Runtime.Serialization;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 4:</span> <span style="color:#0000ff;">using</span> System.ServiceModel;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 5:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 6:</span> <span style="color:#0000ff;">namespace</span> BookInventory</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 7:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 8:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 9:</span>     <span style="color:#008000;">// Define the service contract, IBookInventory</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 10:</span>     <span style="color:#008000;">// which consists of a single method, LookupBook() </span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 11:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 12:</span>     [ServiceContract]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 13:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">interface</span> IBookInventory</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 14:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 15:</span>         [OperationContract]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 16:</span>         BookInfoList LookupBook(BookSearch request);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 17:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 18:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 19:</span>     <span style="color:#008000;">// Define the request message, BookSearch</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 20:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 21:</span>     [MessageContract(IsWrapped = <span style="color:#0000ff;">false</span>)]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 22:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> BookSearch</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 23:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 24:</span>         <span style="color:#0000ff;">private</span> String _ISBN;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 25:</span>         <span style="color:#0000ff;">private</span> String _Title;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 26:</span>         <span style="color:#0000ff;">private</span> String _Author;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 27:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 28:</span>         <span style="color:#0000ff;">public</span> BookSearch()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 29:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 30:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 31:</span>         <span style="color:#0000ff;">public</span> BookSearch(String title, String author, String isbn)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 32:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 33:</span>             _Title = title;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 34:</span>             _Author = author;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 35:</span>             _ISBN = isbn;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 36:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 37:</span>         <span style="color:#cc6633;">#region</span> Public Properties</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 38:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 39:</span>         <span style="color:#0000ff;">public</span> String Title</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 40:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 41:</span>             get { <span style="color:#0000ff;">return</span> _Title; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 42:</span>             set { _Title = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 43:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 44:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 45:</span>         <span style="color:#0000ff;">public</span> String Author</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 46:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 47:</span>             get { <span style="color:#0000ff;">return</span> _Author; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 48:</span>             set { _Author = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 49:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 50:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 51:</span>         <span style="color:#0000ff;">public</span> String ISBN</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 52:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 53:</span>             get { <span style="color:#0000ff;">return</span> _ISBN; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 54:</span>             set { _ISBN = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 55:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 56:</span>         <span style="color:#cc6633;">#endregion</span> Public Properties</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 57:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 58:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 59:</span>     <span style="color:#008000;">// Define the BookInfo class</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 60:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 61:</span>     [MessageContract(IsWrapped = <span style="color:#0000ff;">false</span>)]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 62:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> BookInfo</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 63:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 64:</span>         <span style="color:#0000ff;">private</span> Guid _InventoryID;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 65:</span>         <span style="color:#0000ff;">private</span> String _ISBN;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 66:</span>         <span style="color:#0000ff;">private</span> String _Title;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 67:</span>         <span style="color:#0000ff;">private</span> String _Author;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 68:</span>         <span style="color:#0000ff;">private</span> String _Status;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 69:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 70:</span>         <span style="color:#0000ff;">public</span> BookInfo()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 71:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 72:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 73:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 74:</span>         <span style="color:#0000ff;">public</span> BookInfo(String title, String author, String isbn,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 75:</span>             String status)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 76:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 77:</span>             _Title = title;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 78:</span>             _Author = author;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 79:</span>             _ISBN = isbn;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 80:</span>             _Status = status;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 81:</span>             _InventoryID = Guid.NewGuid();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 82:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 83:</span>         <span style="color:#cc6633;">#region</span> Public Properties</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 84:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 85:</span>         <span style="color:#0000ff;">public</span> Guid InventoryID</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 86:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 87:</span>             get { <span style="color:#0000ff;">return</span> _InventoryID; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 88:</span>             set { _InventoryID = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 89:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 90:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 91:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 92:</span>         <span style="color:#0000ff;">public</span> String Title</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 93:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 94:</span>             get { <span style="color:#0000ff;">return</span> _Title; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 95:</span>             set { _Title = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 96:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 97:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 98:</span>         <span style="color:#0000ff;">public</span> String Author</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 99:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 100:</span>             get { <span style="color:#0000ff;">return</span> _Author; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 101:</span>             set { _Author = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 102:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 103:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 104:</span>         <span style="color:#0000ff;">public</span> String ISBN</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 105:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 106:</span>             get { <span style="color:#0000ff;">return</span> _ISBN; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 107:</span>             set { _ISBN = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 108:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 109:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 110:</span>         <span style="color:#0000ff;">public</span> String status</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 111:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 112:</span>             get { <span style="color:#0000ff;">return</span> _Status; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 113:</span>             set { _Status = <span style="color:#0000ff;">value</span>; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 114:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 115:</span>         <span style="color:#cc6633;">#endregion</span> Public Properties</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 116:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 117:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 118:</span>     <span style="color:#008000;">// Define the response message, BookInfoList, which</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 119:</span>     <span style="color:#008000;">// is a list of BookInfo classes</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 120:</span>     <span style="color:#008000;">/*****************************************************/</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 121:</span>     [MessageContract(IsWrapped = <span style="color:#0000ff;">false</span>)]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 122:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> BookInfoList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 123:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 124:</span>         <span style="color:#0000ff;">private</span> List&lt;BookInfo&gt; _BookList;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 125:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 126:</span>         <span style="color:#0000ff;">public</span> BookInfoList()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 127:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 128:</span>             _BookList = <span style="color:#0000ff;">new</span> List&lt;BookInfo&gt;();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 129:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 130:</span>         [MessageBodyMember]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 131:</span>         <span style="color:#0000ff;">public</span> List&lt;BookInfo&gt; BookList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 132:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 133:</span>             get { <span style="color:#0000ff;">return</span> _BookList; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 134:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 135:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 136:</span> }</pre>
</div>
</div>
<p>The above code has the following classes and interface</p>
<p>1- IBookInventory is The service contract Interface that contains a single method called LookupBook(). It is has one paramter BookSearch class that has various properties that can be used to find the desired book, such as Author and Title. It returns a BookInfoList class, which contains a collection of BookInfo classes.</p>
<p>2- BookSearch is a class used for building the request that hold the Book Search criteria If you do not have experince about WCF service you should know that The MessageContract attribute is used on a class that defines the data types or contracts that will be added to a message header or body of your WCF service, and the class contains this attribute should have another attribute called MessageBodyMember for properties that will be used in the WCF request or response.</p>
<p>3- BookInfo is a class that hold book info and you can notice that it has MessageContract and MessageBodyMember attributes which means it will be used be service request or response</p>
<p>4- BookInfoList is a class Define the response message, BookInfoList, which is a list of BookInfo classes.</p>
<p><span style="text-decoration:underline;"><em>Now we are going to Configure the Send and receive activities, so please follow these steps</em></span></p>
<p>a- select the “ReceiveRequest” activity. In the Properties window, Enter the OperationName as <em><span style="text-decoration:underline;">LookupBook</span></em></p>
<p>b- From the workflow designer, click the Variables control at the bottom left. You’ll notice that the template created a couple of variables for you. The <em><span style="text-decoration:underline;">handle </span></em>variable is used to correlate the response with the same instance that sent the request. The data variable was set up as the data being passed in.</p>
<p>Select the data variable and press the Delete key to remove it, Create two new variables.</p>
<p><span style="text-decoration:underline;"><em>For the first one</em></span>, enter the Name as <em><span style="text-decoration:underline;">search</span></em>; for the Variable type, select Browse for Types, In the dialog that appears, expand the WFFAndWCF-&gt;BookInventory assembly and choose the BookSearch class.</p>
<p><span style="text-decoration:underline;"><em>For the second variable</em></span>, enter the Name as <em><span style="text-decoration:underline;">result</span></em>. For the Variable type property, choose Browse for Types and then select the BookInfoList class</p>
<p>c- On the workflow designer, the “ReceiveRequest” activity has a <em>View message </em>link for the Content property. Click it to display the dialog that is used to define the incoming message. The input can be defined in two ways: a message or a collection of parameters. For now, make sure that the Message radio button is selected.For the Message data property, enter <em><span style="text-decoration:underline;">search</span></em>. It specifies that the incoming message should be stored in the search variable. For the Message type, select BookInventory.BookSearch.</p>
<p>d- Select the “SendResponse” activity and click its <em>View message </em>link. Again, make sure that the Message radio button is selected. For the Message data property, enter <em><span style="text-decoration:underline;">result</span></em>; for the Message type property, select the <em><span style="text-decoration:underline;">BookInfoList </span></em>class.</p>
<p>For the Message data property, enter <em><span style="text-decoration:underline;">search</span></em>.</p>
<p><strong>Creating Custom activity for Looks up Book Status</strong></p>
<p>We will create a custom activity to perform the “lookup.” Actually, it will simply return</p>
<p>some hard-coded data and to do that please follow these few steps</p>
<p>a- From the Solution Explorer, right-click the WCFSampleWF project and choose Add -&gt; New Item. In the Add New Item dialog, select the Code Activity template from the Workflow category. Enter the Name as &#8220;PerformLookup.cs&#8221;</p>
<p>b- Enter the implementation of the PerformLookup activity, as shown in Listing below</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 2:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 3:</span> <span style="color:#0000ff;">using</span> System.Linq;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 4:</span> <span style="color:#0000ff;">using</span> System.Text;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 5:</span> <span style="color:#0000ff;">using</span> System.Activities;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 6:</span> <span style="color:#0000ff;">namespace</span> BookInventory</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 7:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 8:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 9:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">sealed</span> <span style="color:#0000ff;">class</span> PerformLookup : CodeActivity</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 10:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 11:</span>         <span style="color:#0000ff;">public</span> InArgument&lt;BookSearch&gt; Search { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 12:</span>         <span style="color:#0000ff;">public</span> OutArgument&lt;BookInfoList&gt; BookList { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 13:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">void</span> Execute(CodeActivityContext context)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 14:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 15:</span>             <span style="color:#0000ff;">string</span> author = Search.Get(context).Author;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 16:</span>             <span style="color:#0000ff;">string</span> title = Search.Get(context).Title;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 17:</span>             <span style="color:#0000ff;">string</span> isbn = Search.Get(context).ISBN;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 18:</span>             BookInfoList l = <span style="color:#0000ff;">new</span> BookInfoList();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 19:</span>             l.BookList.Add(<span style="color:#0000ff;">new</span> BookInfo(title, author, isbn, <span style="color:#006080;">"Available"</span>));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 20:</span>             l.BookList.Add(<span style="color:#0000ff;">new</span> BookInfo(title, author, isbn, <span style="color:#006080;">"CheckedOut"</span>));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 21:</span>             l.BookList.Add(<span style="color:#0000ff;">new</span> BookInfo(title, author, isbn, <span style="color:#006080;">"Missing"</span>));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 22:</span>             l.BookList.Add(<span style="color:#0000ff;">new</span> BookInfo(title, author, isbn, <span style="color:#006080;">"Available"</span>));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 23:</span>             BookList.Set(context, l);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 24:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 25:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 26:</span> }</pre>
</div>
</div>
<p>The above list is very clear it is creating two input/ouput arguments called search and booklist for using in send request and receive response from in the Workflow activities, then in the execute it is retrieving search criteria from the search argument and build collection of bookinfo and set booklist argument with the generated list of bookinfo if you did not understand how two build Custom Code activity please visit the following link WFF custom code activity.</p>
<p>c- build the project and opened BookInventory.xamlx file you will notice that the custom PerformLookup activity is added in your Toolbox</p>
<p>d- Drag a PerformLookup activity between the “Receive Request” and “Send Response” activities.</p>
<p>e- Select the PerformLookup activity. In the Properties window, for the BookList property enter result;for the Search property, enter search.</p>
<p>Testing the Service the new Visual Studio automatically starts the WCF Test Client. This is a very handy utility. It loads the web service and discovers the methods that are provided.all you need to press f5 and you find the below figure that shown the test client utility:</p>
<p><a href="http://mohammedatef.files.wordpress.com/2011/05/clip_image00218.jpg"><img style="display:inline;border:0;" title="clip_image002[18]" src="http://mohammedatef.files.wordpress.com/2011/05/clip_image00218_thumb.jpg?w=570&#038;h=374" alt="clip_image002[18]" width="570" height="374" border="0" /></a></p>
<p>As shown in the above figure the left pane contains the methods that are provided by the WCF service once you Double-click the LookupBook() method, the upper portion of the right pane will provide a place for you to enter the contents of the incoming message. Enter an author, ISBN number, and title; then click the Invoke button. You should see results similar to the ones shown bottom grid found in the same figure.</p>
<p><strong>Creating a Client Workflow</strong></p>
<p>Now we are going to build and client Workflow application that will use the created WCF application we have finished before, simply we can do that in few steps as shown below</p>
<p>a- Right click into WCFSampleWF solution name and choose Add -&gt; New Project. Select the Workflow Console Application template from installed templates related to workflow in the left pane of create new project window and for the project name, enter BookLookup</p>
<p>b-From the Solution Explorer, right-click the BookLookup project and choose Add Service Reference and add the following url into address attribute <a href="http://localhost:49570/BookInventory.xamlx">http://localhost:49570/BookInventory.xamlx</a></p>
<p>, press GO button and finally enter the name of namespace property as &#8220;BookEnventoryWCF&#8221;.</p>
<p>c- Once you have built the solution you will find new activity added to your toolbar called LookupBook as shown in the below figure</p>
<p><a href="http://mohammedatef.files.wordpress.com/2011/05/clip_image00220.jpg"><img style="display:inline;border:0;" title="clip_image002[20]" src="http://mohammedatef.files.wordpress.com/2011/05/clip_image00220_thumb.jpg?w=244&#038;h=80" alt="clip_image002[20]" width="244" height="80" border="0" /></a></p>
<p>d- Drag that LookupBook activity to you Workflow</p>
<p>e- create arguments that used by the LookupBook activities as show in the below figure</p>
<p><a href="http://mohammedatef.files.wordpress.com/2011/05/clip_image00222.jpg"><img style="display:inline;border:0;" title="clip_image002[22]" src="http://mohammedatef.files.wordpress.com/2011/05/clip_image00222_thumb.jpg?w=524&#038;h=99" alt="clip_image002[22]" width="524" height="99" border="0" /></a></p>
<p><em>Note that the BookList argument should be of type &#8220;BookLookupClientWF.BookEnventoryWCF.BookInfo[]&#8220;</em></p>
<p>f- Set the LookupBook properties to the with the matches argument names</p>
<p>g- Open the Program.cs file in the BookLookupClientWF project. add The implementation for this file as shown in Listing below</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 2:</span> <span style="color:#0000ff;">using</span> System.Linq;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 3:</span> <span style="color:#0000ff;">using</span> System.Activities;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 4:</span> <span style="color:#0000ff;">using</span> System.Activities.Statements;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 5:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 6:</span> <span style="color:#0000ff;">using</span> BookLookupClientWF.BookEnventoryWCF;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 7:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 8:</span> <span style="color:#0000ff;">namespace</span> BookLookupClientWF</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 9:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 10:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 11:</span>     <span style="color:#0000ff;">class</span> Program</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 12:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 13:</span>         <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Main(<span style="color:#0000ff;">string</span>[] args)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 14:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 15:</span>             <span style="color:#008000;">// create dictionary with input arguments for the workflow</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 16:</span>             IDictionary&lt;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&gt; input = <span style="color:#0000ff;">new</span> Dictionary&lt;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 17:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 18:</span>             { <span style="color:#006080;">"Author"</span> , <span style="color:#006080;">"Margaret Mitchell"</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 19:</span>             { <span style="color:#006080;">"Title"</span> , <span style="color:#006080;">"Gone with the Wind"</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 20:</span>             { <span style="color:#006080;">"ISBN"</span> , <span style="color:#006080;">"1234567890123"</span> }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 21:</span>             };</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 22:</span>             <span style="color:#008000;">// execute the workflow</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 23:</span>             IDictionary&lt;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&gt; output =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 24:</span>             WorkflowInvoker.Invoke(<span style="color:#0000ff;">new</span> Workflow1(), input);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 25:</span>             BookInfo[] l = output[<span style="color:#006080;">"BookList"</span>] <span style="color:#0000ff;">as</span> BookInfo[];</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 26:</span>             <span style="color:#0000ff;">if</span> (l != <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 27:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 28:</span>                 <span style="color:#0000ff;">foreach</span> (BookInfo i <span style="color:#0000ff;">in</span> l)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 29:</span>                 {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 30:</span>                     Console.WriteLine(<span style="color:#006080;">"{0}: {1}, {2}"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 31:</span>                     i.Title, i.status, i.InventoryID);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 32:</span>                 }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 33:</span>             }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 34:</span>             <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 35:</span>                 Console.WriteLine(<span style="color:#006080;">"No items were found"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 36:</span>             Console.WriteLine(<span style="color:#006080;">"Press ENTER to exit"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 37:</span>             Console.ReadLine();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 38:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 39:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;"> 40:</span> }</pre>
</div>
</div>
<p>i-  run the application you will find the following message printed in the console screen</p>
<p><span style="color:#0000ff;font-size:x-small;"><em>Gone with the Wind: Available, 58ab51cd-2796-4b32-a7be-21170f1e922b</p>
<p>Gone with the Wind: CheckedOut, 64406a94-a6ef-45a7-8373-066f5f991134</em></span></p>
<p>Gone with the Wind: Missing, a37186ec-faa7-4e6b-8226-484f17075998</p>
<p>Gone with the Wind: Available, e34d39e5-aafa-4fd3-8000-664809b7e98d</p>
<p>Press ENTER to exit</p>
<p>You can download the complete source code from <a href="http://www.box.net/shared/7q1l1up0ia" target="_blank">here</a></p>
<p><a href="http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/">Back to other Workflow Foundation 4.0  posts</a></p>
<p>I hope that helped</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/457/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=457&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2011/05/10/workflow-foundation-4-0-web-service/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2011/05/clip_image002_thumb.jpg" medium="image">
			<media:title type="html">clip_image002</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2011/05/clip_image00216_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[16]</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2011/05/clip_image00218_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[18]</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2011/05/clip_image00220_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[20]</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2011/05/clip_image00222_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[22]</media:title>
		</media:content>
	</item>
		<item>
		<title>Activate ActiveX control using Javascript</title>
		<link>http://mohammedatef.wordpress.com/2011/01/20/activate-activex-control-using-javascript/</link>
		<comments>http://mohammedatef.wordpress.com/2011/01/20/activate-activex-control-using-javascript/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 08:23:49 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[Asp.net]]></category>
		<category><![CDATA[ActiveX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">http://mohammedatef.wordpress.com/?p=443</guid>
		<description><![CDATA[Introduction           Today I am going to talk about common issue most of developer faces when they are trying to use an ActiveX control in his web page, and they want user to use the control without click it twice. Problem                 When web developer use an ActiveX control in his web page, users of this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=443&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>          Today I am going to talk about common issue most of developer faces when they are trying to use an ActiveX control in his web page, and they want user to use the control without click it twice.</p>
<p><strong>Problem</strong></p>
<p>                When web developer use an ActiveX control in his web page, users of this web page should click twice on the ActiveX control first click to activate the ActiveX control and second time to use the control.</p>
<p><strong>Solution</strong></p>
<p>                Solving the above issue is very simple just follow the below steps:</p>
<ol>
<li> Download and Add <a title="this Javascript file " href="http://www.box.net/shared/gdinvs4y5l" target="_blank">this Javascript file</a> to your web application</li>
<li> Add the following line before the end body tag in your web&lt;/body&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;virtual path of added JS file in step1&#8243;/&gt;</li>
</ol>
<p>Note, I have read many articles for fixing this problem but most of them not working and need to write Javascript codes but <a title="this article" href="http://www.senchiu.de/iefix/iefix.html" target="_blank">this article</a> only was working, so I have wrote this post to give you the best solution I have found after long time of search.</p>
<p>I hope That Helped.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/443/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=443&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2011/01/20/activate-activex-control-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>
	</item>
		<item>
		<title>2010 in review</title>
		<link>http://mohammedatef.wordpress.com/2011/01/03/2010-in-review/</link>
		<comments>http://mohammedatef.wordpress.com/2011/01/03/2010-in-review/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 05:27:31 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
		
		<guid isPermaLink="false">http://mohammedatef.wordpress.com/?p=440</guid>
		<description><![CDATA[The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health: The Blog-Health-o-Meter™ reads Fresher than ever. Crunchy numbers The average container ship can carry about 4,500 containers. This blog was viewed about 24,000 times in 2010. If each view were [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=440&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health:</p>
<p><img style="border:1px solid #ddd;background:#f5f5f5;padding:20px;" src="http://s0.wp.com/i/annual-recap/meter-healthy3.gif" alt="Healthy blog!" width="250" height="183" /></p>
<p>The <em>Blog-Health-o-Meter™</em> reads Fresher than ever.</p>
<h2>Crunchy numbers</h2>
<p><a href="http://mohammedatef.files.wordpress.com/2009/05/wcf2.jpg"><img style="max-height:230px;float:right;border:1px solid #ddd;background:#fff;margin:0 0 1em 1em;padding:6px;" src="http://mohammedatef.files.wordpress.com/2009/05/wcf2.jpg?w=288" alt="Featured image" /></a></p>
<p>The average container ship can carry about 4,500 containers. This blog was viewed about <strong>24,000</strong> times in 2010. If each view were a shipping container, your blog would have filled about 5 fully loaded ships.</p>
<p>In 2010, there were <strong>11</strong> new posts, growing the total archive of this blog to 64 posts. There were <strong>26</strong> pictures uploaded, taking up a total of 921kb. That&#8217;s about 2 pictures per month.</p>
<p>The busiest day of the year was September 28th with <strong>148</strong> views. The most popular post that day was <a style="color:#08c;" href="http://mohammedatef.wordpress.com/2009/05/19/wcf-bindingbasichttpbinding-vs-wshttpbinding/">WCF Binding:BasicHttpBinding vs WsHttpBinding</a>.</p>
<h2>Where did they come from?</h2>
<p>The top referring sites in 2010 were <strong>google.com</strong>, <strong>google.co.in</strong>, <strong>eggheadcafe.com</strong>, <strong>social.msdn.microsoft.com</strong>, and <strong>stackoverflow.com</strong>.</p>
<p>Some visitors came searching, mostly for <strong>biztalk architecture</strong>, <strong>wcf wshttpbinding</strong>, <strong>vs2010 configuration manager</strong>, <strong>basichttpbinding https</strong>, and <strong>wshttpbinding</strong>.</p>
<h2>Attractions in 2010</h2>
<p>These are the posts and pages that got the most views in 2010.</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">1</div>
<p><a style="margin-right:10px;" href="http://mohammedatef.wordpress.com/2009/05/19/wcf-bindingbasichttpbinding-vs-wshttpbinding/">WCF Binding:BasicHttpBinding vs WsHttpBinding</a> <span style="color:#999;font-size:8pt;">May 2009</span><br />
4 comments</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">2</div>
<p><a style="margin-right:10px;" href="http://mohammedatef.wordpress.com/2009/06/07/biztalk-custom-excel-pipeline-component/">BizTalk Custom Excel Pipeline Component</a> <span style="color:#999;font-size:8pt;">June 2009</span><br />
9 comments</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">3</div>
<p><a style="margin-right:10px;" href="http://mohammedatef.wordpress.com/2009/06/13/biztalk-2009-orchestration-debugging/">BizTalk 2009 Orchestration Debugging</a> <span style="color:#999;font-size:8pt;">June 2009</span><br />
3 comments</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">4</div>
<p><a style="margin-right:10px;" href="http://mohammedatef.wordpress.com/2009/07/08/exposing-wcf-services-from-orchestrations-using-biztalk-2009/">Exposing WCF services from orchestrations using BizTalk 2009</a> <span style="color:#999;font-size:8pt;">July 2009</span></p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">5</div>
<p><a style="margin-right:10px;" href="http://mohammedatef.wordpress.com/2009/07/16/using-nintex-workflow-with-microsoft-sharepoint-server-2007/">Using NinTex Workflow with Microsoft SharePoint Server 2007</a> <span style="color:#999;font-size:8pt;">July 2009</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/440/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=440&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2011/01/03/2010-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>

		<media:content url="http://s0.wp.com/i/annual-recap/meter-healthy3.gif" medium="image">
			<media:title type="html">Healthy blog!</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2009/05/wcf2.jpg?w=288" medium="image">
			<media:title type="html">Featured image</media:title>
		</media:content>
	</item>
		<item>
		<title>Passing MS Sales Specialist</title>
		<link>http://mohammedatef.wordpress.com/2010/12/14/passing-ms-sales-specialist/</link>
		<comments>http://mohammedatef.wordpress.com/2010/12/14/passing-ms-sales-specialist/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 13:42:39 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[Developement]]></category>
		<category><![CDATA[Sales Specialist]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2010/12/14/passing-ms-sales-specialist/</guid>
		<description><![CDATA[Hi , Today I have passed Microsoft Certification sales specialist for levels 50 and 100 . Really I have gained huge amount of knowledge, so that I recommend to every software engineers or sales or presales or MS application architectures to study this training. The below image has all tracks I have studied and passed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=434&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi ,</p>
<p>Today I have passed Microsoft Certification sales specialist for levels 50 and 100 .</p>
<p>Really I have gained huge amount of knowledge, so that I recommend to every software engineers or sales or presales or MS application architectures to study this training.</p>
<p>The below image has all tracks I have studied and passed its assessment</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/12/licencecert.jpg"><img style="display:inline;border:0;" title="Licencecert" src="http://mohammedatef.files.wordpress.com/2010/12/licencecert_thumb.jpg?w=606&#038;h=317" border="0" alt="Licencecert" width="606" height="317" /></a></p>
<p>Each training contains the following Knowledge recourses (handouts, explanatory presentations with audio, and assessment).</p>
<p>So now, I am going to list all training module and introduction for each one</p>
<table border="1" cellspacing="0" cellpadding="2" width="621">
<tbody>
<tr>
<td width="265" valign="top"><strong>Module</strong></td>
<td width="354" valign="top"><strong>Introduction</strong></td>
</tr>
<tr>
<td width="265" valign="top">Microsoft Products</td>
<td width="354" valign="top">This module lead you to understand the Microsoft product set and know what type of application a product is, and understand the fundamentals of the product functionality.</td>
</tr>
<tr>
<td width="265" valign="top">Microsoft Licensing</td>
<td width="354" valign="top">This module lead you to understand the fundamental knowledge of both Microsoft&#8217;s licensing programs and the licensing models used to license Microsoft software</td>
</tr>
<tr>
<td width="265" valign="top">Windows Client, Windows Server, and Microsoft Office Licensing</td>
<td width="354" valign="top">This module lead you to understand the basics of licensing the Windows client, Windows Server, and Microsoft Office</td>
</tr>
<tr>
<td width="265" valign="top">Infrastructure Servers Licensing</td>
<td width="354" valign="top">This module lead you to  understand the fundamental licensing knowledge of key Microsoft infrastructure servers</td>
</tr>
<tr>
<td width="265" valign="top">Application Servers Licensing</td>
<td width="354" valign="top">This module lead you to  understand the fundamental principles of licensing key application servers</td>
</tr>
<tr>
<td width="265" valign="top">Security and Management Servers Licensing</td>
<td width="354" valign="top">This module lead you to  understand the Microsoft management and security solution products</td>
</tr>
<tr>
<td width="265" valign="top">Selling Volume Licensing to SMBs</td>
<td width="354" valign="top">This module lead you to  understand the fundamental knowledge of the Microsoft Volume Licensing programs aimed at small and medium businesses.</td>
</tr>
<tr>
<td width="265" valign="top">Selling Software Assurance to SMBs</td>
<td width="354" valign="top">This module lead you to  understand the fundamental knowledge required to successfully position Software Assurance to small and medium businesses</td>
</tr>
<tr>
<td width="265" valign="top">Selling Volume Licensing to LORGs</td>
<td width="354" valign="top">This module lead you to  understand fundamental knowledge of the Microsoft Volume Licensing programs aimed at large organizations</td>
</tr>
</tbody>
</table>
<p>Hurry up and study this training.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=434&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2010/12/14/passing-ms-sales-specialist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/12/licencecert_thumb.jpg" medium="image">
			<media:title type="html">Licencecert</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow Foundation 4.0 Collections</title>
		<link>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-collections/</link>
		<comments>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-collections/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 09:53:01 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WFF]]></category>
		<category><![CDATA[WFF 4.0]]></category>
		<category><![CDATA[WorkFlow]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-collections/</guid>
		<description><![CDATA[Introduction In this post we will see an important built in activities comes with Workflow foundation 4.0., these built-in activities enable you to manipulate a collection in your workflow. this post guide you to do the most required actions for manipulating collections like add,remove and delete items from collection and sorting, searching and clearing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=429&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>In this post we will see an important built in activities comes with Workflow foundation 4.0., these built-in activities enable you to manipulate a collection in your workflow. this post guide you to do the most required actions for manipulating collections like add,remove and delete items from collection and sorting, searching and clearing the collection.</p>
<p>We will build a console application that demonstrates these activities using a Book Store application.</p>
<p><strong>Building Book Store application<br />
</strong>To build the Book Store application you should follow the below steps</p>
<p>1- Create new console application and add <span style="color:#800080;">System.Activities</span> reference to the new project</p>
<p>2- Open the <span style="color:#800080;">program.cs</span> file and add the following list of code for declaring <span style="color:#800080;">BookStoreListItem</span> this class contains a few public properties that store information about an item to be stored.</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> BookStoreListItem</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> Description { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> Quantity { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">decimal</span> UnitPrice { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> Author { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> BookName { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>         <span style="color:#0000ff;">public</span> BookStoreListItem(<span style="color:#0000ff;">string</span> description, <span style="color:#0000ff;">int</span> quantity, <span style="color:#0000ff;">decimal</span> unitPrice,<span style="color:#0000ff;">string</span> author, <span style="color:#0000ff;">string</span> bookName)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>             Description = description;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>             Quantity = quantity;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>             UnitPrice = unitPrice;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>             BookName = bookName;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span>             Author = author;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>         <span style="color:#0000ff;">public</span> BookStoreListItem(<span style="color:#0000ff;">string</span> bookName)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  18:</span>             BookName= bookName;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  19:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  20:</span>     }</pre>
</div>
</div>
<p>3- Initiate the Workflow by adding the following namespace to the top of <span style="color:#800080;">program</span>.cs class</p>
<p>using <span style="color:#800080;">System.Activities.Expressions</span>; now add the following list of code after the closed practices for the main method in the <span style="color:#800080;">program</span>.cs class</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> Activity CollectionWF()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>             <span style="color:#008000;">// myList is a collection of ListItem objects</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>             Variable&lt;ICollection&lt;BookStoreListItem&gt;&gt; myList = <span style="color:#0000ff;">new</span> Variable&lt;ICollection&lt;BookStoreListItem&gt;&gt;()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>                 Name = <span style="color:#006080;">"MyList"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>                 Default = <span style="color:#0000ff;">new</span> LambdaValue&lt;ICollection&lt;BookStoreListItem&gt;&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>                     (env =&gt; <span style="color:#0000ff;">new</span> List&lt;BookStoreListItem&gt;())</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>             };</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">new</span> Sequence</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>                 Variables = { myList },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>                 Activities =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span>                 {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span>                     <span style="color:#0000ff;">new</span> WriteLine</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span>                         Text = <span style="color:#006080;">"Workflow starting..."</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  18:</span>                     },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  19:</span>                     <span style="color:#0000ff;">new</span> AddToCollection&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  20:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  21:</span>                         Collection = myList,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  22:</span>                         Item = <span style="color:#0000ff;">new</span> LambdaValue&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  23:</span>                         (env =&gt; <span style="color:#0000ff;">new</span> BookStoreListItem(<span style="color:#006080;">"New WorkFlow 4.0 book"</span>, 5, 50,<span style="color:#006080;">"Mohammed"</span>, <span style="color:#006080;">"WorkFlow 4.0"</span>))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  24:</span>                     },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  25:</span>                     <span style="color:#0000ff;">new</span> AddToCollection&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  26:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  27:</span>                         Collection = myList,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  28:</span>                         Item = <span style="color:#0000ff;">new</span> LambdaValue&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  29:</span>                         (env =&gt; <span style="color:#0000ff;">new</span> BookStoreListItem(<span style="color:#006080;">"New Linq 4.0 book"</span>, 3, 30,<span style="color:#006080;">"Sherif"</span>, <span style="color:#006080;">"LINQ 4.0"</span>))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  30:</span>                     },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  31:</span>                     <span style="color:#0000ff;">new</span> AddToCollection&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  32:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  33:</span>                         Collection = myList,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  34:</span>                         Item = <span style="color:#0000ff;">new</span> LambdaValue&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  35:</span>                         (env =&gt; <span style="color:#0000ff;">new</span> BookStoreListItem(<span style="color:#006080;">"New Windows Communication Foundation 4.0 book"</span>, 8, 80,<span style="color:#006080;">"Atef"</span>, <span style="color:#006080;">"WCF 4.0"</span>))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  36:</span>                     },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  37:</span>                     <span style="color:#0000ff;">new</span> AddToCollection&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  38:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  39:</span>                         Collection = myList,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  40:</span>                         Item = <span style="color:#0000ff;">new</span> LambdaValue&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  41:</span>                         (env =&gt; <span style="color:#0000ff;">new</span> BookStoreListItem(<span style="color:#006080;">"Visual studio 2010 book"</span>, 15, 40,<span style="color:#006080;">"Khalid"</span>, <span style="color:#006080;">"VS 2010"</span>))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  42:</span>                     },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  43:</span>                     <span style="color:#0000ff;">new</span> WriteLine</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  44:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  45:</span>                         Text = <span style="color:#006080;">"Workflow ended"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  46:</span>                     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  47:</span>                 }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  48:</span>             };</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  49:</span>         }</pre>
</div>
</div>
<p>This workflow defines a variable that is a collection of <span style="color:#800080;">BookStoreListItem</span> classes named <span style="color:#800080;">myList</span>. The variable can be any <em><span style="color:#800080;">typeof</span></em> collection that supports the <span style="color:#800080;">ICollection</span> interface.the <span style="color:#800080;">LambdaValue</span> Represents a lambda expression used as an r-value, which supports binding of In arguments so it is bind the default value of myList with the returned new instance of BookStoreListItem class .</p>
<p>After that we are going to build the sequence activity for our workflow and the sequence activity will have the following activities</p>
<blockquote><p>a- <span style="color:#800080;">writeline</span> activity that printing <span style="color:#808080;">&#8220;Workflow starting&#8230;&#8221;</span></p>
<p>b- four <span style="color:#800080;">AddToCollection</span> activity that used for adding new item of BookStoreListItem to myList</p>
<p>c- another <span style="color:#800080;">writeline</span> activity to print <span style="color:#808080;">&#8220;Workflow ended&#8230;&#8221;</span></p></blockquote>
<p>4- Now we need to invoke the workflow, so please add the following lines of code in the main method at <span style="color:#800080;">program</span>.cs class</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> WorkflowInvoker.Invoke(CollectionWF());</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> Console.WriteLine(<span style="color:#006080;">"Press ENTER to exit"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> Console.ReadLine();</pre>
</div>
</div>
<p>These few line of code used to invoke the workflow by calling <span style="color:#800080;">collectionWF</span> into the Invoke method.</p>
<p>If you have run the application now you will find the following lines printed</p>
<p><span style="color:#808080;">Workflow starting&#8230;</span></p>
<p><span style="color:#808080;">Workflow ended&#8230;</span></p>
<p><span style="color:#808080;">Press ENTER to exit</span></p>
<p>5- <em><span style="text-decoration:underline;">Printing Collection</span></em> , we will provide a way to display the contents of the books list, to do that right-click the project and choose Add new Item and select Class, For the class name, enter <em><span style="color:#800080;">PrintBooksList.cs</span></em>. The implementation of this class is shown in Listing below</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">using</span> System.Activities;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> <span style="color:#0000ff;">namespace</span> WFFBookStoreApp</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">sealed</span> <span style="color:#0000ff;">class</span> <em><span style="color:#800080;">PrintBooksList</span></em>: CodeActivity</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>         <span style="color:#0000ff;">public</span> InArgument&lt;ICollection&lt;BookStoreListItem&gt;&gt; Collection { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">void</span> Execute(CodeActivityContext context)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>             ICollection&lt;BookStoreListItem&gt; list =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>             <span style="color:#0000ff;">this</span>.Collection.Get&lt;ICollection&lt;BookStoreListItem&gt;&gt;(context);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span>             <span style="color:#0000ff;">if</span> (list.Count == 0)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>                 Console.WriteLine(<span style="color:#006080;">"The Book list is empty"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span>             }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  18:</span>             <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  19:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  20:</span>                 <span style="color:#0000ff;">foreach</span> (BookStoreListItem l <span style="color:#0000ff;">in</span> list)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  21:</span>                 {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  22:</span>                     Console.WriteLine(<span style="color:#006080;">"Book Named {0} has the following information :"</span>, l.BookName);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  23:</span>                     Console.WriteLine(<span style="color:#006080;">"(Description:{0} ,Quantity: {1},Price: {2} ,Author {3})"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  24:</span>                     l.Description,l.Quantity.ToString(), l.UnitPrice, l.Author);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  25:</span>                 }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  26:</span>                 Console.WriteLine();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  27:</span>             }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  28:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  29:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  30:</span> }</pre>
</div>
</div>
<p>This custom activity receives the collection as an input argument. It expects a collection of BookStoreListItem classes. the overridden execute method first check if the list empty or not, if yes it is printing <span style="color:#808080;">the book list is empty</span> message, else it is loop throw the list and print each book item information, this code is very simple you can understand but if you do not know how to create custom activity please visit the following link <a href="http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-custom-activities/" target="_blank">WFF 4.0 custom activity</a>.</p>
<p>6- To use this custom activity, Open the <span style="color:#800080;">program</span>.cs file and add the following activity definition to the <span style="color:#800080;">collectionWF</span> () method before the final <span style="color:#800080;">writeline</span> activity</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">new</span> PrintBooksList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>                         Collection=myList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>                     },</pre>
</div>
</div>
<p>If you run the application now you will find the following message printed</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/09/clip_image0022.jpg"><img style="display:inline;border:0;" title="clip_image002" src="http://mohammedatef.files.wordpress.com/2010/09/clip_image002_thumb2.jpg?w=572&#038;h=143" border="0" alt="clip_image002" width="572" height="143" /></a></p>
<p>7- <span style="text-decoration:underline;"><em>Sorting the collection</em></span>, we will provide a way to sort the books list by book price, to do that right-click the project and choose Add new Item and select Class, For the class name, enter <em><span style="color:#800080;">SortBooksList.cs</span></em>. The implementation of this class is shown in Listing below</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">using</span> System.Activities;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> <span style="color:#0000ff;">namespace</span> WFFBookStoreApp</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">sealed</span> <span style="color:#0000ff;">class</span> SortBooksList : CodeActivity</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>         <span style="color:#0000ff;">public</span> InOutArgument&lt;ICollection&lt;BookStoreListItem&gt;&gt; Collection { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">void</span> Execute(CodeActivityContext context)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>             ICollection&lt;BookStoreListItem&gt; tempList = <span style="color:#0000ff;">this</span>.Collection.Get&lt;ICollection&lt;BookStoreListItem&gt;&gt;(context);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>             <span style="color:#0000ff;">if</span> (tempList.Count &gt; 0)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>             {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span>                 List&lt;BookStoreListItem&gt; sortedList = <span style="color:#0000ff;">new</span> List&lt;BookStoreListItem&gt;(tempList);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span>                 ItemComparer c = <span style="color:#0000ff;">new</span> ItemComparer();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>                 sortedList.Sort(c <span style="color:#0000ff;">as</span> IComparer&lt;BookStoreListItem&gt;);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span>                 Collection.Set(context, sortedList <span style="color:#0000ff;">as</span> ICollection&lt;BookStoreListItem&gt;);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  18:</span>             }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  19:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  20:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  21:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> ItemComparer : IComparer&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  22:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  23:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> Compare(BookStoreListItem x, BookStoreListItem y)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  24:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  25:</span>             <span style="color:#008000;">// Handle null arguments</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  26:</span>             <span style="color:#0000ff;">if</span> (x == <span style="color:#0000ff;">null</span> &amp;&amp; y == <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  27:</span>                 <span style="color:#0000ff;">return</span> 0;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  28:</span>             <span style="color:#0000ff;">if</span> (x == <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  29:</span>                 <span style="color:#0000ff;">return</span> -1;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  30:</span>             <span style="color:#0000ff;">if</span> (y == <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  31:</span>                 <span style="color:#0000ff;">return</span> 1;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  32:</span>             <span style="color:#008000;">// Perform comparison based on the priority</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  33:</span>             <span style="color:#0000ff;">if</span> (x.UnitPrice == y.UnitPrice)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  34:</span>                 <span style="color:#0000ff;">return</span> 0;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  35:</span>             <span style="color:#0000ff;">if</span> (x.UnitPrice &gt; y.UnitPrice)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  36:</span>                 <span style="color:#0000ff;">return</span> 1;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  37:</span>             <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  38:</span>                 <span style="color:#0000ff;">return</span> -1;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  39:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  40:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  41:</span> }</pre>
</div>
</div>
<p>This custom activity receives the collection as an input argument and return the same argument after sorting it. It expects a collection of BookStoreListItem classes .the overridden Execute() method of this activity takes a collection as both an input and output argument.The <em>Sort</em>() method of the List class is used to perform the sort, but you must supply a class that implements the <span style="color:#800080;">IComparer</span> interface because the standard implementation will not know how to sort <span style="color:#800080;">BookStoreListItem</span> objects. The <span style="color:#800080;">IComparer</span> interface provides a single method called <span style="color:#800080;">Comparer</span> (), which receives two objects (x and y) as input parameters. It returns 0 if the two objects are equal, 1 if x is greater than y, and -1 if x is less than y.</p>
<p>8- To use this custom activity, Open the Program.cs file and add the following activity definition to the <span style="color:#800080;">collectionWF</span> () method before the final <span style="color:#800080;">writeline</span> activity</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">new</span> SortBooksList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     Collection=myList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> <span style="color:#0000ff;">new</span> WriteLine</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     Text = <span style="color:#006080;">"Books List sorted by Price"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span> <span style="color:#0000ff;">new</span> PrintBooksList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>     Collection=myList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span> },</pre>
</div>
</div>
<p>If you run the application now you will find the following message printed</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/09/clip_image00271.jpg"><img style="display:inline;border:0;" title="clip_image002[7]" src="http://mohammedatef.files.wordpress.com/2010/09/clip_image0027_thumb1.jpg?w=590&#038;h=237" border="0" alt="clip_image002[7]" width="590" height="237" /></a></p>
<p>if you have reviewed the printed lines in console, you will find the new books listed after line &#8220;<span style="color:#808080;">books list sorted by price are order</span> desc by price.</p>
<p>9- <span style="text-decoration:underline;"><em>Searching in the collection</em></span>, now we are going to use built in activity in Workflow Foundation 4.0 like <span style="color:#800080;"><em>ExistsInCollection</em></span>, so we will check if the item found in the book list or not.</p>
<p>As the <span style="color:#800080;"><em>ExistsInCollection </em></span>should iterate between books list items so it is require to use <span style="color:#800080;">Equals</span>() methods which mean we need to implement this method to our <span style="color:#800080;">BookStoreListItem</span> class, For our purposes, you should consider two items equal if they have the same name,To do that add the following list of code to BookStoreListItem class in <span style="color:#800080;">program</span>.cs file</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">bool</span> Equals(<span style="color:#0000ff;">object</span> obj)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     BookStoreListItem i = obj <span style="color:#0000ff;">as</span> BookStoreListItem;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>     <span style="color:#0000ff;">if</span> (i == <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>         <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>     <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>         <span style="color:#0000ff;">if</span> (i.BookName == <span style="color:#0000ff;">this</span>.BookName)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>         <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span> }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">int</span> GetHashCode()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>     <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">base</span>.GetHashCode();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span> }</pre>
</div>
</div>
<p>The <span style="color:#800080;">Equals</span>() method cast the input object to a <span style="color:#800080;">BookStoreListItem</span> and returns True if the <em>BookName </em>property matches. When overriding the Equals() method, the compiler expects you to also override the <span style="color:#800080;">GetHashCode</span>() method. This implementation simply calls the base method</p>
<p>10- Now , we can use <span style="color:#800080;"><em>ExistsInCollection </em></span>to do that add the following lines of code before the final <span style="color:#800080;">writeline</span> activity</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">bool</span> Equals(<span style="color:#0000ff;">object</span> obj)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>        {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>            BookStoreListItem i = obj <span style="color:#0000ff;">as</span> BookStoreListItem;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>            <span style="color:#0000ff;">if</span> (i == <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>            <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>            {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>                <span style="color:#0000ff;">if</span> (i.BookName == <span style="color:#0000ff;">this</span>.BookName)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>                    <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>                <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>                    <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>            }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>        }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span>        <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">int</span> GetHashCode()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span>        {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span>            <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">base</span>.GetHashCode();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span>        }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  18:</span></pre>
</div>
</div>
<p>If you have run the application now you will see this line printed before workflow ended</p>
<p><span style="color:#808080;">&#8220;LINQ 4.0 Book has been added before&#8221;</span></p>
<p>11-<span style="text-decoration:underline;"><em> Remove item from Collection</em></span>, Workflow Foundation 4.0 has activity named <span style="color:#800080;">RemoveFromCollection</span> that is responsible for removing item from collection it very easy in implementation, we will use it to remove book named &#8220;<span style="color:#808080;">LINQ 4.0</span>&#8220;,to do that add the following line of code before the final <span style="color:#800080;">writeline</span> activity</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">new</span> WriteLine</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     Text = <span style="color:#006080;">"Removing LINQ 4.0 book from Books Store..."</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> <span style="color:#0000ff;">new</span> RemoveFromCollection&lt;BookStoreListItem&gt;()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     Collection = myList,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>     Item = <span style="color:#0000ff;">new</span> LambdaValue&lt;BookStoreListItem&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>         (env =&gt; <span style="color:#0000ff;">new</span> BookStoreListItem(<span style="color:#006080;">"LINQ 4.0"</span>))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span> <span style="color:#0000ff;">new</span> PrintBooksList()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span>     Collection = myList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span> },</pre>
</div>
</div>
<p>if you have run the application now you will see the following lines printed before workflow ended line</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/09/clip_image00291.jpg"><img style="display:inline;border:0;" title="clip_image002[9]" src="http://mohammedatef.files.wordpress.com/2010/09/clip_image0029_thumb1.jpg?w=576&#038;h=126" border="0" alt="clip_image002[9]" width="576" height="126" /></a></p>
<p>12- <span style="text-decoration:underline;"><em>Clearing the collection</em></span>, Workflow Foundation 4.0 has built in activity to clear collection named <span style="color:#808080;">ClearCollection</span> to use this activity add the following lines of code before the final writeline activity</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">new</span> ClearCollection&lt;BookStoreListItem&gt;()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     Collection = myList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> <span style="color:#0000ff;">new</span> PrintBooksList()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>     Collection = myList</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span> },</pre>
</div>
</div>
<p>If you have run the application now you will find line printed before workflow ended that says</p>
<p><span style="color:#808080;">&#8220;The book list is Empty&#8221;</span></p>
<p><strong>Conclusion:</strong></p>
<p>I was trying to learn you how WFF 4.0 are manipulation with collection,you can download The complete implementation of that post from here and you can return back to workflow posts list <a href="http://www.box.net/shared/62mixgr5fl" target="_blank">here</a></p>
<p><a href="http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/">Back to other Workflow Foundation 4.0  posts</a></p>
<p>I Hope that helped</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/429/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=429&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-collections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/09/clip_image002_thumb2.jpg" medium="image">
			<media:title type="html">clip_image002</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/09/clip_image0027_thumb1.jpg" medium="image">
			<media:title type="html">clip_image002[7]</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/09/clip_image0029_thumb1.jpg" medium="image">
			<media:title type="html">clip_image002[9]</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow Foundation 4.0 Custom activities</title>
		<link>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-custom-activities/</link>
		<comments>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-custom-activities/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 09:14:43 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WFF]]></category>
		<category><![CDATA[WFF 4.0]]></category>
		<category><![CDATA[WorkFlow]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-custom-activities/</guid>
		<description><![CDATA[WFF 4.0 helps you to implement you own custom activity. sure creating custom activity is very important part that all Workflow developers are interested in.the new Workflow Foundation 4.0 give you two ways of generating custom activities. As we need to prove concept only, my custom activity will be simple, just I am going to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=418&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>WFF 4.0 helps you to implement you own custom activity. sure creating custom activity is very important part that all Workflow developers are interested in.the new Workflow Foundation 4.0 give you two ways of generating custom activities.<br />
As we need to prove concept only, my custom activity will be simple, just I am going to build custom activity that print the message &#8220;<em><span style="text-decoration:underline;">Hello FirstName Last Name</span></em>&#8221; this custom activity taking two input parameters First Name and Last Name and return the full message,let&#8217;s see how to implement this simple example by Workflow Foundation 4.0.</p>
<p><strong>Using </strong><strong>Code Activity template</strong></p>
<p>Code activity template give you advantage to inherit the <span style="color:#800080;"><em>codeactivity</em></span> class and build your custom activity from scratch but the new Workflow Foundation helps you to do that in easy way, so to implement the new custom activity follow the following steps</p>
<p>1- Open Visual Studio 2010 and select <em><span style="text-decoration:underline;">file-&gt;new project-&gt;workflow-&gt;workflow consol application</span></em></p>
<p>2- In the name textbox write <em>CustomactivitySample</em> as the project name</p>
<p>3- After the solution has opened right click in the project name and select <em>add new item</em> that will open the list of items as shown in the below picture</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/09/clip_image0021.jpg"><img style="display:inline;border:0;" title="clip_image002" src="http://mohammedatef.files.wordpress.com/2010/09/clip_image002_thumb1.jpg?w=580&#038;h=222" border="0" alt="clip_image002" width="580" height="222" /></a></p>
<p>select code activity and enter code activity name such as &#8220;<em>HelloMsg</em>&#8220;<br />
4- By default you with find the below list of code has been generated in your new file that named <em>HelloMsg.cs</em></p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">sealed</span> <span style="color:#0000ff;">class</span> HelloMsg : CodeActivity</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>         <span style="color:#008000;">// Define an activity input argument of type string</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>         <span style="color:#0000ff;">public</span> InArgument&lt;<span style="color:#0000ff;">string</span>&gt; Text { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>         <span style="color:#008000;">// If your activity returns a value, derive from CodeActivity&lt;TResult&gt;</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>         <span style="color:#008000;">// and return the value from the Execute method.</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">void</span> Execute(CodeActivityContext context)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>             <span style="color:#008000;">// Obtain the runtime value of the Text input argument</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>             <span style="color:#0000ff;">string</span> text = context.GetValue(<span style="color:#0000ff;">this</span>.Text);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>     }</pre>
</div>
</div>
<p>5- Now we are going to add our code for printing hello message</p>
<blockquote><p>- First we will prepare the activity parameters, so replace line no 4 in the above codes list with the following list of codes</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> InArgument&lt;<span style="color:#0000ff;">string</span>&gt; FirstName { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">public</span> InArgument&lt;<span style="color:#0000ff;">string</span>&gt; LastName { get; set; }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> <span style="color:#0000ff;">public</span> OutArgument&lt;<span style="color:#0000ff;">string</span>&gt; HelloMessgae { get; set; }</pre>
</div>
</div>
<p>As shown in the above codes list we have declared two input parameters first name and last name and one output parameter for returning the complete hello message.</p>
<p>- The last step for implementing this custom activity is to add code for using input parameters and concatenating it to return the complete hello message, so please replace line 10 at the codes list in step 4 with the following list of codes</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">string</span> fname = context.GetValue(<span style="color:#0000ff;">this</span>.FirstName);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">string</span> lname = context.GetValue(<span style="color:#0000ff;">this</span>.LastName);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> <span style="color:#0000ff;">string</span> completeMsg = <span style="color:#006080;">" Hello "</span> + fname +<span style="color:#006080;">" "</span>+ lname;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> context.SetValue(<span style="color:#0000ff;">this</span>.HelloMessgae, completeMsg);</pre>
</div>
</div>
</blockquote>
<p>6- Build the project to refresh the toolbar, and you will notice new activity <em><span style="color:#800080;">hellomsg</span></em> activity has been added to the toolbar.</p>
<p>7- Open <em>Workflow1.xaml</em> in designer view and drag sequence activity then drag <em><span style="color:#800080;">hellomsg</span></em> and <em><span style="color:#800080;">writeline</span></em> activity by ordered in the new added sequence activity</p>
<p>8- Create variable named <em>fullname</em> and has data type string from the variables window at bottom of the <em>workflow1</em> designer</p>
<p>9-Open the <em><span style="color:#800080;">writeline</span></em> property windows and set the text property to the new created variable name in the previous step</p>
<p>10- Open the <em><span style="color:#800080;">hellomsg</span></em> property window and set it is properties as follow:</p>
<blockquote><p>a- FirstName: &#8220;Mohammed&#8221;</p>
<p>b- Last Name: &#8220;Atef&#8221;</p>
<p>c- HelloMessage: fullname which added in step no 8</p></blockquote>
<p>Finally run the application you will see this message in the console window</p>
<p><span style="color:#808080;">&#8220;Hello Mohammed Atef&#8221;</span></p>
<p><strong>Using </strong><strong>Activity </strong></p>
<p>Using the activity you can create your own activity and use it in another work flow as independent activity and you can pass parameters between your activity and the main workflow designer</p>
<p>This kind of activities is very simple as you are using the workflow designer with all toolbar activities available to implement you custom activity.</p>
<p>We are going to do the same business scenario in the previous example but we will add the following message before the hello message &#8220;Custom Activity using Designer.&#8221; this only to determine the message printed for each custom activity.</p>
<p>Now , to implement the new custom activity follow the following steps</p>
<p>1- Write click into the project name and select add new item then select activity icon from the windows as shown in picture below</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/09/clip_image0024.jpg"><img style="display:inline;border:0;" title="clip_image002[4]" src="http://mohammedatef.files.wordpress.com/2010/09/clip_image0024_thumb.jpg?w=576&#038;h=209" border="0" alt="clip_image002[4]" width="576" height="209" /></a></p>
<p>name that activity <em><span style="color:#800080;">hellomsgActivity.xaml</span></em></p>
<p>2- Drag sequence activity to the new created activity named <em><span style="color:#800080;">hellomsgActivity.xaml </span></em>and then drag <em><span style="color:#800080;">writeline</span></em> activity into the sequence activity</p>
<p>3- Add two arguments from arguments window below the designer of that activity named <em><span style="color:#800080;">hellomsgActivity.xaml</span></em></p>
<p>4- Write the following line into the text property of the <em><span style="color:#800080;">writeline</span></em> activity</p>
<p><span style="color:#808080;">&#8220;Custom Activity using Designer: Hello Mr. &#8221; + FName + LName</span></p>
<p>5- Build the application</p>
<p>6- Open the main <em>workflow1.xaml</em> in design mode and drag <span style="color:#800080;">hellomsgActivity</span> activity from the toolbar</p>
<p>7- Open the hellomsgActivity property window and set it is properties as follows</p>
<blockquote><p>a- FName:&#8221;Mohammed&#8221;</p>
<p>b-LName:&#8221;Atef&#8221;</p></blockquote>
<p>Now Run the application you will find the following messages are printed</p>
<blockquote><p><span style="color:#808080;">Hello Mohammed Atef&#8221;</span></p>
<p><span style="color:#808080;">Custom Activity using Designer: Hello Mr. Mohammed Atef&#8221;</span></p></blockquote>
<p>Now we have finished this example and the main workflow1.xaml should be like the following picture below</p>
<p><a href="http://mohammedatef.files.wordpress.com/2010/09/clip_image0026.jpg"><img style="display:inline;border:0;" title="clip_image002[6]" src="http://mohammedatef.files.wordpress.com/2010/09/clip_image0026_thumb.jpg?w=614&#038;h=413" border="0" alt="clip_image002[6]" width="614" height="413" /></a></p>
<p>You can also download the complete example by source code from <a href="http://www.box.net/shared/cahgfhbg46" target="_blank">here</a>.<br />
<a title="WFF 4.0" href="http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/" target="_self">Back to other Workflow Foundation 4.0  posts</a></p>
<p>I hope that helped.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/418/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=418&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-custom-activities/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/09/clip_image002_thumb1.jpg" medium="image">
			<media:title type="html">clip_image002</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/09/clip_image0024_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[4]</media:title>
		</media:content>

		<media:content url="http://mohammedatef.files.wordpress.com/2010/09/clip_image0026_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[6]</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow Foundation 4.0 Tracking</title>
		<link>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-tracking/</link>
		<comments>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-tracking/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 08:43:35 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WFF]]></category>
		<category><![CDATA[WFF 4.0]]></category>
		<category><![CDATA[WorkFlow]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-tracking/</guid>
		<description><![CDATA[Introduction This post will guide you to use extensions for tracking Workflow events while it is executing the defined activities.This is useful for monitoring a workflow’s execution and for triggering external processing. Tracking In WF 4.0, tracking is accomplished through tracking participants, which are extensions that are derived from the TrackingParticipant abstract class. First of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=407&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size:medium;">Introduction</span></strong></p>
<p>This post will guide you to use extensions for tracking Workflow events while it is executing the defined activities.This is useful for monitoring a workflow’s execution and for triggering external processing.</p>
<p><strong><strong> </strong><span style="font-size:medium;">Tracking</span><br />
</strong>In WF 4.0, tracking is accomplished through tracking participants, which are extensions that are derived<br />
from the <em><span style="color:#800080;">TrackingParticipant</span></em> abstract class.<br />
First of all to implement tracking extensions you need to inherit <em><span style="color:#800080;">TrackingParticipant</span></em> class and overrides the <em><span style="color:#800080;">Track</span></em>() method, which is where most of the work is done. When a <em><span style="color:#800080;">trackable</span></em> event occurs, the workflow instance will enumerate all the extensions and will call the <em><span style="color:#800080;">Track</span></em>() method in any that are derived from the <em><span style="color:#800080;">TrackingParticipant</span></em> base class.<br />
A <em><span style="color:#800080;">TrackingRecord</span></em> is passed into the <em><span style="color:#800080;">Track</span></em>() method. This is an abstract class; the actual instance passed<br />
in will be one of the following classes, which are derived from the <em><span style="color:#800080;">TrackingRecord</span></em> class:<br />
• <strong>WorkflowInstanceRecord</strong> contains data about the workflow instance.<br />
You can use this class to print the Workflow instance ID and Workflow instance state as shown in the below list of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> WorkflowInstanceRecord instance = record <span style="color:#0000ff;">as</span> WorkflowInstanceRecord;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">if</span> (instance != <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> Console.WriteLine(String.Format(<span style="color:#006080;">" InstanceID: {0} State: {1}"</span>,instance.InstanceId, instance.State));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> }</pre>
</div>
</div>
<p>• <strong>BookmarkResumptionRecord</strong> contains data about the bookmark being resumed.</p>
<p>You can use this class to print the book mark name as shown in the below list of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> BookmarkResumptionRecord bookmark = record <span style="color:#0000ff;">as</span> BookmarkResumptionRecord;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">if</span> (bookmark != <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> Console.WriteLine(String.Format(<span style="color:#006080;">" Bookmark {0} resumed"</span>,bookmark.BookmarkName));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> }</pre>
</div>
</div>
<p>• <strong>ActivityStateRecord</strong> contains data about a specific activity.</p>
<p>You can use this class to print information about activities hosted in the Workflow instance as shown in the below list of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> ActivityStateRecord activity = record <span style="color:#0000ff;">as</span> ActivityStateRecord;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">if</span> (activity != <span style="color:#0000ff;">null</span>)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> IDictionary&lt;String, <span style="color:#0000ff;">object</span>&gt; variables = activity.Variables;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> StringBuilder s = <span style="color:#0000ff;">new</span> StringBuilder();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span> <span style="color:#0000ff;">if</span> (variables.Count &gt; 0)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span> s.AppendLine(<span style="color:#006080;">" Variables:"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span> <span style="color:#0000ff;">foreach</span> (KeyValuePair&lt;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&gt; v <span style="color:#0000ff;">in</span> variables)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span> s.AppendLine(String.Format(<span style="color:#006080;">" {0} Value: [{1}]"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span> v.Key, v.Value));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span> }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  14:</span> }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  15:</span> Console.WriteLine(String.Format(<span style="color:#006080;">" Activity: {0} State: {1} {2}"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  16:</span> activity.Activity.Name, activity.State, s.ToString()));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  17:</span> }</pre>
</div>
</div>
<p>• <strong>CustomTrackingRecord</strong> contains user-defined data.</p>
<p>You can use this class to print about user-defined data as shown in the below list of codes</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> CustomTrackingRecord user = record <span style="color:#0000ff;">as</span> CustomTrackingRecord;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">if</span> ((user != <span style="color:#0000ff;">null</span>) &amp;&amp; (user.Data.Count &gt; 0))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> Console.WriteLine(String.Format(<span style="color:#006080;">" User Data: {0}"</span>, user.Name));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span> <span style="color:#0000ff;">foreach</span> (<span style="color:#0000ff;">string</span> data <span style="color:#0000ff;">in</span> user.Data.Keys)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span> Console.WriteLine(String.Format(<span style="color:#006080;">" {0} : {1}"</span>, data, user.Data[data]));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span> }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span> }</pre>
</div>
</div>
<p>To use the tracking extension you should add the tracking extension to the Workflow instance as shown in the below list of codes</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> i.Extensions.Add(_tracking);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#008000;">//where i is an instance of WorkflowApplication  </span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> <span style="color:#008000;">//and _tracking is an instance of class that inherits TrackingParticipant class</span></pre>
</div>
</div>
<p>Then you should set up the tracking extensions participants by using <span style="color:#800080;">TrackingProfile</span> collections, A <span style="color:#800080;">TrackingProfile</span> defines a collection of queries that specify which events are to be tracked by the associated tracking participant. These queries are used to determine if an event is <em><span style="color:#800080;">trackable</span></em>. The queries are stored in the Queries property, which is a collection of classes derived from the abstract <span style="color:#800080;">TrackingQuery</span> class. There are four derived classes that correspond to the four types of tracking records:</p>
<p>• <strong>WorkflowInstanceQuery</strong></p>
<p>A <em>WorkflowInstanceQuery</em> is used to define the workflow instance events that should be tracked. These</p>
<p>are the process states that occur at the instance level such as Started, Completed, Unloaded, and so on, To do that you can write the below list of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> TrackingProfile = <span style="color:#0000ff;">new</span> TrackingProfile()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     Name = <span style="color:#006080;">"TrackingProfileName"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>     Queries =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>         <span style="color:#008000;">// For instance data, only track the started and completed events</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>         <span style="color:#0000ff;">new</span> WorkflowInstanceQuery()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>             States = { WorkflowInstanceStates.Started,WorkflowInstanceStates.Completed },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span> }</pre>
</div>
</div>
<p>• <strong>BookmarkResumptionQuery</strong></p>
<p>In a <em>BookmarkResumptionQuery</em>, you specify the name of the bookmark that you want to track whenever it is resumed. You can specify only a single bookmark in a query. If you want to track multiple bookmarks,</p>
<p>you should create multiple queries—one for each bookmark, To do that you can write the below list of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> TrackingProfile = <span style="color:#0000ff;">new</span> TrackingProfile()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     Name = <span style="color:#006080;">"TrackingProfileName"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>     Queries =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>         <span style="color:#0000ff;">new</span> BookmarkResumptionQuery()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>                       {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>                           Name = <span style="color:#006080;">"GetAssignment"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>                       }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span> }</pre>
</div>
</div>
<p>• <strong>ActivityStateQuery</strong></p>
<p>An <em>ActivityStateQuery</em> class specifies both the Name of the activity and the State collection (events) that</p>
<p>should be tracked. You can specify an asterisk (*) for either, which indicates that all activities and/or</p>
<p>states should be tracked, To do that you can write the below list of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> TrackingProfile = <span style="color:#0000ff;">new</span> TrackingProfile()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>                 {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>                     Name = <span style="color:#006080;">"ListBoxTrackingProfile"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>                     Queries =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>                         <span style="color:#008000;">// For activity data, track all states of the InvokeMethod</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>                        <span style="color:#0000ff;">new</span> ActivityStateQuery()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>                        {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>                            ActivityName = <span style="color:#006080;">"InvokeMethod"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>                            States = { <span style="color:#006080;">"*"</span> },</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>                        }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>                     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  13:</span> }</pre>
</div>
</div>
<p>• <strong>CustomTrackingQuery</strong></p>
<p>The <em>CustomTrackingQuery</em> specifies the ActivityName, which indicates the activity that generated the</p>
<p>CustomTrackingRecord and the Name property, which indicates the name given to the CustomTrackingRecord,You can specify an asterisk for either (or both) as the example, above does. When</p>
<p>both are set to *, it indicates that all user events should be tracked, you can do that by typing the below of codes:</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> TrackingProfile = <span style="color:#0000ff;">new</span> TrackingProfile()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span>                 {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>                     Name = <span style="color:#006080;">"ListBoxTrackingProfile"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>                     Queries =</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span>                     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>                         <span style="color:#0000ff;">new</span> CustomTrackingQuery()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>                         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>                             Name = <span style="color:#006080;">"*"</span>,</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>                             ActivityName = <span style="color:#006080;">"*"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span>                         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>                     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span> }</pre>
</div>
</div>
<p>In this post we have understood the Tracking extension and we have learned how to use it also.now you can visit the orher posts about Workflow Foundation for <a href="http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/" target="_blank">here</a></p>
<p>I hope that helped.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/407/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/407/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/407/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/407/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/407/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/407/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/407/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=407&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-tracking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow Foundation 4.0 Extensions</title>
		<link>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-extensions/</link>
		<comments>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-extensions/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 08:43:10 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[.Net 2010 | WorkFlow]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WFF]]></category>
		<category><![CDATA[WFF 4.0]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-extensions/</guid>
		<description><![CDATA[Introduction Workflow foundation Extensions allow you to add configurable behavior to a workflow solution. The activities that you include in your workflow define the steps that are performed, while the extensions provide the operating environment that these activities are executed in, the persistence extension is not aware of what activities are executed; the extension however, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=406&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size:medium;">Introduction</span><br />
</strong><br />
Workflow foundation Extensions allow you to add configurable behavior to a workflow solution. The activities that you include in your workflow define the steps that are performed, while the extensions provide the operating environment that these activities are executed in, the persistence extension is not aware of what activities are executed; the extension however, provides the ability to persist those activities (whatever they might be) to a durable store.</p>
<p><strong><span style="font-size:medium;">SQL Persistence Extension</span> </strong></p>
<p><strong> </strong></p>
<p>There are two key aspects of extensions that make then extremely useful. First, as was inferred<br />
earlier, they are configurable. For example, the persistence provider that was used <em><span style="color:#800080;">SqlWorkflowInstanceStore</span></em> was designed to use a SQL Server database. Without changing the<br />
application or the workflow definition.<br />
The second aspect of extensions is that they can be accessed both from the application as well as the<br />
workflow activities. This provides a convenient tool for sharing information between the application and<br />
the workflow.</p>
<p>To use SQL Persistence you need to declare a reference to the <span style="color:#800080;">InstanceStore</span> class that will be used to persist and load the workflow instances :</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">private</span> InstanceStore _instanceStore;</pre>
</div>
</div>
<p>Then add you need to Loaded event handler and configures the store to do that you need to write the following code</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> _instanceStore = <span style="color:#0000ff;">new</span> SqlWorkflowInstanceStore(_connectionString);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> InstanceView view = _instanceStore.Execute(_instanceStore.CreateInstanceHandle(),</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> <span style="color:#0000ff;">new</span> CreateWorkflowOwnerCommand(),TimeSpan.FromSeconds(30));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span> _instanceStore.DefaultInstanceOwner = view.InstanceOwner;</pre>
</div>
</div>
<p>where the _connectionstring is the DB sql connection string used for your SQL Persistence.above code has an <span style="color:#800080;">InstanceStore</span> that is an abstract class from which all persistence providers are derived. An instance of the concrete class <em><span style="color:#800080;">SqlWorkflowInstanceStore</span></em> is created, passing the connection string in the constructor.</p>
<p>The parameters to the Execute() method are a handle (provided by <span style="color:#800080;">InstanceStore</span> ), a command, and a</p>
<p>timeout value. It returns an <span style="color:#800080;">InstanceView</span> class, which is roughly analogous to a connection handle.</p>
<p>Now you need to setup The Workflow persistence, to do that add the following codes listed below</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> i.InstanceStore = _instanceStore;//where i is and instance of WorkflowApplication</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> i.PersistableIdle = (waiea) =&gt; PersistableIdleAction.Unload;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span> i.Run();</pre>
</div>
</div>
<p>The above code configures the workflow instance to be persisted. First, it sets the <span style="color:#800080;">InstanceStore</span></p>
<p>property using the reference created as described early. It then provides an event handler for</p>
<p>the <span style="color:#800080;">PersistableIdle</span> event, which tells the instance to unload itself from memory. It is persisted to the</p>
<p>database prior to being unloaded.</p>
<p><strong><span style="font-size:medium;">Custom Extensions</span> </strong></p>
<p><strong> </strong></p>
<p>here we will learn how to build a custom extension and how to use it in you Workflow. we are going to build simple custom extension that used to store the connection string, Instead of passing the connection string as an input argument, any activity that needs the connection string can access it from this extension.</p>
<p>Assume that we will create class called  that hold the custom extension and implemented as shown in list below</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> ConStringExtension</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   3:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   4:</span>         <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">string</span> _connectionString = <span style="color:#006080;">""</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   5:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   6:</span>         <span style="color:#0000ff;">public</span> DBExtension(<span style="color:#0000ff;">string</span> connectionString)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   7:</span>         {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   8:</span>             _connectionString = connectionString;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   9:</span>         }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  10:</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  11:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">string</span> ConnectionString { get { <span style="color:#0000ff;">return</span> _connectionString; } }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">  12:</span>     }</pre>
</div>
</div>
<p>The above code simply defines a private member that holds the connection string. The value of this string</p>
<p>is passed in the class constructor. A public property is provided for accessing this string.To add the new Custom extension to you Workflow instance add the following code</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> ConStringExtension _dbExtension = <span style="color:#0000ff;">new</span> ConStringExtension(_connectionString);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   2:</span> i.Extensions.Add(_dbExtension);</pre>
</div>
</div>
<p>Finally to use this custom extension into code activity add the following line</p>
<div style="font-size:8pt;overflow:auto;width:97.5%;cursor:text;max-height:200px;line-height:12pt;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;"><span style="color:#606060;">   1:</span> ConStringExtension ext = context.GetExtension&lt;ConStringExtension&gt;();</pre>
</div>
</div>
<p><em> </em>I hope you have understand Workflow extensions well ,now you can check other posts about work flow <a href="http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/" target="_blank">here</a></p>
<p>I hope that helped.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/406/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=406&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-extensions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>
	</item>
		<item>
		<title>Workflow Foundation 4.0</title>
		<link>http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/</link>
		<comments>http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 09:58:31 +0000</pubDate>
		<dc:creator>mohammedatef83</dc:creator>
				<category><![CDATA[.Net 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WFF]]></category>
		<category><![CDATA[WFF 4.0]]></category>
		<category><![CDATA[WorkFlow]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">https://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/</guid>
		<description><![CDATA[The new Workflow foundation comes with .Net Framework 4.0 that supports building and running the next generation of applications and services. The key components of the .NET Framework are the common language runtime (CLR) and the .NET Framework class library, which includes ADO.NET, ASP.NET, Windows Forms, and Windows Presentation Foundation (WPF), by the way all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=398&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The new Workflow foundation comes with .Net Framework 4.0 that supports building and running the next generation of applications and services. The key components of the .NET Framework are the common language runtime (CLR) and the .NET Framework class library, which includes ADO.NET, ASP.NET, Windows Forms, and Windows Presentation Foundation (WPF), by the way all Visual Studio 2010 IDE are build in XAML language that provides a managed execution environment, simplified development and deployment, and integration with a wide variety of programming languages.</p>
<p>In version 4 of the Microsoft® .NET Framework, Windows Workflow Foundation introduces a significant amount of change from the previous versions of the technology that shipped as part of .NET 3.0 and 3.5.</p>
<p>The significant changes made were necessary to provide the best experience for developers adopting WF and to enable WF to continue to be a strong foundational component that you can build on in your applications.</p>
<p>I have wrote this article to give you a start point to understand and study Workflow Foundation 4.0, so I am going to write series of posts about WFF 4.0 as found in the below below List</p>
<ul>
<li><a title="what's new in WFF 4.0" href="http://mohammedatef.wordpress.com/2010/09/20/whats-new-in-workflow-foundation-4-0/" target="_blank">What&#8217;s new in Workflow Foundation 4.0</a></li>
<li><a href="https://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-custom-activities/" target="_blank">Workflow Foundation 4.0 Custom activities</a></li>
<li><a href="http://mohammedatef.wordpress.com/2011/05/10/workflow-foundation-4-0-web-service/">Workflow Foundation 4.0 Web services</a></li>
<li><a href="http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-extensions/" target="_blank">Workflow Foundation 4.0 Extensions</a></li>
<li><a href="http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-tracking/" target="_blank">Workflow Foundation 4.0 Tracking</a></li>
<li>Workflow Foundation 4.0 Compensation,Confirmation and Cancellation</li>
<li><a href="http://mohammedatef.wordpress.com/2010/09/26/workflow-foundation-4-0-collections/" target="_blank">Workflow Foundation 4.0 Collections</a></li>
<li>Using WFF 3.5 activities in WFF 4.0</li>
</ul>
<p>I hope that helped</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohammedatef.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohammedatef.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mohammedatef.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mohammedatef.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohammedatef.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohammedatef.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohammedatef.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohammedatef.wordpress.com/398/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohammedatef.wordpress.com&amp;blog=6300005&amp;post=398&amp;subd=mohammedatef&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mohammedatef.wordpress.com/2010/09/20/workflow-foundation-4-0/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc85776d7778bd7ed2ad5c18982d82bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mada</media:title>
		</media:content>
	</item>
	</channel>
</rss>
