<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8040115472186352073</id><updated>2012-01-30T18:06:46.556+01:00</updated><title type='text'>my.net</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>80</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7807773660299966993</id><published>2012-01-30T18:05:00.001+01:00</published><updated>2012-01-30T18:06:46.569+01:00</updated><title type='text'>SQL Server Database Restore for Dummies – like me</title><content type='html'>&lt;p&gt;I got a SQL server (express) database backup (.bak file) from a customer to do a test against. In the past, I just restored from my own, previously existing databases, so I never came across the issue of restoring one from a complete different machine. Using SSMS I got the following error messages&lt;/p&gt;  &lt;p&gt;&lt;em&gt;The backup set holds a backup of a database other than the existing database&lt;/em&gt; – or&lt;/p&gt;  &lt;p&gt;&lt;em&gt;File 'Db' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.CUSTOMER\MSSQL\DATA\Db.mdf'. Use WITH MOVE to identify a valid location for the file&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;The path does not exist on my machine. After browsing the web I found out the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;create a new and empty database named as the one from the customer (in this case ‘Db’) &lt;/li&gt;    &lt;li&gt;use a script to run      &lt;p&gt;RESTORE DATABASE [Db]        &lt;br /&gt;FROM DISK = 'c:\theDbBackup.bak'         &lt;br /&gt;WITH &lt;strong&gt;&lt;font color="#809ec2"&gt;REPLACE&lt;/font&gt;           &lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7807773660299966993?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7807773660299966993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2012/01/sql-server-database-restore-for-dummies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7807773660299966993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7807773660299966993'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2012/01/sql-server-database-restore-for-dummies.html' title='SQL Server Database Restore for Dummies – like me'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5190195748964262871</id><published>2012-01-29T22:02:00.001+01:00</published><updated>2012-01-29T22:02:28.781+01:00</updated><title type='text'>Excellence in Software Engineering Conference 2012 - in Zurich</title><content type='html'>&lt;h4&gt;&amp;#160;&lt;/h4&gt;  &lt;p&gt;This year the ESE conference 2012 will take place in Zurich April 24. and 25. – hosted by Zühlke Engineering AG.&lt;/p&gt;  &lt;p&gt;That’s where software experts from around the world meet their peers and prominent speakers. The conference targets software architects, project managers, IT manager, process experts and all kinds of techies. Interactive discussion and talks are a major part of the two days.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-qMzuRpoFk14/TyWz4Z1JC0I/AAAAAAAABgg/aJPuornvxqE/s1600-h/image%25255B2%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-Jr-NXovsfH0/TyWz4-sJMmI/AAAAAAAABgk/KWCOgkEWFb0/image_thumb.png?imgmax=800" width="244" height="189" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There are three trendy tracks: Agile, Cloud and Mobile. See &lt;a href="http://eseconf.com/"&gt;this&lt;/a&gt; for more details. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5190195748964262871?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5190195748964262871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2012/01/excellence-in-software-engineering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5190195748964262871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5190195748964262871'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2012/01/excellence-in-software-engineering.html' title='Excellence in Software Engineering Conference 2012 - in Zurich'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/-Jr-NXovsfH0/TyWz4-sJMmI/AAAAAAAABgk/KWCOgkEWFb0/s72-c/image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8972232236480387109</id><published>2012-01-16T10:47:00.001+01:00</published><updated>2012-01-16T10:47:20.420+01:00</updated><title type='text'>Struggling with Azure SDK Samples –&gt; use Microsoft.ServiceBus.dll Version 1.6! or still 1.5?</title><content type='html'>&lt;p&gt;Got some issues recently with the Azure SDK samples (e.g. RelayedConnectionSample with NetTcp, MulticastSample, etc.). SecurityExceptions were thrown, etc.&lt;/p&gt;  &lt;p&gt;Until I noticed that the samples still reference the Microsoft.ServiceBus.dll in &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;version 1.5.0.0 under &lt;em&gt;c:\Program Files\Windows Azure AppFabric SDK\V1.5\Assemblies\NET4.0\&lt;/em&gt; instead of the latest one &lt;/li&gt;    &lt;li&gt;version 1.6.0.0 which is now installed under &lt;em&gt;C:\Program Files\Windows Azure SDK\v1.6\ServiceBus\ref&lt;/em&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So you need to&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;change assembly references to Microsoft.ServiceBus 1.6.0.0 &lt;/li&gt;    &lt;li&gt;change .config settings to 1.6.0.0 to: &lt;/li&gt; &lt;/ol&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;extensions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;bindingExtensions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;netEventRelayBinding&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Version=&lt;font style="background-color: #ffff00"&gt;1.6.0.0&lt;/font&gt;, Culture=neutral, PublicKeyToken=31bf3856ad364e35&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;bindingExtensions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;extensions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;runtime&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;assemblyBinding&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;urn:schemas-microsoft-com:asm.v1&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dependentAssembly&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;assemblyIdentity&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft.ServiceBus&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;publicKeyToken&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;31bf3856ad364e35&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;culture&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;neutral&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;bindingRedirect&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;oldVersion&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1.0.0.0&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;newVersion&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&lt;font style="background-color: #ffff00"&gt;1.6.0.0&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;dependentAssembly&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;assemblyBinding&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;runtime&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;and it works again.&lt;/p&gt;  &lt;p&gt;However, some of the samples did not with 1.6 but only with 1.5. Maybe I messed up with the latest SDK installation.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8972232236480387109?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8972232236480387109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2012/01/struggling-with-azure-sdk-samples-use.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8972232236480387109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8972232236480387109'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2012/01/struggling-with-azure-sdk-samples-use.html' title='Struggling with Azure SDK Samples –&amp;gt; use Microsoft.ServiceBus.dll Version 1.6! or still 1.5?'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-3782467348522123002</id><published>2012-01-16T10:42:00.001+01:00</published><updated>2012-01-16T10:42:13.371+01:00</updated><title type='text'>Azure Connect</title><content type='html'>&lt;p&gt;Using Windows “Azure Connect” - a service from the Windows Azure platform – one can establish a protected network connection between enterprise computers and the cloud roles (E2C). This virtual IPsec network allows for:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;easier migration of tiers of an applications to the cloud &lt;/li&gt;    &lt;li&gt;tunnel firewalls, proxies, NATs &lt;/li&gt;    &lt;li&gt;hybrid (cloud to on-premise) apps &lt;/li&gt;    &lt;li&gt;various higher-level communication protocols &lt;/li&gt;    &lt;li&gt;apps where the protocol might change &lt;/li&gt;    &lt;li&gt;have high number of communicating endpoints &lt;/li&gt;    &lt;li&gt;domain joins (some ActiveDirectory; logins) &lt;/li&gt;    &lt;li&gt;remote administration, debugging and troubleshooting &lt;/li&gt;    &lt;li&gt;DNS &lt;/li&gt;    &lt;li&gt;etc. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Setting up Connect is a 3 step process. There is a &lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/gg508836.aspx"&gt;tutorial&lt;/a&gt; showing all the details.&lt;/p&gt;  &lt;p&gt;1. Get an activation token from the Azure portal and configure your Azure roles to use it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-FECSCwg99M4/TxPw2sHALAI/AAAAAAAABfQ/zNR3xAhACBc/s1600-h/image31.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-eEot1yRR60s/TxPw3DSqPeI/AAAAAAAABfY/F6TH6Dj6YkI/image_thumb1.png?imgmax=800" width="731" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-AZxln6FRfIk/TxPw4MVAkpI/AAAAAAAABfg/C1EfX2AIEQE/s1600-h/image%25255B5%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-Z-3iaHCrlSI/TxPw5Aic85I/AAAAAAAABfo/YPQie_mFkSU/image_thumb%25255B3%25255D.png?imgmax=800" width="737" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Copy the token into your role’s properties / virtual network settings&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-TU1GhRtikGg/TxPw5kQUq-I/AAAAAAAABfs/tVlwkVl4PZs/s1600-h/image12.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-V3h3cfkKNnI/TxPw6VXvDVI/AAAAAAAABf4/zfOrcD7PrXc/image_thumb6.png?imgmax=800" width="737" height="267" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now you publish your Azure roles to the staging or production environment in the cloud. Wait until the service is ready and check that it appears in the portals “Virtual network” –&amp;gt; “Groups and Roles” and “Activated Endpoints”.&lt;/p&gt;  &lt;p&gt;2. Enable local machines to connect to roles in the cloud. Install the Connect Agent on local machines. Copy the link URL to a browser, download the configured executable and run it. A system tray icon like the following should appear&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-rx3t8gBpvLQ/TxPw7G3QmkI/AAAAAAAABf8/7L6icJHmSZ4/s1600-h/image3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-VSF1J0gZcBI/TxPw7cYAzWI/AAAAAAAABgE/XevoWk33-T0/image_thumb.png?imgmax=800" width="69" height="50" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. Pair the local machines and Azure roles in a “Group” (network policy). In the portal click Create Group&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-SIWlMAT2uPM/TxPw8NOD6wI/AAAAAAAABgM/LPtvoucJu2o/s1600-h/image9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-ydzpCgLmAu8/TxPw86EG8UI/AAAAAAAABgU/JEvXJLqrYyw/image_thumb41.png?imgmax=800" width="639" height="451" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The system tray icon should change to connected now.&lt;/p&gt;  &lt;p&gt;Please note that ping will not work until you enable it in your role using a startup task script. From my limited home network I experienced some significant (first-hit) network delays&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Pinging RD00155D3A622D [2a01:111:f102:121:858:cf20:a9dd:5639] with 32 bytes of data:      &lt;br /&gt;Reply from 2a01:111:f102:121:858:cf20:a9dd:5639: time=299ms       &lt;br /&gt;Reply from 2a01:111:f102:121:858:cf20:a9dd:5639: time=258ms       &lt;br /&gt;Reply from 2a01:111:f102:121:858:cf20:a9dd:5639: time=359ms       &lt;br /&gt;Reply from 2a01:111:f102:121:858:cf20:a9dd:5639: time=368ms&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Ping statistics for 2a01:111:f102:121:858:cf20:a9dd:5639:      &lt;br /&gt;Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),       &lt;br /&gt;Approximate round trip times in milli-seconds:       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Minimum = 258ms, Maximum = 368ms, Average = 321ms&lt;/em&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-3782467348522123002?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/3782467348522123002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2012/01/azure-connect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/3782467348522123002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/3782467348522123002'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2012/01/azure-connect.html' title='Azure Connect'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/-eEot1yRR60s/TxPw3DSqPeI/AAAAAAAABfY/F6TH6Dj6YkI/s72-c/image_thumb1.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5655300034559060611</id><published>2012-01-16T10:36:00.001+01:00</published><updated>2012-01-16T10:36:03.562+01:00</updated><title type='text'>Microsoft Azure SQL Data Sync</title><content type='html'>&lt;p&gt;Azure Data Sync let’s you synchronize enterprise (on-premise) SQL Server (2005 and above) databases with SQL Azure databases – or several SQL Azure databases. There is a local agent and a cloud sync group service necessary for it to work.&lt;/p&gt;  &lt;p&gt;This is the first preview from Nov 14 2011; let’s have a try.&lt;/p&gt;  &lt;p&gt;In the management portal navigation tree go to Data Sync, select a subscription, a data center region, &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-tR3zZNB_0BA/TxPvBntbrcI/AAAAAAAABaQ/7dAX9q3AAFc/s1600-h/image4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-xkoqH4i80Ks/TxPvCUmcNtI/AAAAAAAABaY/Tuhr5HCkfEA/image_thumb2.png?imgmax=800" width="522" height="318" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You now have two options: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-rdcM3g9I50o/TxPvC3Mo1QI/AAAAAAAABac/TYde44k621k/s1600-h/image15.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-41q-O-m2KPY/TxPvDrWAmuI/AAAAAAAABao/AOGvLABA5Co/image_thumb9.png?imgmax=800" width="1028" height="303" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Let’s synchronize on-prem and a cloud SQL Azure database. The wizard leads you through the configuration of a sync group&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-W14jLc_DexU/TxPvEgawVzI/AAAAAAAABaw/WxiHTOAaZKk/s1600-h/image16.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-R5m59iS5uc4/TxPvFqkBaNI/AAAAAAAABa4/zBvzAbsYc8I/image_thumb10.png?imgmax=800" width="876" height="421" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-mu5w-r1iUpk/TxPvGEtNTzI/AAAAAAAABa8/qF8NBxB5XcA/s1600-h/image21.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-JjZ4Sb0pQ88/TxPvG-qC0yI/AAAAAAAABbI/AidiNm5kfZ8/image_thumb13.png?imgmax=800" width="574" height="450" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-SCw4Oh2ATls/TxPvH1Kt_jI/AAAAAAAABbQ/ZSmi77M7M5o/s1600-h/image26.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-Qx75Ai5Mmvg/TxPvJPUYkSI/AAAAAAAABbY/dMhE1vA7YNg/image_thumb16.png?imgmax=800" width="577" height="502" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-Bl7_1SvCeog/TxPvJ58bCdI/AAAAAAAABbc/AX365_CfSCo/s1600-h/image31.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-p-hVbQGIMfo/TxPvKRP3QII/AAAAAAAABbo/YCdbuBsTfRQ/image_thumb19.png?imgmax=800" width="579" height="572" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?id=27693"&gt;Download&lt;/a&gt; and install the so called Sync Agent for the local server.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-28FqKl2V_R4/TxPvLYjFtKI/AAAAAAAABbs/rL0Pm3TMRAk/s1600-h/image36.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-WI5xVIPcCOQ/TxPvMJVAZqI/AAAAAAAABb0/E0nLpsKhGGM/image_thumb22.png?imgmax=800" width="584" height="495" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Then start the Data Sync Agent Preview from the start menu.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-vpa_N2WpUzI/TxPvMkvM2CI/AAAAAAAABb8/dKGv2Q3nmXY/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/--gLprKmCClI/TxPvNsy1o6I/AAAAAAAABcI/xRuwtxW4KBw/image_thumb%25255B1%25255D.png?imgmax=800" width="589" height="587" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now generate an agent key from the management portal and copy it into the local agent wizard.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-wPCALsVbHfc/TxPvOZIFNcI/AAAAAAAABcM/r-VMjkuKF50/s1600-h/image%25255B8%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-oMo-IX_QTd4/TxPvO1shT6I/AAAAAAAABcU/n-yWV7HSB_0/image_thumb%25255B3%25255D.png?imgmax=800" width="599" height="249" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Then register a SQL Server&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-nF7di2WngmY/TxPvPorm1hI/AAAAAAAABcg/AWfmnDWdzYI/s1600-h/image49.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-jDsx-bGmi2I/TxPvQTpCd1I/AAAAAAAABco/q6kbyJjF4Nc/image_thumb29.png?imgmax=800" width="586" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;to get&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-my-uUkPGSkc/TxPvRE2sLiI/AAAAAAAABcs/T_-BW11DvRw/s1600-h/image54.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-LSw2xOSiswM/TxPvRgPqFQI/AAAAAAAABc0/rZN1bG67w8I/image_thumb32.png?imgmax=800" width="586" height="474" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Back in the portal we add the agent to the Sync Group&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-4l4Tn5vV1XA/TxPvSNGfSJI/AAAAAAAABc8/arV6O0HXC5w/s1600-h/image59.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-0MEKYxj91KI/TxPvTHEewEI/AAAAAAAABdI/5_Re03Q3_6o/image_thumb35.png?imgmax=800" width="587" height="599" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now we are half way through. Now let’s add an SQL Azure database:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-EXlnjwQhoVY/TxPvT5cVMkI/AAAAAAAABdQ/EARbPi9Loio/s1600-h/image63.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-4eTyJR88x88/TxPvVIUlTgI/AAAAAAAABdY/O_3fyJ3tLDg/image_thumb37.png?imgmax=800" width="594" height="378" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Just creating a new SQL Azure database for this demo – and selecting it in Step 3 above.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-2Y5bvc1lKVE/TxPvVlVn2xI/AAAAAAAABdg/CCHcMC1YDbo/s1600-h/image%25255B12%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-KB5rbdGubGw/TxPvWhZv8tI/AAAAAAAABdo/JHxloukGQxU/image_thumb%25255B5%25255D.png?imgmax=800" width="603" height="566" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the following step (4) we configure the scheduling, and the conflict resolution (client or hub wins)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-0vjFcOo37ug/TxPvXKVHDjI/AAAAAAAABds/pgxPW5ZFGNc/s1600-h/image73.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-3VALrSg7TGM/TxPvX3QWRcI/AAAAAAAABd4/-pMtjdI1Ymc/image_thumb43.png?imgmax=800" width="598" height="445" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select the on-premise SQL database&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-nxkMYekXI-8/TxPvY2IBLzI/AAAAAAAABeA/VRMv7ajHxUU/s1600-h/image79.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-lPSPeFRsFH4/TxPvaMZVZjI/AAAAAAAABeI/iEJRh9-eDTw/image_thumb47.png?imgmax=800" width="598" height="775" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click deploy now&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-k6L4oFsJTR8/TxPvbXoibQI/AAAAAAAABeQ/87EPPbRmfys/s1600-h/image83.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-VNGyPmw_I1c/TxPvbzyhmPI/AAAAAAAABeU/bR6QXBBZl0k/image_thumb49.png?imgmax=800" width="842" height="147" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Done!&lt;/p&gt;  &lt;p&gt;Now, let’s see that it worked correctly. In the local Northwind database there are 2 people from Switzerland, add a row filter for Country = ‘Switzerland’. Then go the SSMS, connect the SQL Azure DB. There is a new dbo.Customers table now. Please also note the added tables for the change tracking. There are also some triggers and stored procedures added to your database. This may impact your runtime performance.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-ybS_FaxbKws/TxPvcWXr51I/AAAAAAAABec/ltbj8rN1VPU/s1600-h/image87.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-Z9erojaIyb8/TxPvdSgtIOI/AAAAAAAABeo/Xk-Vu-aVFgo/image_thumb51.png?imgmax=800" width="397" height="399" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There are the 2 rows as expected:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-A_y79vLFsLc/TxPvd8eOsoI/AAAAAAAABes/0QVOz6mFSU4/s1600-h/image91.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-El-0G5wvoK8/TxPveiRnrGI/AAAAAAAABe0/adlJ2THM92o/image_thumb53.png?imgmax=800" width="947" height="126" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That’s it again in the portal&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-j0_VUTIOVDg/TxPvfTTjy_I/AAAAAAAABfA/0-RjZNKQCMI/s1600-h/image98.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-HGOXZAp0yC4/TxPvgnoK73I/AAAAAAAABfI/GZnz1nKJ5cM/image_thumb58.png?imgmax=800" width="1488" height="698" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This was actually super simple to setup. There are some best practices out &lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/2172.aspx"&gt;there&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Negative point: there does not seem to exist an API or .NET library for scripted configuration and operation.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5655300034559060611?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5655300034559060611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2012/01/microsoft-azure-sql-data-sync.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5655300034559060611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5655300034559060611'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2012/01/microsoft-azure-sql-data-sync.html' title='Microsoft Azure SQL Data Sync'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/-xkoqH4i80Ks/TxPvCUmcNtI/AAAAAAAABaY/Tuhr5HCkfEA/s72-c/image_thumb2.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5995012509147993137</id><published>2011-11-25T20:38:00.001+01:00</published><updated>2011-11-25T20:38:06.168+01:00</updated><title type='text'>Fun Project: DotNetNuke module views</title><content type='html'>&lt;p&gt;Last time I showed you how to create, build, package, upload and use a simple DNN module, developed in C# using Visual Studio   &lt;br /&gt; 2010. Let’s get started by thinking (and writing down &lt;img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh5.ggpht.com/-yfaSEogB8qw/Ts_uf7cC9II/AAAAAAAABY0/0QaEhPJjNjk/wlEmoticon-smile2.png?imgmax=800" /&gt;) some requirements.&lt;/p&gt;  &lt;h4&gt;Requirements&lt;/h4&gt;  &lt;p&gt;Non-functional&lt;/p&gt;  &lt;p&gt;R-NFR1 DotNetNuke 05.06    &lt;br /&gt;R-NFR2 ASP.NET 4     &lt;br /&gt;R-NFR3 local testability without DNN installation     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Use Cases&lt;/p&gt;  &lt;p&gt;As a client I want to:&lt;/p&gt;  &lt;p&gt;R-U1 – Create an online account on the site    &lt;br /&gt;R-U2 – Log in and out     &lt;br /&gt;R-U3 – Choose a treatment     &lt;br /&gt;R-U4 – Choose a time/date     &lt;br /&gt;R-U5 – Book a massage&amp;#160; &lt;br /&gt;R-U6 – Got sent an email confirmation     &lt;br /&gt;R-U6.1 with an outlook appointment attached to it     &lt;br /&gt;R-U7 – get shown my booked treatments in detail&lt;/p&gt;  &lt;p&gt;As an administrator I want to:&lt;/p&gt;  &lt;p&gt;R-A1 – Define treatments (duration, title, description)    &lt;br /&gt;R-A2 – Define time windows (opening or working hours)     &lt;br /&gt;R-A3 – Show (todays, etc.) bookings     &lt;br /&gt;R-A4 – Got sent an email with a client booking information     &lt;br /&gt;R-A5 – Manage accounts (list, add, edit, delete)&lt;/p&gt;  &lt;h4&gt;New Web Project&lt;/h4&gt;  &lt;p&gt;To separate DotNetNuke module stuff from booking web functionality I added a new ASP.NET web project to the solution&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-arQfuvHFL3A/Ts_ugWuY1jI/AAAAAAAABY4/jgWsn9szvPg/s1600-h/image3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-xp9cryYgEoI/Ts_ugxO86aI/AAAAAAAABZA/ody3H8AyuNI/image_thumb1.png?imgmax=800" width="343" height="127" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;remove the generated pages, sub folders and strip down the web.config file to a minimum.&lt;/p&gt;  &lt;p&gt;Now add a web user control to the BookingViews project&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-98XjVcB1axM/Ts_uhZYEsZI/AAAAAAAABZI/_gXBLjn_axU/s1600-h/image15.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-RXebIHby1nM/Ts_uiIwTJLI/AAAAAAAABZQ/5AUZqu9Q-eg/image_thumb9.png?imgmax=800" width="827" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Telerik&lt;/h4&gt;  &lt;p&gt;Writing an outlook style schedule/calendar control in ASP.NET seems like a huge effort. Let’s get a commercial control library suite including a &lt;a href="http://demos.telerik.com/aspnet-ajax/scheduler/examples/overview/defaultcs.aspx"&gt;schedule control&lt;/a&gt;. As DNN already contains Telerik controls the evaluation was short. They have an excellent reputation when talking to colleagues.&lt;/p&gt;  &lt;h4&gt;Data Model&lt;/h4&gt;  &lt;p&gt;First let’s show the data access layer where the massage bookings and treatment offerings are persisted. Using the Entity Framework 4.0 model first approach, I create the following model:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-kYtXwjzmSYk/Ts_ui5457WI/AAAAAAAABZc/uwCQXm9pS7g/s1600-h/image5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-CmbW_nCvUIA/Ts_ukOnrFLI/AAAAAAAABZk/BX3Wyq9PQOM/image_thumb2.png?imgmax=800" width="830" height="516" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The BookingEntry and Treatment entities were added in the model edmx in VS design view. However, the User entity was imported from the existing DotNetNuke database (table first). Adding some relations and I can take advantage of the DNN register/login/user functionality in my bookings.&lt;/p&gt;  &lt;h4&gt;View&lt;/h4&gt;  &lt;p&gt;Learning and configuring the module view took more effort. This is the resulting aspx:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Page&lt;/span&gt; &lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BookingForm.aspx.cs&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BookingViews.BookingForm&amp;quot;&lt;/span&gt; &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Register&lt;/span&gt; &lt;span style="color: red"&gt;Assembly&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Telerik.Web.UI&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Namespace&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Telerik.Web.UI&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;TagPrefix&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;telerik&amp;quot;&lt;/span&gt; &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: maroon"&gt;DOCTYPE&lt;/span&gt; &lt;span style="color: red"&gt;html&lt;/span&gt; &lt;span style="color: red"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: blue"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;html&lt;/span&gt; &lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;head&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;head&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;form&lt;/span&gt; &lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ScriptManager&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ScriptManager1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ScriptManager&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt; &lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;height: 527px; width: 827px&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RadScheduler&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RadScheduler1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Culture&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;de-CH&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DayEndTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;19:00:00&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DayStartTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;07:00:00&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;FirstDayOfWeek&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Monday&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;558px&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SelectedView&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;WeekView&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ShowViewTabs&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;False&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Skin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Forest&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;800px&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;WorkDayEndTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;19:00:00&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;WorkDayStartTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;07:00:00&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;SelectedDate&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;2011-11-01&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DataEndField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;End&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DataKeyField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Id&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DataStartField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Start&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DataSubjectField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Subject&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;onappointmentcommand&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RadScheduler1_AppointmentCommand&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ontimeslotcreated&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RadScheduler1_TimeSlotCreated&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BookingEntryDataSource&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DataDescriptionField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Remarks&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;EnableDescriptionField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ResourceTypes&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ResourceType&lt;/span&gt; &lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TreatmentDataSource&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ForeignKeyField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TreatmentId&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;KeyField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Id&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TreatmentResource&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;TextField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Name&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ResourceTypes&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;WeekView&lt;/span&gt; &lt;span style="color: red"&gt;DayEndTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;19:00:00&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DayStartTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;07:00:00&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderDateFormat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;dd.MM.yyyy&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;WorkDayEndTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;19:00:00&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;WorkDayStartTime&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;07:00:00&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;AppointmentTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;span&lt;/span&gt; &lt;span style="color: red"&gt;style&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;=&amp;quot;font-weight: bold; font-size: small&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;#&lt;/span&gt; Eval(&amp;quot;Subject&amp;quot;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;br&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ImageButton&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ImageButton1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;ImageUrl&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;~/Resources/Calendar.png&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;OnClick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ExportOutlook&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;CommandName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ExportOutlook&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;AppointmentTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RadScheduler&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RadAjaxManager&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;AjaxSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;AjaxSetting&lt;/span&gt; &lt;span style="color: red"&gt;AjaxControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RadScheduler1&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;UpdatedControls&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;AjaxUpdatedControl&lt;/span&gt; &lt;span style="color: red"&gt;ControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;RadScheduler1&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;UpdatedControls&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;AjaxSetting&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;AjaxSettings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;telerik&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;RadAjaxManager&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ObjectDataSource&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;BookingEntryDataSource&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DataObjectTypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;My.DotNetNuke.Modules.BookingModule.BookingEntry&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DeleteMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Delete&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;InsertMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Add&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SelectMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetAll&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;TypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;My.DotNetNuke.Modules.BookingModule.Data.BookingEntryDataRepository&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;UpdateMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Update&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ObjectDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ObjectDataSource&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TreatmentDataSource&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DataObjectTypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;My.DotNetNuke.Modules.BookingModule.Treatment&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DeleteMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Delete&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;InsertMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Add&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SelectMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetAll&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;TypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;My.DotNetNuke.Modules.BookingModule.Data.TreatmentDataRepository&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;UpdateMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Update&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ObjectDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;form&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;html&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;The control’s data sources are of type ObjectDataSource. BookingEntryDataSource and TreatmentDataSource both implement the IRepository&amp;lt;T&amp;gt; interface. This hides the EF stuff behind a façade and allowed better testability than the EntityDataSource:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;&amp;#160;&amp;#160;&amp;#160; ///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Interface to decouple entities from data access.&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IRepository&lt;/span&gt;&amp;lt;T&amp;gt; &lt;span style="color: blue"&gt;where&lt;/span&gt; T: &lt;span style="color: blue"&gt;class&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;void&lt;/span&gt; Add(T entity);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;void&lt;/span&gt; Delete(T entity);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;ICollection&lt;/span&gt;&amp;lt;T&amp;gt; GetAll();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; T GetById(T entryWithKeyOnly);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;void&lt;/span&gt; Update(T entity);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Note that I added the telerik rad scheduler, configured a week view, added some appointment resources and DataSources to be bound in the scheduler control.&lt;/p&gt;  &lt;p&gt;And this is the final result:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-CIUeofaQXb8/Ts_uktODhkI/AAAAAAAABZs/cW0qdmoTr2o/s1600-h/image%25255B10%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-i5yqALz4O38/Ts_ulguUCaI/AAAAAAAABZ0/xATG6CSJ-Bw/image_thumb%25255B5%25255D.png?imgmax=800" width="752" height="546" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Double clicking shows or edits the details of the appointment&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-WNPmBwvG9kk/Ts_umUNX1aI/AAAAAAAABZ8/jliqX8uYO_0/s1600-h/image%25255B15%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-3I3VpiahxXY/Ts_unNQS7QI/AAAAAAAABaA/Nqyh961Pjxs/image_thumb%25255B8%25255D.png?imgmax=800" width="754" height="551" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;I hope this 3-part series of my (hobby project) development “minutes” gave you some insight around DotNetNuke module development in Visual Studio using C#.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5995012509147993137?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5995012509147993137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2011/11/fun-project-dotnetnuke-module-views.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5995012509147993137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5995012509147993137'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2011/11/fun-project-dotnetnuke-module-views.html' title='Fun Project: DotNetNuke module views'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/-yfaSEogB8qw/Ts_uf7cC9II/AAAAAAAABY0/0QaEhPJjNjk/s72-c/wlEmoticon-smile2.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5962981654838428955</id><published>2011-11-25T09:35:00.001+01:00</published><updated>2011-11-25T09:40:28.240+01:00</updated><title type='text'>Azure AppFabric Caching ASP.NET Session State Provider – not working with 2 Instances in the local Compute Emulator</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;A customer asked me for help about this.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Windows Azure AppFabric Cache is a subset of the Windows Server 2008 R2 AppFabric distributed in-memory cache (aka “Velocity”) and typically provides it’s services for ASP.NET session provider and output caching.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Enable Cache&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To speed up your web apps performance you first need to enable this Azure feature on the management portal&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-RM3-X8XJoRs/Ts9TBQIgsqI/AAAAAAAABW0/PVSedjCEPzA/s1600-h/image%25255B15%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/--dufSSbHgJo/Ts9TCNDo3pI/AAAAAAAABW8/GTdpiGZHxgs/image_thumb%25255B8%25255D.png?imgmax=800" width="793" height="315" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click New Service Namespace –&amp;gt; select Cache –&amp;gt; select your Azure subscription (for the billing) –&amp;gt; the region of the data center –&amp;gt; and a name.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Configure Web App to use the cache&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In the management portal Properties copy your host name and authentication token &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-p_6hX4a-rUU/Ts9TDMJFMlI/AAAAAAAABXA/2oyecGB2Q-w/s1600-h/image%25255B16%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-RNmBVNsR7Ko/Ts9TD9t3OUI/AAAAAAAABXI/vY-fLY8YRGE/image_thumb%25255B9%25255D.png?imgmax=800" width="317" height="452" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-X4yO6QN6rGc/Ts9TEl4UnAI/AAAAAAAABXQ/WPLLM2jCFWA/s1600-h/image14.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-QmjeSG_OpqY/Ts9TFGoSUPI/AAAAAAAABXY/U8dw8en3i6Y/image_thumb8.png?imgmax=800" width="662" height="200" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;to your web.config &amp;lt;Configuration&amp;gt; section:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;configSections&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;section&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;dataCacheClients&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;allowLocation&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;allowDefinition&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Everywhere&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;configSections&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dataCacheClients&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dataCacheClient&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;default&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;hosts&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;host&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;[SERVICE-HOST-NAME]&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;cachePort&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;22233&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;hosts&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityProperties&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;mode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Message&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;messageSecurity&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;authorizationInfo&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;[AUTHORIZATION INFO]&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;messageSecurity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;securityProperties&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;dataCacheClient&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;dataCacheClients&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;system.web&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sessionState&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;mode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Custom&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;customProvider&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AppFabricCacheSessionStoreProvider&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;providers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AppFabricCacheSessionStoreProvider&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;cacheName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;default&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;useBlobMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;dataCacheClientName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;default&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;providers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sessionState&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Add assembly references to the Azure libraries&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Microsoft.ApplicationServer.Caching.Client.dll      &lt;br /&gt;Microsoft.ApplicationServer.Caching.Core.dll       &lt;br /&gt;Microsoft.Web.DistributedCache.dll       &lt;br /&gt;Microsoft.WindowsFabric.Common       &lt;br /&gt;Microsoft.WindowsFabric.Data.Common&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;2 Instances&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Configure your web role to use 2 instances. Otherwise you won’t notice the problem.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Attention&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Make sure, you do not confuse with the Windows Server 2008 R2 AppFabric caching libraries. Use the ones under &lt;/p&gt;  &lt;p&gt;C:\Program Files\Windows Azure AppFabric SDK\V1.5\Assemblies\NET4.0\Cache&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Access the cache from code&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In the following example from the &lt;a href="http://www.microsoft.com/windowsazure/appfabric/"&gt;AppFabric Lab Samples&lt;/a&gt;, store some shopping cart entries into the session&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; cart = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Session[&lt;span style="color: #a31515"&gt;&amp;quot;Cart&amp;quot;&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; ?? &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;cart.Add(selectedItem);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;Session[&lt;span style="color: #a31515"&gt;&amp;quot;Cart&amp;quot;&lt;/span&gt;] = cart;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;and read back&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; itemsInSession = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Session[&lt;span style="color: #a31515"&gt;&amp;quot;Cart&amp;quot;&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; ?? &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;();&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Test it&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now when I start the app and add a product to the cart, stop the compute emulator, do an iisreset.exe and refresh the page – then I still see the product. This now comes from the Azure AppFabric Cache:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-1hA8JRKzn9U/Ts9TFwo_xII/AAAAAAAABXk/Fcb38bmHW7E/s1600-h/image19.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-WrDlIIIRMkY/Ts9TG3i4MKI/AAAAAAAABXs/hOiN4ZvIba8/image_thumb11.png?imgmax=800" width="589" height="416" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;on instance 1. From the debugger:&lt;/p&gt;  &lt;p&gt;Checkout on instance deployment16(44).AzureStoreService.&lt;font color="#ff0000"&gt;MVCAzureStore_IN_1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Pressing F5 to refresh the page again in the browser I suddenly don’t see the product anymore&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-BrQQN7end9E/Ts9TH8qvYFI/AAAAAAAABX0/kGqKG26LzV8/s1600-h/image23.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-tmJCUzZJ3w4/Ts9TIhv5_gI/AAAAAAAABX8/OsXjbZS8RkA/image_thumb13.png?imgmax=800" width="594" height="412" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;on instance 0. From debugger&lt;/p&gt;  &lt;p&gt;Checkout on instance deployment16(44).AzureStoreService.&lt;font color="#ff0000"&gt;MVCAzureStore_IN_0&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Pressing IEs F5 again and again, shows or don’t shows the product …. ?!?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;So the findings are, that the session cache basically works, but not in a (load-balanced) multi-instance environment on the local development fabric compute emulator! Depending on the web role instance (0 or 1) a different session cache is used.&lt;/p&gt;  &lt;p&gt;It looks like each web role instance is still using default ASP.NET in-proc session state, meaning you'd have different session state on each instance.&lt;/p&gt;  &lt;p&gt;However, the session id is the same &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-Eu-PhWJadgg/Ts9TJcP2rkI/AAAAAAAABYE/ghuJzjZOBAU/s1600-h/image27.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-ohx5BBEDty4/Ts9TKmZBNNI/AAAAAAAABYM/lPxdBPYjsHg/image_thumb15.png?imgmax=800" width="754" height="148" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I made sure the default in-proc session state provider is removed by commenting it and &lt;font color="#ff0000"&gt;&amp;lt;clear/&amp;gt;&lt;/font&gt;ing the providers list:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;sessionState mode=&amp;quot;InProc&amp;quot; customProvider=&amp;quot;DefaultSessionProvider&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;&amp;#160; &amp;lt;providers&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add name=&amp;quot;DefaultSessionProvider&amp;quot; type=&amp;quot;System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot; connectionStringName=&amp;quot;DefaultConnection&amp;quot; applicationName=&amp;quot;/&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;&amp;#160; &amp;lt;/providers&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;&amp;lt;/sessionState&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; If session state needs to be saved in AppFabric Caching service, add the following to web.config inside system.web. If SSL is required, then change dataCacheClientName to &amp;quot;SslEndpoint&amp;quot;. &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;sessionState&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;mode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Custom&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;customProvider&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AppFabricCacheSessionStoreProvider&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;providers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160; &lt;font color="#9b00d3"&gt; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;font color="#9b00d3"&gt;&lt;span style="color: #a31515"&gt;clear&lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AppFabricCacheSessionStoreProvider&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;cacheName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;default&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;useBlobMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;dataCacheClientName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;default&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;providers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;sessionState&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;strong&gt;All over again – it works in the Cloud&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Not sure I did something wrong in the Lab sample – I started all over again from scratch with a simple app that stores the text box value into the Session[] state and reads it back using the buttons. Value/InstanceId/SessionID are written to the label below.&lt;/p&gt;  &lt;p&gt;Same problem on the local fabric – BUT …&lt;/p&gt;  &lt;p&gt;… storing from IE’s first tab the value “m5” to web role instance 0 in session 5WJJ:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-Sr7KgzPSy8Y/Ts9TLqP-jrI/AAAAAAAABYU/GewGEMsnPzQ/s1600-h/image%25255B14%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-2FkRXQ6WiQY/Ts9TMlX9AHI/AAAAAAAABYc/sf2lP8e3MZ8/image_thumb%25255B7%25255D.png?imgmax=800" width="764" height="429" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Reading back from IE’s second tab the value “m5” from web role instance 1 in session 5WJJ:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-cBwrQ6KGzNg/Ts9TNiUBGmI/AAAAAAAABYk/B_HqDR-bgiQ/s1600-h/image%25255B9%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-33eWl8CSEDg/Ts9TOdrDiCI/AAAAAAAABYo/P1UHi4UGv5I/image_thumb%25255B4%25255D.png?imgmax=800" width="768" height="431" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;gives me what I expected.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Help&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As I understand this should not be the case? Seems to be an issue in the local compute emulator using the AppFabric cache service! It works in the cloud – but still makes local testing hard. Any ideas?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5962981654838428955?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5962981654838428955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2011/11/azure-appfabric-caching-aspnet-session.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5962981654838428955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5962981654838428955'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2011/11/azure-appfabric-caching-aspnet-session.html' title='Azure AppFabric Caching ASP.NET Session State Provider – not working with 2 Instances in the local Compute Emulator'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/--dufSSbHgJo/Ts9TCNDo3pI/AAAAAAAABW8/GTdpiGZHxgs/s72-c/image_thumb%25255B8%25255D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6664445682602134156</id><published>2011-11-23T17:10:00.001+01:00</published><updated>2011-11-23T17:10:05.514+01:00</updated><title type='text'>Fun Project: DotNetNuke module development</title><content type='html'>&lt;p&gt;This post shows you how to create a DNN module in C# using Visual Studio 2010 – from beginner to beginner – to make expectations clear.&lt;/p&gt;  &lt;h5&gt;Requirements&lt;/h5&gt;  &lt;p&gt;In time with the site going live, new requirements popped up:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;online bookings of treatments by clients &lt;/li&gt;    &lt;li&gt;manage massage treatments through my wife &lt;/li&gt;    &lt;li&gt;booking selected treatments using a kind of schedule/calendar view (clients) in predefined time windows / opening hours (admin). &lt;/li&gt;    &lt;li&gt;email confirmations (client and admin) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I found no module for these &lt;img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://lh3.ggpht.com/-RHI1M7KGqdY/Ts0afcKk_EI/AAAAAAAABTc/pB_hDQsv3dg/wlEmoticon-sadsmile2.png?imgmax=800" /&gt;.&lt;/p&gt;  &lt;h5&gt;Visual Studio Project Template&lt;/h5&gt;  &lt;p&gt;As Visual Studio and C# are my friends, I downloaded the DNN template from &lt;a href="http://dotnetnuke.codeplex.com/releases/view/59419"&gt;dotnetnuke.codeplex.com&lt;/a&gt; and added a new project to my VS 2010 solution:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-b-ntB-o9j9o/Ts0afyi9QVI/AAAAAAAABTk/oR_Pxg_4K7s/s1600-h/image4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-3b6lCw3KI9g/Ts0agh9UK1I/AAAAAAAABTo/vTYp2DQDCFg/image_thumb2.png?imgmax=800" width="470" height="115" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;which added the following structure:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-XmCVA4PYuV4/Ts0ahf1h96I/AAAAAAAABT0/TcREQwIIHZg/s1600-h/image14.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-vVKG4sAnkZw/Ts0ajpDTDnI/AAAAAAAABT8/HVl7wqmUETk/image_thumb8.png?imgmax=800" width="473" height="568" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;changed to .NET framework to 4.0 and added my custom namespace&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-tuc7SWnvlKk/Ts0akUBhT-I/AAAAAAAABUE/qDhbKQVqmlE/s1600-h/image19.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-Cj_db9X-lOM/Ts0alGK4HaI/AAAAAAAABUI/UMfv4ptXov4/image_thumb11.png?imgmax=800" width="894" height="224" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Performing a Release build&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-gS1dRpyML_E/Ts0alk-PgZI/AAAAAAAABUQ/2AAySw-J984/s1600-h/image22.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-nUsDYwGFb4M/Ts0amcGS9uI/AAAAAAAABUU/TL6dxiFAlpg/image_thumb12.png?imgmax=800" width="190" height="92" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h5&gt;Packaging&lt;/h5&gt;  &lt;p&gt;Right clicking the module project in the solution explorer and choosing &lt;em&gt;“Build Deployment Package”&lt;/em&gt; creates the necessary CMS upload package BookingModule_00.00.01_Source.zip in the packages sub folder.&lt;/p&gt;  &lt;p&gt;The packing script error: &lt;/p&gt;  &lt;p&gt;&lt;em&gt;Error&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160; The target &amp;quot;Package&amp;quot; does not exist in the project.&lt;/em&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;can probably be ignored. It indicates the build script references the solution file rather than the csproj project file.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-2EDcdnT5AzU/Ts0amxctzOI/AAAAAAAABUg/bpCvahW0HVc/s1600-h/image39.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-4t1dfh1xuhw/Ts0aogmUwbI/AAAAAAAABUs/9Ug8-q13WbA/image_thumb21.png?imgmax=800" width="444" height="147" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Note the packaging scripts are included in your DNN module project folder “BuildScripts”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-IL7iv29IE-o/Ts0apx_UsmI/AAAAAAAABUw/_rqiLy7yyIk/s1600-h/image44.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-Io6PXwf5F90/Ts0aqjOjSdI/AAAAAAAABU4/6l7xEnffhBM/image_thumb24.png?imgmax=800" width="358" height="95" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h5&gt;&lt;strong&gt;Host Login&lt;/strong&gt;&lt;/h5&gt;  &lt;p&gt;When I created the DNN site within my hoster’s portal, I got asked to create two login account credentials:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Administrator: create pages, add installed modules to pages, change skins and styles, etc. &lt;/li&gt;    &lt;li&gt;Host: same as the administrator, but with additional rights, one of these is &lt;em&gt;installing new modules&lt;/em&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;So you must log in with your host account&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-M_Jnpltk6Ho/Ts0arqWk19I/AAAAAAAABVA/I44DqqZ8frU/s1600-h/image25.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-1cDRdEm4sMw/Ts0asMN_-PI/AAAAAAAABVM/H_qnpWvMpL4/image_thumb13.png?imgmax=800" width="175" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;to see the additional site menu items “Admin” and “Host”. Clicking host shows the Extensions icon:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-RKHHXn4iYs0/Ts0atjiXg1I/AAAAAAAABVU/ux9oJXyMiRk/s1600-h/image29.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-DFW1xnStDpc/Ts0aug9QV_I/AAAAAAAABVc/wHGjMr1cNMY/image_thumb15.png?imgmax=800" width="1115" height="212" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;to see the DNN framework (version), Authentication System, Container, Library, Module, Provider, Skin, Skin Objects and in the bottom right pane the command to install a new module &lt;em&gt;Install Extension Wizard&lt;/em&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-4-hW88IgQZY/Ts0avaRTOCI/AAAAAAAABVk/KCRX1F4kdNo/s1600-h/image33.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-RprITfgXQhU/Ts0awECzugI/AAAAAAAABVs/bY2-Bqv8NRA/image_thumb17.png?imgmax=800" width="754" height="95" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;selecting and uploading the previously built release package, next, booom!&lt;/p&gt;  &lt;h5&gt;&lt;em&gt;Install Extension&lt;/em&gt;&lt;/h5&gt;  &lt;p&gt;&lt;em&gt;Upload Results      &lt;br /&gt;If you have reached this page it is because the installer needs to gather some more information, before proceeding.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;Error reading the zip package&lt;/strong&gt; - see below&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;StartJob      &lt;br /&gt;Reading Installation &lt;strong&gt;Manifest file&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Info      &lt;br /&gt;Reading Package Manifest - Module - BookingModule&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Failure      &lt;br /&gt;Install aborted - The &lt;strong&gt;module being installed is not compatible with your host application&lt;/strong&gt; version ( an upgrade is required )&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;I spent some time googling for answers, found some useful &lt;a href="http://www.dotnetnuke.com/Resources/Forums/forumid/136/postid/198561/scope/posts.aspx"&gt;hints&lt;/a&gt;, saying the module is not compatible with my DNN version. But my problem remains: I cannot update my CMS with my hoster and I’ve got the latest Visual Studio template!? Hm. The solution was in the VS project DNN manifest file (project.dnn):&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dotnetnuke&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Package&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;5.0&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;packages&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;package&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;BookingModule&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Module&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;00.00.01&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;…/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dependencies&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;&amp;lt;&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color: #a31515"&gt;dependency&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;CoreVersion&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;06.00.00&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;dependency&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;dependencies&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;You need to delete the dependencies node, rebuild, repackage, upload again:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-dxTx4mmpMWc/Ts0axAV0ZnI/AAAAAAAABVw/36gJjFUqIRM/s1600-h/image51.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-S0DFlIjLSZY/Ts0ayM1peFI/AAAAAAAABV8/g2q3UctMNuI/image_thumb29.png?imgmax=800" width="779" height="421" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Yeah.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-ULaSh1MRB5M/Ts0aygnoC0I/AAAAAAAABWA/efu-kwjn8Xk/s1600-h/image56.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-9oRDKRPwFjk/Ts0azDIMsvI/AAAAAAAABWI/C7ASBkceo0w/image_thumb32.png?imgmax=800" width="780" height="219" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can now add it to you page / pane as host –&amp;gt; edit mode –&amp;gt; common task –&amp;gt; add module&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-1nPdgR0ZhsM/Ts0a0dDiPrI/AAAAAAAABWQ/khbHJXuiO50/s1600-h/image60.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-ulnR4cHZKik/Ts0a1bYMa9I/AAAAAAAABWc/9OWJNBQRUNo/image_thumb34.png?imgmax=800" width="716" height="215" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;and when the module has the same rights as the page, then you can see it. There’s a context menu added&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-SDKOT-F7xxg/Ts0a2fZbQ2I/AAAAAAAABWk/qumYKlQ3hrg/s1600-h/image63.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-5CE2h944Hxs/Ts0a3ESYiTI/AAAAAAAABWo/oj5ky0VoDyI/image_thumb35.png?imgmax=800" width="178" height="173" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;that let’s you switch to an “Edit Module” view or “Settings” view. Do you remember the three .ascx asp.net user controls in the above module project?&lt;/p&gt;  &lt;p&gt;I hope this blog post gave you some overview of DotNetNuke module developments to get started with, including some pitfalls (I have fallen into).&lt;/p&gt;  &lt;p&gt;Next time, I plan to show you the development of the web stuff, including the database model, data access, UI.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6664445682602134156?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6664445682602134156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2011/11/fun-project-dotnetnuke-module.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6664445682602134156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6664445682602134156'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2011/11/fun-project-dotnetnuke-module.html' title='Fun Project: DotNetNuke module development'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/-RHI1M7KGqdY/Ts0afcKk_EI/AAAAAAAABTc/pB_hDQsv3dg/s72-c/wlEmoticon-sadsmile2.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-1841792250680986034</id><published>2011-11-23T17:04:00.001+01:00</published><updated>2011-11-23T17:04:13.193+01:00</updated><title type='text'>Fun Project: DotNetNuke – Failing with WebMatrix/ Orchard</title><content type='html'>&lt;p&gt;No, I’ve not been in jail – but I’ve been very busy in a project recently and could not share my .NET insights with you. So I start again with a fun project, in a field I never work or accept customer mandates so far: web development, CMS, homepages.&lt;/p&gt;  &lt;p&gt;It all started in an evening effort to create a web site for my wife’s new hobby (ehm, business): wellness, wellbeing, massage. &lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;Microsoft WebMatrix / Orchard&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;I started with the latest and smallest .NET (what else) open source content management system (CMS) out there: &lt;a href="http://orchard.codeplex.com/"&gt;Microsoft Orchard&lt;/a&gt; using &lt;a href="http://www.microsoft.com/web/webmatrix/"&gt;WebMatrix&lt;/a&gt;. Learned the tool basics, got into the CMS, created some content, browsed through some free skins, modified CSS (with blood and sweat), had fun and insights …&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-7f3pOvYGo2s/Ts0ZcBvdm_I/AAAAAAAABS8/66FHTGVOSzE/s1600-h/image4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-tJrPDUvYMG8/Ts0Zc1O8eLI/AAAAAAAABTE/z3Odl1zQ6tg/image_thumb2.png?imgmax=800" width="1196" height="745" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;… but failed due to hosting restrictions from my shared web hoster (Microsoft Orchard 1.2.41 / ASP.NET 4.0 / SqlCompact 4) with a security exception (&lt;em&gt;Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers&lt;/em&gt;.). As I did not want to update my subscription to a more expensive one, I went back to “field 1” to start all over again.&lt;/p&gt;  &lt;p&gt;Learning: Orchard needs full trust shared hosting.&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;DotNetNuke&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;But my hoster supports &lt;a href="http://www.dotnetnuke.com/"&gt;DotNetNuke&lt;/a&gt; (DNN) 05.06 Community Edition! Another new experience for me. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;It took a couple of web forms filling (SQL connection, accounts, etc.) and 10 minutes waiting time for the installation on &lt;a href="http://www.webland.ch/"&gt;my hoster&lt;/a&gt;’s management portal. A no brainer.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Customization&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;After log-in to the deployed CMS you can start adding pages, adding modules to pages, adding content to modules. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://kimmtech.all-around-us.com/wp-content/uploads/2008/10/addexisitngmodule.gif" width="500" height="105" /&gt;&lt;/p&gt;  &lt;p&gt;Modules are added to panes of a page. Panes are typically the following areas:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.developerfusion.com/article/84462/dotnetnuke-8211-the-easy-way-to-an-aspnet-website/"&gt;&lt;img src="http://www.developerfusion.com/pix/articleimages/jul08/dnn1.jpg" width="395" height="354" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Blood and sweat again: there just the so called “MinimalExtropy” skin to start with – or get a bunch of commercial skins or create your own using commercial tools. But I wanted to migrate my Orchard CSS to &lt;strong&gt;MinimalExtropy&lt;/strong&gt;, which took me another (long) evening.&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;@import&lt;/span&gt; url(&amp;quot;css/menu.css&amp;quot;);&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: #006400"&gt;/* CSS Document */&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;#Body&lt;/span&gt; {&lt;span style="color: red"&gt;background&lt;/span&gt;: &lt;span style="color: blue"&gt;url(images/body_bg.png)&lt;/span&gt; &lt;span style="color: blue"&gt;#c6e29f&lt;/span&gt; &lt;span style="color: blue"&gt;fixed&lt;/span&gt; &lt;span style="color: blue"&gt;no-repeat&lt;/span&gt; &lt;span style="color: blue"&gt;center&lt;/span&gt; &lt;span style="color: blue"&gt;bottom&lt;/span&gt;; &lt;span style="color: red"&gt;height&lt;/span&gt;:&lt;span style="color: blue"&gt;100%&lt;/span&gt;; &lt;span style="color: red"&gt;margin&lt;/span&gt;:&lt;span style="color: blue"&gt;0&lt;/span&gt;; &lt;span style="color: red"&gt;padding&lt;/span&gt;:&lt;span style="color: blue"&gt;0&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #006400"&gt;/* ControlPanel style */&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;.ControlPanel&lt;/span&gt;{&lt;span style="color: red"&gt;background&lt;/span&gt;:&lt;span style="color: blue"&gt;transparent&lt;/span&gt; &lt;span style="color: blue"&gt;url(images/cpanel_center.png)&lt;/span&gt; &lt;span style="color: blue"&gt;repeat-x&lt;/span&gt; &lt;span style="color: blue"&gt;bottom&lt;/span&gt; &lt;span style="color: blue"&gt;left&lt;/span&gt;; &lt;span style="color: red"&gt;border&lt;/span&gt;:&lt;span style="color: blue"&gt;none&lt;/span&gt;;&lt;span style="color: red"&gt;padding-bottom&lt;/span&gt;:&lt;span style="color: blue"&gt;10px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;.cpanel_left&lt;/span&gt; {&lt;span style="color: red"&gt;background&lt;/span&gt;: &lt;span style="color: blue"&gt;url(images/cpanel_left.png)&lt;/span&gt; &lt;span style="color: blue"&gt;no-repeat&lt;/span&gt; &lt;span style="color: blue"&gt;bottom&lt;/span&gt; &lt;span style="color: blue"&gt;left&lt;/span&gt;;&lt;span style="color: red"&gt;padding-left&lt;/span&gt;:&lt;span style="color: blue"&gt;21px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;.cpanel_right&lt;/span&gt; {&lt;span style="color: red"&gt;background&lt;/span&gt;: &lt;span style="color: blue"&gt;url(images/cpanel_right.png)&lt;/span&gt; &lt;span style="color: blue"&gt;no-repeat&lt;/span&gt; &lt;span style="color: blue"&gt;bottom&lt;/span&gt; &lt;span style="color: blue"&gt;right&lt;/span&gt;;&lt;span style="color: red"&gt;padding-right&lt;/span&gt;:&lt;span style="color: blue"&gt;33px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #006400"&gt;/*-------- Default Style --------*/&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;body&lt;/span&gt;,&lt;span style="color: maroon"&gt;th&lt;/span&gt;,&lt;span style="color: maroon"&gt;td&lt;/span&gt;,&lt;span style="color: maroon"&gt;table&lt;/span&gt;,&lt;span style="color: maroon"&gt;h1&lt;/span&gt;,&lt;span style="color: maroon"&gt;h2&lt;/span&gt;,&lt;span style="color: maroon"&gt;h3&lt;/span&gt;,&lt;span style="color: maroon"&gt;h4&lt;/span&gt;,&lt;span style="color: maroon"&gt;h5&lt;/span&gt;,&lt;span style="color: maroon"&gt;h6&lt;/span&gt;,&lt;span style="color: maroon"&gt;.Normal&lt;/span&gt;,&lt;span style="color: maroon"&gt;.NormalDisabled&lt;/span&gt;,&lt;span style="color: maroon"&gt;.Head&lt;/span&gt;,&lt;span style="color: maroon"&gt;.SubHead&lt;/span&gt;,&lt;span style="color: maroon"&gt;.SubSubHead&lt;/span&gt;, &lt;span style="color: maroon"&gt;a:link&lt;/span&gt;, &lt;span style="color: maroon"&gt;a:visited&lt;/span&gt;, &lt;span style="color: maroon"&gt;a:hover&lt;/span&gt;, &lt;span style="color: maroon"&gt;input&lt;/span&gt;, &lt;span style="color: maroon"&gt;.CommandButton&lt;/span&gt;{&lt;span style="color: red"&gt;color&lt;/span&gt;:&lt;span style="color: blue"&gt;#2E3D47&lt;/span&gt;; &lt;span style="color: red"&gt;font-family&lt;/span&gt;:&lt;span style="color: blue"&gt;Verdana,&lt;/span&gt; &lt;span style="color: blue"&gt;Arial,&lt;/span&gt; &lt;span style="color: blue"&gt;Helvetica,&lt;/span&gt; &lt;span style="color: blue"&gt;sans-serif&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;body&lt;/span&gt;,&lt;span style="color: maroon"&gt;th&lt;/span&gt;,&lt;span style="color: maroon"&gt;td&lt;/span&gt;,&lt;span style="color: maroon"&gt;table&lt;/span&gt;,&lt;span style="color: maroon"&gt;.Normal&lt;/span&gt;,&lt;span style="color: maroon"&gt;.NormalDisabled&lt;/span&gt;,&lt;span style="color: maroon"&gt;.Head&lt;/span&gt;,&lt;span style="color: maroon"&gt;.SubHead&lt;/span&gt;,&lt;span style="color: maroon"&gt;.SubSubHead&lt;/span&gt;, &lt;span style="color: maroon"&gt;a:link&lt;/span&gt;, &lt;span style="color: maroon"&gt;a:visited&lt;/span&gt;, &lt;span style="color: maroon"&gt;a:hover&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;12px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h1&lt;/span&gt;, &lt;span style="color: maroon"&gt;h2&lt;/span&gt;, &lt;span style="color: maroon"&gt;h3&lt;/span&gt;, &lt;span style="color: maroon"&gt;h4&lt;/span&gt;, &lt;span style="color: maroon"&gt;h5&lt;/span&gt;, &lt;span style="color: maroon"&gt;h6&lt;/span&gt;, &lt;span style="color: maroon"&gt;h2&lt;/span&gt; &lt;span style="color: maroon"&gt;input&lt;/span&gt;{&lt;span style="color: red"&gt;color&lt;/span&gt;:&lt;span style="color: blue"&gt;#375162&lt;/span&gt;;&lt;span style="color: red"&gt;font-weight&lt;/span&gt;:&lt;span style="color: blue"&gt;bold&lt;/span&gt;;&lt;span style="color: red"&gt;margin&lt;/span&gt;:&lt;span style="color: blue"&gt;1ex&lt;/span&gt; &lt;span style="color: blue"&gt;0&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h1&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;18px&lt;/span&gt;;&lt;span style="color: red"&gt;margin&lt;/span&gt;:&lt;span style="color: blue"&gt;10px&lt;/span&gt; &lt;span style="color: blue"&gt;0&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h2&lt;/span&gt;, &lt;span style="color: maroon"&gt;h2&lt;/span&gt; &lt;span style="color: maroon"&gt;input&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;14px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h3&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;13px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h4&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;12px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h5&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;11px&lt;/span&gt;;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: maroon"&gt;h6&lt;/span&gt;{&lt;span style="color: red"&gt;font-size&lt;/span&gt;:&lt;span style="color: blue"&gt;10px&lt;/span&gt;;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;… and the like.&lt;/p&gt;  &lt;p&gt;There are a couple of pre-installed &lt;strong&gt;modules&lt;/strong&gt; for DNN and an ecosystem of free and commercial modules out there. A module is a kind of a web part like blogging, picture gallery, etc.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-HOvHh4Z1Hj4/Ts0ZdwDEfDI/AAAAAAAABTI/fk4tRfdBCkk/s1600-h/image9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-NKZqjDd_iNo/Ts0ZeW1ZoTI/AAAAAAAABTQ/-brW-W_v3VA/image_thumb5.png?imgmax=800" width="250" height="401" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-1841792250680986034?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/1841792250680986034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2011/11/fun-project-dotnetnuke-failing-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1841792250680986034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1841792250680986034'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2011/11/fun-project-dotnetnuke-failing-with.html' title='Fun Project: DotNetNuke – Failing with WebMatrix/ Orchard'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/-tJrPDUvYMG8/Ts0Zc1O8eLI/AAAAAAAABTE/z3Odl1zQ6tg/s72-c/image_thumb2.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-2447739762619458509</id><published>2011-07-19T15:36:00.001+01:00</published><updated>2011-07-19T15:36:41.865+01:00</updated><title type='text'>Windows Mobile Device Center crashing with "Services is not a valid partnership ID"</title><content type='html'>&lt;p&gt;Almost drove me crazy, this error on my Windows 7 64bit Ultimate, connecting Outlook 2010 with my Windows Mobile 6.5 HTC Touch Diamond 2. From one day to the other synchronization did not work any more because the WMDC process crashed. Un- and re-install did not help.&lt;/p&gt;  &lt;p&gt;The solution was to delete all sub keys (partnerships) from the following registry node:&lt;/p&gt;  &lt;p&gt;HKEY_CURRENT_USER\Software\Microsoft\Windows CE Services\Partners&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-2447739762619458509?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/2447739762619458509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2011/07/windows-mobile-device-center-crashing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2447739762619458509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2447739762619458509'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2011/07/windows-mobile-device-center-crashing.html' title='Windows Mobile Device Center crashing with &amp;quot;Services is not a valid partnership ID&amp;quot;'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-2176693188843940401</id><published>2010-11-02T09:50:00.001+01:00</published><updated>2010-11-02T09:50:40.282+01:00</updated><title type='text'>ESE Software Engineering Conference in Zürich – Call for Papers</title><content type='html'>&lt;p&gt;The international Software Engineering Conference ESE Conference 2011 (12.-14. April) opens the &lt;a href="http://www.eseconf.com/2011/Konferenz/CallforpaperInfos.aspx"&gt;Call for Papers&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.eseconf.com"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/TM_Q38pW1zI/AAAAAAAABE4/LNFHb6gNzsE/image%5B3%5D.png?imgmax=800" width="244" height="186" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, if you are an expert in a technical software topic you can submit your talk until 12. December 2010.&lt;/p&gt;  &lt;p&gt;The conference allows the discussion and exchange of experts and participants. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-2176693188843940401?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/2176693188843940401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/11/ese-software-engineering-conference-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2176693188843940401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2176693188843940401'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/11/ese-software-engineering-conference-in.html' title='ESE Software Engineering Conference in Zürich – Call for Papers'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/TM_Q38pW1zI/AAAAAAAABE4/LNFHb6gNzsE/s72-c/image%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-1464928441599379438</id><published>2010-08-11T10:54:00.001+01:00</published><updated>2010-08-11T10:54:25.350+01:00</updated><title type='text'>Silverlight 3 Trap : OneWayToSource</title><content type='html'>&lt;p&gt;Silverlight is missing some details you may be using in WPF. One of them is the missing data binding mode OneWayToSource. Another one is the missing SelectionChanged command of a ComboBox. Both created a funny behavior in my current project.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://derstandard.at/1271378039203/Kreisrundes-Loch-in-Guatemalas-Hauptstadt-aufgeklafft?sap=2&amp;amp;_slideNumber=1&amp;amp;_seite=7"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/TGJzT-V4EkI/AAAAAAAABEI/bqL4EWujqMw/image%5B4%5D.png?imgmax=800" width="604" height="413" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I have a ViewModel property&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Selected&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;get&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;._selected;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;set&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;._selected = &lt;span style="color: blue"&gt;value&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.RaisePropertyChanged(&lt;span style="color: #a31515"&gt;&amp;quot;Selected&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;and two ComboBox TwoWay (OneWayToSource does not exist) binding on it with SelectedItem&lt;/p&gt;  &lt;p&gt;&amp;lt;ComboBox Name=&amp;quot;c1&amp;quot; mycmd:SelectionChangedCommand.Command=&amp;quot;{Binding C1SelectionChangedCommand}&amp;quot; ItemsSource=&amp;quot;{Binding Selections}&amp;quot; SelectedItem=&amp;quot;{Binding Selected, Mode=TwoWay}&amp;quot; /&amp;gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;ComboBox Name=&amp;quot;c2&amp;quot; mycmd:SelectionChangedCommand.Command=&amp;quot;{Binding C2SelectionChangedCommand}&amp;quot; ItemsSource=&amp;quot;{Binding Selections}&amp;quot; SelectedItem=&amp;quot;{Binding Selected, Mode=TwoWay}&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;The funny thing was, that when I made a selection on combo box c1 the command handler of my c2 fired (too) – due to the &lt;span style="color: blue"&gt;this&lt;/span&gt;.RaisePropertyChanged(&lt;span style="color: #a31515"&gt;&amp;quot;Selected&amp;quot;&lt;/span&gt;) above:&lt;/p&gt;  &lt;p&gt;- c1 copies the SelectedItem from the target to the source&lt;/p&gt;  &lt;p&gt;- the source property raises the property changed event and&lt;/p&gt;  &lt;p&gt;- copies the Selected property value to the other c2 target&lt;/p&gt;  &lt;p&gt;- c2 fires the SelectionChanged command&lt;/p&gt;  &lt;p&gt;Et voilà, your in the Guatemala City trap…it would be better to have more fine-grained data binding control with OneWayToSource in the first place.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-1464928441599379438?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/1464928441599379438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/08/silverlight-3-trap-onewaytosource.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1464928441599379438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1464928441599379438'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/08/silverlight-3-trap-onewaytosource.html' title='Silverlight 3 Trap : OneWayToSource'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_8SuFzywowiM/TGJzT-V4EkI/AAAAAAAABEI/bqL4EWujqMw/s72-c/image%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4782277937358801487</id><published>2010-07-02T11:27:00.001+01:00</published><updated>2010-07-02T11:27:08.822+01:00</updated><title type='text'>Silverlight 3 Debugging in Visual Studio 2008: Breakpoint not hit</title><content type='html'>&lt;p&gt;Today I hit the problem, that I could not any longer debug Silverlight client applications (it worked yesterday).&lt;/p&gt;  &lt;p&gt;A lot of solutions have been posted out there, which did not help for me. The most common cause with other people was that the web project had the Silverlight Debugger option unticked. So enable it again.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/TC2-8r6kouI/AAAAAAAABDI/OquFEj4uL6U/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/TC2-9e4J29I/AAAAAAAABDM/ZPg9P0ACMfI/image_thumb%5B3%5D.png?imgmax=800" width="664" height="84" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Going back to the source code from yesterday and doing it again, showed me the following screen (“Do you want to enable Silverlight debugging for this project? …” – event when this tick was set!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/TC2-92d_byI/AAAAAAAABDQ/ZguuyOkr600/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/TC2--F_DQPI/AAAAAAAABDU/Nh1a_L4n0uw/image_thumb%5B1%5D.png?imgmax=800" width="582" height="279" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After some time struggling around I found out, that I had to set the “Set as Start Page” again on my .htm page. I looks like this fixes something (btw, even when the start project was set correctly before!).&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4782277937358801487?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4782277937358801487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/07/silverlight-3-debugging-in-visual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4782277937358801487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4782277937358801487'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/07/silverlight-3-debugging-in-visual.html' title='Silverlight 3 Debugging in Visual Studio 2008: Breakpoint not hit'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_8SuFzywowiM/TC2-9e4J29I/AAAAAAAABDM/ZPg9P0ACMfI/s72-c/image_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6255486093446842245</id><published>2010-05-21T15:55:00.001+01:00</published><updated>2010-05-21T15:55:01.768+01:00</updated><title type='text'>Entity Framework 4 : Cascaded Delete in Parent-Child Relationship?</title><content type='html'>&lt;p&gt;Extending the previous post, let’s look at cascaded delete&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/S_aesY7T9KI/AAAAAAAABBA/YJSGPRGGeck/s1600-h/image%5B21%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S_aeswNtniI/AAAAAAAABBE/7U60Bvi-hwY/image_thumb%5B11%5D.png?imgmax=800" width="525" height="290" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;[&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;[&lt;span style="color: #2b91af"&gt;ExpectedException&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(System.Data.&lt;span style="color: #2b91af"&gt;ObjectNotFoundException&lt;/span&gt;))]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; DeleteParentEntity_WithOneToOneChildEntityRelationshipConstraint_ChildIsAutomaticallyDeleted()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// save parent and child (1:1)&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;FinanceMinister&lt;/span&gt; financeMinister = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;FinanceMinister&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Name = &lt;span style="color: #a31515"&gt;&amp;quot;Giulio Tremonti&amp;quot;&lt;/span&gt;,&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Email = &lt;span style="color: #a31515"&gt;&amp;quot;gt@finanze.it&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Country&lt;/span&gt; country = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Country&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Name = &lt;span style="color: #a31515"&gt;&amp;quot;Italy&amp;quot;&lt;/span&gt;,&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; GDP = 2118.264M, &lt;span style="color: green"&gt;// billions ? &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ForeignDebt = 0M,&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FinanceMinister = financeMinister&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Add(country);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Save();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;int&lt;/span&gt; financeMinisterId = financeMinister.Id;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// check if that was done right&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Country&lt;/span&gt; reloadedCountry = &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.GetById&amp;lt;&lt;span style="color: #2b91af"&gt;Country&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Country&lt;/span&gt; { Id = country.Id });&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(country.FinanceMinister.Name, reloadedCountry.FinanceMinister.Name);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// delete Country and check that treasurer is also gone&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Delete(country);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Save();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.GetById&amp;lt;&lt;span style="color: #2b91af"&gt;FinanceMinister&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;FinanceMinister&lt;/span&gt; { Id = financeMinisterId });&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;throws&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S_aetV6KpkI/AAAAAAAABBI/1o2kw0gxcl4/s1600-h/image%5B22%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S_aeuEi4YSI/AAAAAAAABBM/auQ0AlMoQHQ/image_thumb%5B12%5D.png?imgmax=800" width="496" height="347" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now setting the relationship to “cascade”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S_aeulbh9LI/AAAAAAAABBQ/RC8bTfb0U5g/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/S_aevPoinoI/AAAAAAAABBU/bgMpWI_FivI/image_thumb%5B3%5D.png?imgmax=800" width="491" height="460" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Runs OK, deleting the country and the corresponding finance minister in one go:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/S_aev1-NuiI/AAAAAAAABBY/tXv17bmv_ZQ/s1600-h/image%5B12%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S_aewWxj9QI/AAAAAAAABBc/OyaTgdG_H1k/image_thumb%5B6%5D.png?imgmax=800" width="620" height="60" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/S_aew7Y5KvI/AAAAAAAABBg/AI87I6_UTbc/s1600-h/image%5B17%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S_aexFF45BI/AAAAAAAABBk/0-rOeW_JlnU/image_thumb%5B9%5D.png?imgmax=800" width="420" height="52" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6255486093446842245?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6255486093446842245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/05/entity-framework-4-cascaded-delete-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6255486093446842245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6255486093446842245'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/05/entity-framework-4-cascaded-delete-in.html' title='Entity Framework 4 : Cascaded Delete in Parent-Child Relationship?'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_8SuFzywowiM/S_aeswNtniI/AAAAAAAABBE/7U60Bvi-hwY/s72-c/image_thumb%5B11%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7291329020485511446</id><published>2010-05-21T15:00:00.001+01:00</published><updated>2010-05-21T15:00:10.506+01:00</updated><title type='text'>Entity Framework 4 : Delete child from ParentChild Relationship – throws or what?</title><content type='html'>&lt;p&gt;[topic from a discussion; addressing a colleague]&lt;/p&gt;  &lt;p&gt;Imagine the very common situation where you have a parent-child relationship like the following, and you want to delete the child (Currency; or better just remove the relation by setting the parent’s child navigation property to null):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/S_aRy7FHvlI/AAAAAAAABAA/tj113FDUA3E/s1600-h/image9.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/S_aRzVl9BLI/AAAAAAAABAE/541UZpbeKTY/image_thumb5.png?imgmax=800" width="309" height="692" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Having code (show in an intergration test) like this&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;[&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; RemoveChildEntityNavigationFromParentEntityProperty_WithManyToOneConstraint_Throws()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// save parent and child with a 1:* relationship constraint&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;int&lt;/span&gt; dbGeneratedCityId = -1;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Currency&lt;/span&gt; chf = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Currency&lt;/span&gt; { Symbol = &lt;span style="color: #a31515"&gt;&amp;quot;CHF&amp;quot;&lt;/span&gt;, Name = &lt;span style="color: #a31515"&gt;&amp;quot;Schweizer Franken&amp;quot;&lt;/span&gt; };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; city = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; { Code = &lt;span style="color: #a31515"&gt;&amp;quot;ZRH&amp;quot;&lt;/span&gt;, Name = &lt;span style="color: #a31515"&gt;&amp;quot;Zürich&amp;quot;&lt;/span&gt;, Currency = chf };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Add(city);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Save();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; dbGeneratedCityId = city.Id;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// get the parent again from the database and get rid of the child&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; reloadedCity = &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.GetById&amp;lt;&lt;span style="color: #2b91af"&gt;City&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; { Id = dbGeneratedCityId });&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNotNull(reloadedCity.Currency);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; reloadedCity.Currency = &lt;span style="color: blue"&gt;null&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Save();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// assert that the child was properly deleted&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; reloadedUpdatedCity = &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.GetById&amp;lt;&lt;span style="color: #2b91af"&gt;City&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; { Id = dbGeneratedCityId });&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNull(reloadedUpdatedCity.Currency);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Using SQLProfiler shows that the following queries are emitted for the first code block&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/S_aRzj7EIYI/AAAAAAAABAI/X65jZyjVcYY/s1600-h/image22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/S_aR0Owl5oI/AAAAAAAABAM/ahGNjCKQGp0/image_thumb12.png?imgmax=800" width="1004" height="109" /&gt;&lt;/a&gt;&amp;#160; &lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/S_aR0r3ipCI/AAAAAAAABAQ/RNUhq7y4cd8/s1600-h/image26.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/S_aR1DhBucI/AAAAAAAABAU/5n2YPpQ7AX0/image_thumb14.png?imgmax=800" width="1027" height="111" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Calling Save() in the second block throws the following exception:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S_aR1j3pONI/AAAAAAAABAY/f74l_DOsFMk/s1600-h/image3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/S_aR2GpzD5I/AAAAAAAABAc/ziefF0icWwE/image_thumb1.png?imgmax=800" width="622" height="433" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Aha, sure, this is due to the “1” in the “1:*” relationship – no cities without a default local currency (not even south european EU contries … sorry, no, not funny).&lt;/p&gt;  &lt;p&gt;Let’s change this to “0..1”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S_aR3LM_u_I/AAAAAAAABAg/NoJDX2BMauQ/s1600-h/image31.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S_aR39adV6I/AAAAAAAABAk/-12tjC2bQl4/image_thumb17.png?imgmax=800" width="268" height="678" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Running the same test again shows “green”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/S_aR4eAnoqI/AAAAAAAABAo/luHr3du5nsk/s1600-h/image%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/S_aR405oyEI/AAAAAAAABAs/k0GnIirWp_8/image_thumb%5B3%5D.png?imgmax=800" width="718" height="121" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;emitting the Update statement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/S_aR5EZZxSI/AAAAAAAABAw/837DGdHrYeA/s1600-h/image35.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/S_aR5jBJXZI/AAAAAAAABA0/btHf5sW5ecA/image_thumb19.png?imgmax=800" width="493" height="97" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Please note:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;depending on the constraint, there may be no Delete(chf) necessary &lt;/li&gt;    &lt;li&gt;relationship constraints violations throw exceptions &lt;/li&gt;    &lt;li&gt;simply set the parent’s child navigation property to null &lt;/li&gt;    &lt;li&gt;loosening the constraint to “0..1” leaves the child entity in the database &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In comparison we can do the following (with “0..1” relationship):&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;[&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; DeleteChildEntityFromParent_WithManyToOneConstraint_Throws()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// save parent and child with a 0..1:* relationship constraint&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;int&lt;/span&gt; dbGeneratedCityId = -1;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Currency&lt;/span&gt; euro = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Currency&lt;/span&gt; { Symbol = &lt;span style="color: #a31515"&gt;&amp;quot;EUR&amp;quot;&lt;/span&gt;, Name = &lt;span style="color: #a31515"&gt;&amp;quot;Euro&amp;quot;&lt;/span&gt; };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; city = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; { Code = &lt;span style="color: #a31515"&gt;&amp;quot;ATH&amp;quot;&lt;/span&gt;, Name = &lt;span style="color: #a31515"&gt;&amp;quot;Athens&amp;quot;&lt;/span&gt;, Currency = euro };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Add(city);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Save();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; dbGeneratedCityId = city.Id;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// get the parent again from the database and get rid of the child&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; reloadedCity = &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.GetById&amp;lt;&lt;span style="color: #2b91af"&gt;City&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; { Id = dbGeneratedCityId });&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNotNull(reloadedCity.Currency);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160; &lt;strong&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Delete(reloadedCity.Currency);&amp;#160; &lt;span style="color: green"&gt;// Athens and no more Euro&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.Save();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// assert that the child was properly deleted&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; reloadedUpdatedCity = &lt;span style="color: blue"&gt;this&lt;/span&gt;.target.GetById&amp;lt;&lt;span style="color: #2b91af"&gt;City&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;City&lt;/span&gt; { Id = dbGeneratedCityId });&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNull(reloadedUpdatedCity.Currency);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;and get&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S_aR5_7sHXI/AAAAAAAABA4/vDteGMfdll8/s1600-h/image%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S_aR6VPHbzI/AAAAAAAABA8/36d-oecwxF4/image_thumb%5B2%5D.png?imgmax=800" width="616" height="122" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Setting the constraint back to “1:*” throws too:&lt;/p&gt;  &lt;p&gt;DeleteChildEntityFromParent_WithManyToOneConstraint_Throws threw exception:    &lt;br /&gt;System.Data.UpdateException: A relationship from the 'CityCurrency' AssociationSet is in the 'Deleted' state. Given multiplicity constraints, a corresponding 'City' must also in the 'Deleted' state.&lt;/p&gt;  &lt;p&gt;Guessing the same behavior for NHibernate. Can anybody confirm this?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7291329020485511446?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7291329020485511446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/05/entity-framework-4-delete-child-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7291329020485511446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7291329020485511446'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/05/entity-framework-4-delete-child-from.html' title='Entity Framework 4 : Delete child from ParentChild Relationship – throws or what?'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/S_aRzVl9BLI/AAAAAAAABAE/541UZpbeKTY/s72-c/image_thumb5.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7876710838577323494</id><published>2010-05-17T13:15:00.001+01:00</published><updated>2010-05-17T13:15:12.420+01:00</updated><title type='text'>Public Interfaces of WCF in Silverlight 4</title><content type='html'>&lt;p&gt;Microsoft seems to have added some more interfaces to System.ServiceModel in Silverlight 4 (came across a blog post from &lt;a href="http://www.leastprivilege.com/AMoreElegantWayOfEmbeddingASOAPSecurityHeaderInSilverlight4.aspx"&gt;Dominick Baier&lt;/a&gt;). These can be used as WCF extensibility points.&lt;/p&gt;  &lt;p&gt;Here is a list of all the public interfaces I found reflecting the assembly:&lt;/p&gt;  &lt;p&gt;System.ServiceModel.IDefaultCommunicationTimeouts    &lt;br /&gt;System.ServiceModel.ICommunicationObject     &lt;br /&gt;System.ServiceModel.Channels.IChannel     &lt;br /&gt;System.ServiceModel.Channels.IChannelFactory     &lt;br /&gt;System.ServiceModel.Channels.IChannelFactory`1[TChannel]     &lt;br /&gt;System.ServiceModel.Channels.IInputChannel     &lt;br /&gt;System.ServiceModel.Channels.IOutputChannel     &lt;br /&gt;System.ServiceModel.Channels.IDuplexChannel     &lt;br /&gt;System.ServiceModel.Channels.ISession     &lt;br /&gt;System.ServiceModel.Channels.IInputSession     &lt;br /&gt;System.ServiceModel.Channels.IOutputSession     &lt;br /&gt;System.ServiceModel.Channels.IDuplexSession     &lt;br /&gt;System.ServiceModel.Channels.ISessionChannel`1[TSession]     &lt;br /&gt;System.ServiceModel.Channels.IDuplexSessionChannel     &lt;br /&gt;System.ServiceModel.Channels.IInputSessionChannel     &lt;br /&gt;System.ServiceModel.Channels.IOutputSessionChannel     &lt;br /&gt;System.ServiceModel.Channels.IRequestChannel     &lt;br /&gt;System.ServiceModel.Channels.IRequestSessionChannel     &lt;br /&gt;System.ServiceModel.Channels.IHttpCookieContainerManager     &lt;br /&gt;&lt;strong&gt;System.ServiceModel.Description.IEndpointBehavior      &lt;br /&gt;&lt;/strong&gt;System.ServiceModel.IExtensionCollection`1[T]     &lt;br /&gt;&lt;strong&gt;System.ServiceModel.Description.IContractBehavior      &lt;br /&gt;&lt;/strong&gt;System.ServiceModel.IExtensibleObject`1[T]     &lt;br /&gt;System.ServiceModel.IExtension`1[T]     &lt;br /&gt;&lt;strong&gt;System.ServiceModel.Description.IOperationBehavior&lt;/strong&gt;     &lt;br /&gt;System.ServiceModel.IContextChannel     &lt;br /&gt;&lt;strong&gt;System.ServiceModel.IClientChannel&lt;/strong&gt;     &lt;br /&gt;&lt;strong&gt;System.ServiceModel.Dispatcher.IClientOperationSelector      &lt;br /&gt;System.ServiceModel.Dispatcher.IParameterInspector       &lt;br /&gt;System.ServiceModel.Dispatcher.IClientMessageFormatter&lt;/strong&gt;     &lt;br /&gt;&lt;strong&gt;System.ServiceModel.Dispatcher.IClientMessageInspector      &lt;br /&gt;System.ServiceModel.Dispatcher.IDispatchMessageFormatter&lt;/strong&gt;     &lt;br /&gt;System.ServiceModel.Channels.IMessageProperty&lt;/p&gt;  &lt;p&gt;generated (without Reflector) using&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt;&amp;gt; types = &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;IClientMessageInspector&lt;/span&gt;).Assembly&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; .GetTypes()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; .Where(t =&amp;gt; t.IsInterface &amp;amp;&amp;amp; t.IsPublic)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; .ToList();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;I have not tried them, but the bold ones are interesting for WCF extensibility.&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;/p&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7876710838577323494?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7876710838577323494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/05/public-interfaces-of-wcf-in-silverlight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7876710838577323494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7876710838577323494'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/05/public-interfaces-of-wcf-in-silverlight.html' title='Public Interfaces of WCF in Silverlight 4'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8013334985070100654</id><published>2010-05-03T19:45:00.001+01:00</published><updated>2010-05-03T19:45:38.677+01:00</updated><title type='text'>Exclude from Code Coverage (Visual Studio 2010)</title><content type='html'>&lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;I was working on a library that adds some customer specific functionality to web services and WCF. I decided to have it very highly covered by unit tests. Unfortunately there is some static functionality in WCF (OperationContext) that is hard to be used in unit tests (it throws). So I wrapped this code behind a custom C# interface with a production implementation calling OperationContext and an (independant and fast) unit test implementation/mock. The small and simple production implementation had some negative impact on Visual Studio (instruction) code coverage (being below 100%). I figured out how to exclude this piece of code.&lt;/p&gt;  &lt;p&gt;The way to do this is to add the [&lt;span style="color: #2b91af"&gt;ExcludeFromCodeCoverage&lt;/span&gt;] attribute to class, property, method or event:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 10pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;namespace&lt;/span&gt; MyTrials&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// [ExcludeFromCodeCoverage]&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;NotCoveredClass&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;ExcludeFromCodeCoverage&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; NotCoveredProperty { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; CoveredProperty { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;ExcludeFromCodeCoverage&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt;&amp;gt; OnNotCoveredEvent { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt;&amp;gt; OnCoveredEvent { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;ExcludeFromCodeCoverage&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; NotCoveredMethod()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; CoveredMethod()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CoveredClass&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Write some more useful unit tests than I did for this post:&lt;/p&gt;  &lt;p style="margin: 0px"&gt;[&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;  &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; CodeCoverage_ExcludeWith_ExcludeFromCodeCoverage_FromClassMethodPropertyEvent()&lt;/p&gt;  &lt;p style="margin: 0px"&gt;{&lt;/p&gt;  &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;CoveredClass&lt;/span&gt; target = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CoveredClass&lt;/span&gt;();&lt;/p&gt;  &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;NotCoveredClass&lt;/span&gt; target2 = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;NotCoveredClass&lt;/span&gt;();&lt;/p&gt;  &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; target2.CoveredMethod();&lt;/p&gt;  &lt;p style="margin: 0px"&gt;}&lt;/p&gt;  &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin: 0px"&gt;to have it excluded:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/S98ZzT1sqYI/AAAAAAAAA_4/Ygbfv1VAdLk/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S98Z0NULbzI/AAAAAAAAA_8/j5cICSt32Pw/image_thumb%5B1%5D.png?imgmax=800" width="873" height="253" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Other ways I’ve seem were to add [System.Diagnostics.DebuggerHidden] or [System.Diagnostics.DebuggerNonUserCode] to methods – but with some side effects!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8013334985070100654?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8013334985070100654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/05/exclude-from-code-coverage-visual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8013334985070100654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8013334985070100654'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/05/exclude-from-code-coverage-visual.html' title='Exclude from Code Coverage (Visual Studio 2010)'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_8SuFzywowiM/S98Z0NULbzI/AAAAAAAAA_8/j5cICSt32Pw/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-2864979500459611143</id><published>2010-04-12T22:30:00.001+01:00</published><updated>2010-04-12T22:30:47.022+01:00</updated><title type='text'>Learning Tests</title><content type='html'>&lt;p&gt;Robert C. Martin brought it into my world in his book “&lt;a href="http://www.amazon.de/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?ie=UTF8&amp;amp;s=books-intl-de&amp;amp;qid=1271076414&amp;amp;sr=8-1"&gt;Clean Code – A Handbook of Agile Software Craftmanship&lt;/a&gt;” - “Learning tests”.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;“Learning tests”&lt;/strong&gt; (by K. Beck?) &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;are unit tests &lt;/li&gt;    &lt;li&gt;to explore (learn) a new API or framework &lt;/li&gt;    &lt;li&gt;that builds a set of tests for regression when a new version of the component is used to validate that your expectations of the API is still fulfilled &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For an upcoming training I wanted to use &lt;a href="http://automapper.codeplex.com/"&gt;AutoMapper&lt;/a&gt; (by J. Bogard) for entity to/from DTO transformations. There is not a lot of documentation around for this open source library and my first trial with the API ended in a strange exception.&lt;/p&gt;  &lt;p&gt;So I decided to write some unit tests first (getting them red was rather easy ;-) and investigate on the common use of AutoMapper (&lt;a href="http://www.google.com/codesearch"&gt;www.google.com/codesearch&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.cityofrockford.net/uploadedImages/government/HumanServices/HeadStart/Services/computer%20kids.jpg" width="369" height="240" /&gt;&lt;/p&gt;  &lt;p&gt;Here are some of my tests (please note the method names which should give you an idea about my expectations): &lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Learning tests for automapper by Jimmy Bogard from http://automapper.codeplex.com/ &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;[&lt;span style="color: #2b91af"&gt;TestClass&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AutoMapperTests&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestInitialize&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; TestInitialize()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Reset();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;ExpectedException&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;AutoMapperMappingException&lt;/span&gt;))]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_NoMappingExists_Throws()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple());&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_CreateMap_ReturnsMappingExpression()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;IMappingExpression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt; mappingExpression = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple());&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsInstanceOfType(destination, &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;), &lt;span style="color: #a31515"&gt;&amp;quot;must return instance of destination type&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_CreateMapForOneMember_ReturnsDestinationWithOneMember()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.Text, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(s =&amp;gt; s.Text));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; source = &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;(source);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(source.Text, destination.Text, &lt;span style="color: #a31515"&gt;&amp;quot;member must be mapped&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_CreateMapForMembersIgnoreOne_ReturnsDestinationWithoutMember()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.Text, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(s =&amp;gt; s.Text))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.Floating, c =&amp;gt; c.Ignore())&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.Number, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: blue"&gt;int&lt;/span&gt;&amp;gt;(s =&amp;gt; s.Number));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; source = &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;(source);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreNotEqual&amp;lt;&lt;span style="color: blue"&gt;double&lt;/span&gt;&amp;gt;(source.Floating, destination.Floating, &lt;span style="color: #a31515"&gt;&amp;quot;ignored member must not be mapped&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_CreateMapForChildMembers_ReturnDestinationWithChildMembers()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.Child, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;&amp;gt;(s =&amp;gt; s.Child));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; source = &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; source.Child = &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;(source);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(source.Child.Text, destination.Child.Text, &lt;span style="color: #a31515"&gt;&amp;quot;child member (reference type) not mapped&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;ExpectedException&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;AutoMapperMappingException&lt;/span&gt;))]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_CreateMapWithoutRecursiveMaps_Throws()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// map &amp;quot;outer&amp;quot; (root) type &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.DestinationType, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;&amp;gt;(s =&amp;gt; s.SourceType));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt; source = &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;.CreateSimple();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt;&amp;gt;(source);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.Fail(&lt;span style="color: #a31515"&gt;&amp;quot;inner (reference type) map not done. Automapper must throw&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Map_CreateMapWithRecursiveMaps_ReturnsTreeDestination()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// map &amp;quot;inner&amp;quot; type&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.Text, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(s =&amp;gt; s.Number.ToString(&lt;span style="color: #2b91af"&gt;CultureInfo&lt;/span&gt;.CurrentCulture)));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;// map &amp;quot;outer&amp;quot; (root) type &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.CreateMap&amp;lt;&lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ForMember(d =&amp;gt; d.DestinationType, c =&amp;gt; c.MapFrom&amp;lt;&lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;&amp;gt;(s =&amp;gt; s.SourceType));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt; source = &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;.CreateSimple();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt; destination = &lt;span style="color: #2b91af"&gt;Mapper&lt;/span&gt;.Map&amp;lt;&lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt;&amp;gt;(source);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; source.SourceType.Number.ToString(&lt;span style="color: #2b91af"&gt;CultureInfo&lt;/span&gt;.CurrentCulture), &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; destination.DestinationType.Text,&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #a31515"&gt;&amp;quot;child member (of different reference types) not mapped&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; // … and more&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;And here are my tests classes:&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Tests-only source type for mapping tests.&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;internal&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; Number { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Text { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;double&lt;/span&gt; Floating { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; Child { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; CreateSimple()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; { Floating = 1.1, Number = 13, Text = &lt;span style="color: #2b91af"&gt;Guid&lt;/span&gt;.NewGuid().ToString() };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;internal&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt;? Id { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt; SourceType { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt; CreateSimple()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TopSourceType&lt;/span&gt; { Id = 13, SourceType = &lt;span style="color: #2b91af"&gt;SourceType&lt;/span&gt;.CreateSimple() };&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Tests-only destination type for mapping tests.&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;internal&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; Number { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Text { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;double&lt;/span&gt; Floating { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; Child { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; ToString()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #2b91af"&gt;CultureInfo&lt;/span&gt;.CurrentCulture, &lt;span style="color: #a31515"&gt;&amp;quot;Number = {0}, Text = {1}, Floating = {2}&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;this&lt;/span&gt;.Number, &lt;span style="color: blue"&gt;this&lt;/span&gt;.Text, &lt;span style="color: blue"&gt;this&lt;/span&gt;.Floating);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;internal&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TopDestinationType&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Id { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DestinationType&lt;/span&gt; DestinationType { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-2864979500459611143?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/2864979500459611143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/04/learning-tests.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2864979500459611143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2864979500459611143'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/04/learning-tests.html' title='Learning Tests'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5595908066596735050</id><published>2010-03-16T14:44:00.001+01:00</published><updated>2010-03-16T14:44:26.259+01:00</updated><title type='text'>Specification Pattern with Func&lt;&gt;</title><content type='html'>&lt;p&gt;Specification is a pattern (Evans/Fowler) that can be used to apply rules for your domain entities:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Create a specification that is able to tell if a candidate object matches some criteria. The specification has a method isSatisfiedBy (anObject) : Boolean that returns &amp;quot;true&amp;quot; if all criteria are met by anObject.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;It defines an interface like&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;bool&lt;/span&gt; IsSatisfiedBy&amp;lt;T&amp;gt;(T candidate);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt; And(&lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt; other);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt; Or(&lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt; other);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt; Not();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;where IsSatisfiedBy() wraps the business logic (not contained in the entity as OO would suggest). &lt;/p&gt;  &lt;p&gt;That allows to write business logic code like&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;price.And(seats).And(slow.Not())&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;My car specification:&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt; : Specifications.&lt;span style="color: #2b91af"&gt;CompositeSpecification&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;, &lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt; IsSatisfiedFunction { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; CarSpecification(&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;, &lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt; isSatisfiedFunction)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.IsSatisfiedFunction = isSatisfiedFunction;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; IsSatisfiedBy&amp;lt;T&amp;gt;(T candidate)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (!(candidate &lt;span style="color: blue"&gt;is&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ArgumentException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;must pass Car entity&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;candidate&amp;quot;&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: blue"&gt;this&lt;/span&gt;.IsSatisfiedFunction != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.IsSatisfiedFunction(candidate &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;The whole code: &lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;partial&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MainWindow&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;Window&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;&amp;gt; cars;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt; price = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt;(c =&amp;gt; c.Price &amp;lt;= 40000);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt; seats = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt;(c =&amp;gt; c.Seats &amp;gt;= 7);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt; slow = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CarSpecification&lt;/span&gt;(c =&amp;gt; c.HorsePower &amp;lt; 140);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; MainWindow()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; InitializeComponent();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.cars = ApplyRules(&lt;span style="color: #2b91af"&gt;Cars&lt;/span&gt;.Get());&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.DataContext = &lt;span style="color: blue"&gt;this&lt;/span&gt;.cars;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;&amp;gt; ApplyRules(&lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;&amp;gt; cars)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;ISpecification&lt;/span&gt; myCarSpecification = price.And(seats).And(slow.Not());&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; cars.Where(c =&amp;gt; myCarSpecification.IsSatisfiedBy&amp;lt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;&amp;gt;(c)).ToList();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Definitively this simple example could be written in other ways. More importantly you evaluate your new car ….&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S5-LNq1Q9rI/AAAAAAAAA-o/NoNUefH7yq8/s1600-h/image%5B8%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/S5-LONupvGI/AAAAAAAAA-s/JikoIWmPXgk/image_thumb%5B4%5D.png?imgmax=800" width="868" height="192" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5595908066596735050?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5595908066596735050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/03/specification-pattern-with-func.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5595908066596735050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5595908066596735050'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/03/specification-pattern-with-func.html' title='Specification Pattern with Func&amp;lt;&amp;gt;'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/S5-LONupvGI/AAAAAAAAA-s/JikoIWmPXgk/s72-c/image_thumb%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8055590780825869193</id><published>2010-03-16T11:16:00.001+01:00</published><updated>2010-03-16T11:16:00.133+01:00</updated><title type='text'>Linq in a Generic Data Access Layer with EF4</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Decoupling a data access layer (DAL) from business or service logic has become mainstream for some time now – not only due to testing (mocking) reasons but also because replacing your ageing data access technology or your database (manufacturer) may be a topic.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Interface&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I’ve created a simple repository pattern (CRUD) kind of interface over the last year or two. The methods of the interface are generic&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; Add&amp;lt;T&amp;gt;(T entity);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; Delete&amp;lt;T&amp;gt;(T entity);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; Update&amp;lt;T&amp;gt;(T entity);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;T&amp;gt; GetAll&amp;lt;T&amp;gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;// and more&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;The implementation was done with NHibernate 2.1 and recently with Entity Framework 4.0 (EF4). &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Domain Model&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I had several domain models and object-relational mapping (ORM) definitions. Here’s a simple model to show things:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/S59aVImxwlI/AAAAAAAAA-Q/nW-I2JYqYF4/s1600-h/image13.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/S59aVmwyC-I/AAAAAAAAA-U/mXHruYpfzQw/image_thumb7.png?imgmax=800" width="415" height="555" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A blog or facebook like system that stores Entry objects allows for people to add Comments or just say they like it (Liker).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Using Linq&lt;/strong&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Linq is a powerful language feature that can be used to submit queries from the layers on top of the DAL. It is data access and database independent because it works on the domain model – so no coupling to a particular technology.&lt;/p&gt;  &lt;p&gt;For this reason I provided a Linq entry point to the interface. Shown here is the EF4 implementation:&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;T&amp;gt; GetLinq&amp;lt;T&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;ObjectContext&lt;/span&gt; context = GetObjectContext();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; context.CreateObjectSet&amp;lt;T&amp;gt;() &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;T&amp;gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;} &lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Or even easier with NHibernate and the NHibernate Linq provider:&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; IQueryable&amp;lt;T&amp;gt; GetLinq&amp;lt;T&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.Session.Linq&amp;lt;T&amp;gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Now you can program statements like&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;l = databaseContext.GetLinq&amp;lt;&lt;span style="color: #2b91af"&gt;Entry&lt;/span&gt;&amp;gt;().Where(entry =&amp;gt; entry.Title.Length &amp;gt; &lt;span style="color: #a52a2a"&gt;5&lt;/span&gt;).ToList();&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;emitting SQLExpress 2008 T-SQL:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/S59aWIW5PTI/AAAAAAAAA-Y/Qg1KTPWIV2s/s1600-h/image9.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S59aWonVw8I/AAAAAAAAA-c/ZeyRHpJmSHo/image_thumb5.png?imgmax=800" width="319" height="143" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Or more complex&lt;/p&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; result = &lt;span style="color: blue"&gt;from&lt;/span&gt; x &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.databaseContext.GetLinq&amp;lt;&lt;span style="color: #2b91af"&gt;Entry&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;join&lt;/span&gt; y &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.databaseContext.GetLinq&amp;lt;&lt;span style="color: #2b91af"&gt;Liker&lt;/span&gt;&amp;gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;on&lt;/span&gt; x.Id &lt;span style="color: blue"&gt;equals&lt;/span&gt; y.Entry_FK&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;select&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; { x.Title, y.Posted };&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;producing&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S59aXFwakeI/AAAAAAAAA-g/vJsPuMccx6s/s1600-h/image6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/S59aX_vom3I/AAAAAAAAA-k/xYTXnngbT48/image_thumb2.png?imgmax=800" width="639" height="104" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Clean and optimized! The above seems to work due to lazy evaluation and loading. &lt;/p&gt;  &lt;p&gt;Note that you could use GetAll&amp;lt;T&amp;gt;().Where() kind of code, but this would return all (10000+) records and only filter on the result set – so a performance killer.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8055590780825869193?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8055590780825869193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/03/linq-in-generic-data-access-layer-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8055590780825869193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8055590780825869193'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/03/linq-in-generic-data-access-layer-with.html' title='Linq in a Generic Data Access Layer with EF4'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_8SuFzywowiM/S59aVmwyC-I/AAAAAAAAA-U/mXHruYpfzQw/s72-c/image_thumb7.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4288927318106392526</id><published>2010-01-15T16:36:00.001+01:00</published><updated>2010-01-15T16:36:18.555+01:00</updated><title type='text'>Create your own Web Casts with Microsoft Expression Encoder Screen Capture</title><content type='html'>&lt;p&gt;Have you ever explained a certain topic to a peer or a live audience and wanted to&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;record your computer screen&lt;/li&gt;    &lt;li&gt;record the audio&lt;/li&gt;    &lt;li&gt;save this to a file&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;for later reuse or another audience?&lt;/p&gt;  &lt;p&gt;Then the &lt;a href="http://www.microsoft.com/Expression/products/Encoder_Overview.aspx"&gt;Microsoft Expression Encoder (3) Screen Capture&lt;/a&gt; is an application to look at. Screen Capture is included in Expression Studio 3, Expression Web 3 or the Expression Professional Subscription.&lt;/p&gt;  &lt;p&gt;Start the application, enable the microphone (and web cam; no tried yet myself) and press the red dot button.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/S1CLYW4egnI/AAAAAAAAA3I/O4U52yNt3L0/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/S1CLY-XOgnI/AAAAAAAAA3M/cvJwkdAnIeg/image_thumb%5B1%5D.png?imgmax=800" width="435" height="91" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select the screen area to capture&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/S1CLZT4Y7DI/AAAAAAAAA3Q/Q9ae8-tFZnc/s1600-h/image%5B22%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/S1CLZxfJ-nI/AAAAAAAAA3U/ktNjYXplFZQ/image_thumb%5B17%5D.png?imgmax=800" width="591" height="480" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Press the red button again to confirm your selection&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/S1CLaRrb6SI/AAAAAAAAA3Y/haocICwtgZU/s1600-h/image%5B13%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/S1CLasJvACI/AAAAAAAAA3c/Iz9ZinKzLjQ/image_thumb%5B7%5D.png?imgmax=800" width="443" height="101" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Pausing recording is done with Ctrl+Shift+F11, stopping with Ctrl+Shift+F12.&lt;/p&gt;  &lt;p&gt;An .xesc file is now create. To encode this to a more common format (like mp4 or wmv) Microsoft Expression Encoder 3 can be used: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/S1CLbXr2OcI/AAAAAAAAA3g/RRWLQpvsjz0/s1600-h/image%5B24%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/S1CLccmGCNI/AAAAAAAAA3o/CjvoP007EbE/image_thumb%5B19%5D.png?imgmax=800" width="726" height="496" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4288927318106392526?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4288927318106392526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2010/01/create-your-own-web-casts-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4288927318106392526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4288927318106392526'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2010/01/create-your-own-web-casts-with.html' title='Create your own Web Casts with Microsoft Expression Encoder Screen Capture'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_8SuFzywowiM/S1CLY-XOgnI/AAAAAAAAA3M/cvJwkdAnIeg/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6308833120167751894</id><published>2009-11-16T18:37:00.001+01:00</published><updated>2010-01-04T16:57:24.592+01:00</updated><title type='text'>S’Zockerpapier het (ned) abgschlage</title><content type='html'>&lt;p&gt;Don’t quote me on this, colleagues at home, readers, or anybody out there … because I do not even know the source of this Swiss-German saying, but the meaning is the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;something is not as sweet as it has been once &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can apply this to this years PDC give-away:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SwGNyWMXhRI/AAAAAAAAA1E/SQGa41mbDDQ/s1600-h/DSCN2773%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DSCN2773" border="0" alt="DSCN2773" src="http://lh4.ggpht.com/_8SuFzywowiM/SwGNyti0vQI/AAAAAAAAA1I/HdbvniYOvaQ/DSCN2773_thumb%5B1%5D.jpg?imgmax=800" width="419" height="319" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The traditional bag is missing some potency and this years drinking bottle was made from recyclable plastic only.&lt;/p&gt;  &lt;p&gt;Let’s hope this is not foreboding of the upcoming technologies, products and services from Microsoft ;-)&lt;/p&gt;  &lt;p&gt;--- Updated ---&lt;/p&gt;  &lt;p&gt;Steven Sinofsky must have read my post before his day 2 keynote, where he announced the unbelievable compensation&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2601/4125642053_93c9da89ab_o.jpg" width="416" height="358" /&gt;&lt;/p&gt;  &lt;p&gt;a Win7, multi-touch, tablet subnote for 5000 attendees. So&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;things are even sweeter than ever before …&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;What a way to promote multi-touch adoption with developers!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6308833120167751894?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6308833120167751894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/11/szockerpapier-het-abgschlage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6308833120167751894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6308833120167751894'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/11/szockerpapier-het-abgschlage.html' title='S’Zockerpapier het (ned) abgschlage'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_8SuFzywowiM/SwGNyti0vQI/AAAAAAAAA1I/HdbvniYOvaQ/s72-c/DSCN2773_thumb%5B1%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-1796274230956226436</id><published>2009-11-16T16:08:00.001+01:00</published><updated>2009-11-16T16:17:33.063+01:00</updated><title type='text'>Windows HPC Server 2008 and how to run your jobs</title><content type='html'>&lt;table border="0" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="173"&gt;         &lt;p&gt;A twelve hours flight to Los Angeles is a very long time that can be used in a couple of way. One is sleeping, using the on board entertainment system (see on the right; so not to sleep) or reading.&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="227"&gt;&lt;img src="http://lodim.files.wordpress.com/2009/03/the-taking-of-pelham-1-2-3.jpg" width="188" height="278" /&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;One job you come across every couple of years (or even month as did I lately) as a Windows developer is running computational work that last for a couple of minutes, hours or event up to days. Microsoft Windows HPC Server may look promising to replace a lot of your distributed runtime infrastructure code. It contains as a major component a &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=DAB977D5-2311-4B80-9257-477838C0EB6F&amp;amp;displaylang=en"&gt;job scheduler&lt;/a&gt; I will make some notes about here.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;HPC 2008 brings high performance computing in a cluster environment to the Windows platform. A so-called job may contain several tasks, which basically are single executables (a simple sequential program or an already parallel one) you plan to run. There are a lot of ways to (1.) submit your job:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Job management console&lt;/li&gt;    &lt;li&gt;CLI &amp;amp; PowerShell&lt;/li&gt;    &lt;li&gt;SOA APIs (WCF)&lt;/li&gt;    &lt;li&gt;COM APIs&lt;/li&gt;    &lt;li&gt;.NET APIs or&lt;/li&gt;    &lt;li&gt;WS-HPC Basic Profile (Web service)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Job scheduling (2.) can get quite sophisticated using First-come-first-serve, exclusive scheduling, resource optimizing. Job execution (3.) goes through the states Queued, Running, Finished, Failed or Cancelled. The scheduler decides according to defined requirements which job to run. Failed jobs can get automatically re-run. Jobs can run in parallel on several nodes or on several local CPUs. Tasks are usually not designed to communicate (I may come back to this in another post). Jobs may even get preempted (killed or slowed down to let other jobs be run before).&lt;/p&gt;  &lt;p&gt;The head note (which can also be a compute node) acts as the central job management point. Jobs are stored in an underlying SQL-Server (Express?) database and execute under the submitting users account. There exists only one queue for a cluster.&lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.microsoft.com/global/hpc/en/us/PublishingImages/HPCEcosystem_lrg.png" /&gt;(source: &lt;a href="http://www.microsoft.com/hpc/en/us/features.aspx"&gt;Microsoft&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Job Submission&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Jobs get priorities, allocated resources (nodes, CPU and run time), dependency information or node exclusivity upon submission. A job can be submitted from the command line like this:&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Courier New"&gt;job new [options] [/f:jobdescriptionxmlfile] [/scheduler:host]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The two primary client user interface tools to use are the Job Management Console and the Administration Console. Jobs defined with the new job wizard can be saved to a job description XML file (that is intended to be used or even automatically generated). Message-Passing-Interface (MPI) executables must be prepended with &lt;font size="3" face="Courier New"&gt;mpiexec&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.microsoft.com/global/hpc/en/us/PublishingImages/HPCJobScheduler_lrg.png" /&gt; (source: &lt;a href="http://www.microsoft.com/hpc/en/us/features.aspx"&gt;Microsoft&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;Job input (data) and output (results) can be on the local node or on a file share. Large and static data should be copied to the nodes whereas small and dynamically updated data should be placed centrally. Data should be cut into pieces (fragmented) and run in so-called “sweep”, which is some kind of (for int i = 0; i &amp;lt; 100; i++) – loop index. &lt;/p&gt;  &lt;p&gt;Jobs can also be submitted using the .NET API and the Microsoft.Hpc.Server namespace classes Scheduler (to connect and submit), ISchedulerJob job = scheduler.CreateJob(), job.AddTask(t), etc.&lt;/p&gt;  &lt;p&gt;Another way is to call the scheduler using Web Services and the HPCPBClient class (hpcbp.CreateAcitivity(jdsl), hpcbp.GetActivityStatuses(), etc.).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Job Scheduling&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The most simple scheduling is a FIFO queue. “Backfill” is a method where time windows are used for small jobs to run according to the definitions of the large submitted jobs. The “resource matchmaking” method is done by the scheduler according to compute, network and application requirements. “Job templates” are administrator or system owner predefined jobs that can be used by high performance computing client users.&lt;/p&gt;  &lt;p&gt;Microsoft seems to have done a good job when it comes down to security. As mentioned above, jobs are executed under the submitting users account. Credentials are passed during submission and safely (encrypted, etc.) stored to be used when the job needs to run. Credentials are passed by secured .NET remoting channels to the nodes and deleted after the job run.&lt;/p&gt;  &lt;p&gt;&lt;img src="http://i.technet.microsoft.com/cc719013.ce830e9a-b73c-4ed8-91ac-93470d286af1(en-us).gif" /&gt;&lt;/p&gt;  &lt;p&gt;Picture: The fail-over topology from &lt;a href="http://technet.microsoft.com/en-us/library/cc719013(WS.10).aspx"&gt;Microsoft&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Please note the HPC 2008 Server supports the MPI Standard by it’s own MS-MPI implementation.&lt;/p&gt;  &lt;p&gt;HPC 2008 Server looks reasonable priced at around 500$ per node (as I found out after a quick search). You are getting some Quality-of-Services you probably cannot code yourself for this money. So have a look yourself next time defining IJob, IJobScheduling interfaces in your project.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-1796274230956226436?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/1796274230956226436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/11/windows-hpc-server-2008-and-how-to-run.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1796274230956226436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1796274230956226436'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/11/windows-hpc-server-2008-and-how-to-run.html' title='Windows HPC Server 2008 and how to run your jobs'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8981780557556545310</id><published>2009-11-06T15:53:00.001+01:00</published><updated>2009-11-06T15:53:13.206+01:00</updated><title type='text'>IE8 vs. Google Codesearch</title><content type='html'>&lt;p&gt;Google codesearch (&lt;a href="http://www.google.com/codesearch"&gt;www.google.com/codesearch&lt;/a&gt;) is great to search for source code. Since installing Internet Explorer 8 recently there is an error on the page. Who’s the culprit:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SvQ4Uruf3-I/AAAAAAAAA00/QvZ36vQGUqc/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/SvQ4VJi-zpI/AAAAAAAAA04/VugIPhptJUo/image_thumb%5B1%5D.png?imgmax=800" width="715" height="483" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Webpage error details &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729)     &lt;br /&gt;Timestamp: Fri, 6 Nov 2009 14:45:24 UTC &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Message: Not implemented &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Line: 339     &lt;br /&gt;Char: 257      &lt;br /&gt;Code: 0      &lt;br /&gt;URI: &lt;/font&gt;&lt;a href="http://www.google.com/codesearch/js/CachedFile/F1A2CB189D0FCB1FF201C42BF6A5447C.cache.js"&gt;&lt;font face="Courier New"&gt;http://www.google.com/codesearch/js/CachedFile/F1A2CB189D0FCB1FF201C42BF6A5447C.cache.js&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I found out IE8 compatibility view does the trick:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/SvQ4VvchzUI/AAAAAAAAA08/BCfUxdfWBMI/s1600-h/image%5B14%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/SvQ4WKMrUMI/AAAAAAAAA1A/DNwXhsb1e78/image_thumb%5B8%5D.png?imgmax=800" width="688" height="719" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Google states they are working on it &lt;a title="http://groups.google.com/group/google-code-search/browse_thread/thread/587e5f2e521b384d" href="http://groups.google.com/group/google-code-search/browse_thread/thread/587e5f2e521b384d"&gt;http://groups.google.com/group/google-code-search/browse_thread/thread/587e5f2e521b384d&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8981780557556545310?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8981780557556545310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/11/ie8-vs-google-codesearch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8981780557556545310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8981780557556545310'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/11/ie8-vs-google-codesearch.html' title='IE8 vs. Google Codesearch'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_8SuFzywowiM/SvQ4VJi-zpI/AAAAAAAAA04/VugIPhptJUo/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5054968511762113827</id><published>2009-10-27T16:24:00.001+01:00</published><updated>2009-10-27T16:24:18.154+01:00</updated><title type='text'>F# – sharp what?</title><content type='html'>&lt;p&gt;   &lt;br /&gt;I’m really happy with C# as an expressive, powerful and readable language (after recently being somewhat unfaithful with VB.NET). For a customer project doing heavy mathematics I had a look on the suitability of F# for concurrent table- and matrix-oriented math.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://images.google.ch/imgres?imgurl=http://www.whattofix.com/images/FSharpLogo.png&amp;amp;imgrefurl=http://www.whattofix.com/blog/archives/2007/10/is_fsharp_enoug.php&amp;amp;usg=__eHrpQZe8SuT9lVg6qpIjt2jdAKE=&amp;amp;h=300&amp;amp;w=300&amp;amp;sz=4&amp;amp;hl=de&amp;amp;start=15&amp;amp;sig2=An2PulA4I7fEkzrCvrR8Ww&amp;amp;tbnid=wOTtiHmizvCbPM:&amp;amp;tbnh=116&amp;amp;tbnw=116&amp;amp;prev=/images%3Fq%3Df-sharp%26gbv%3D2%26hl%3Dde&amp;amp;ei=O_PmSs3AFY7hsAabyMDoBQ"&gt;&lt;img src="http://t1.gstatic.com/images?q=tbn:wOTtiHmizvCbPM:http://www.whattofix.com/images/FSharpLogo.png" width="74" height="74" /&gt;&lt;/a&gt; (logo from &lt;a href="http://www.whattofix.com/blog/archives/2007/10/is_fsharp_enoug.php"&gt;whattofix.com&lt;/a&gt;; not found one from Microsoft!?)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the &lt;a href="http://msdn.microsoft.com/de-ch/fsharp/default(en-us).aspx"&gt;Microsoft F# Developer Center&lt;/a&gt; I got a first overview (e.g. F# will be part of Visual Studio 2010). &lt;/p&gt;  &lt;p&gt;F# is a functional, compiled but object-oriented language. An interactive console allows for initial coding:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/SucQgnAJDPI/AAAAAAAAAzU/wU8axDsrR9A/s1600-h/image%5B22%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/SucQhhLjRHI/AAAAAAAAAzY/uuWJBtiuUe0/image_thumb%5B14%5D.png?imgmax=800" width="547" height="297" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There is no autocompletion, syntax highlighting or intellisense. Errors are quite understandable however.&lt;/p&gt;  &lt;p&gt;Or you can create a new Visual Studio project:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SucQiNSmqXI/AAAAAAAAAzc/mt6RFh1hiSY/s1600-h/image%5B15%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/SucQjJFyj6I/AAAAAAAAAzg/6AMH3sDCF4o/image_thumb%5B9%5D.png?imgmax=800" width="552" height="384" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There is useful little video on &lt;a href="http://channel9.msdn.com/shows/10-4/10-4-Episode-17-F-Intro/"&gt;channel9&lt;/a&gt; that gives a first idea of the language. Since Cobol/Lisp I have not felt so “strange” with a new language …&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Downloads&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;F# October 2009 &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=b55f0532-ac3c-4106-918c-5586a953a7da&amp;amp;displaylang=en"&gt;CTP&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;F# samples (V 0.3) on &lt;a href="http://code.msdn.microsoft.com/fsharpsamples"&gt;code.msdn&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The installation for VS2008 took some minutes:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SucQjvOAVxI/AAAAAAAAAzk/4SIGG875tBc/s1600-h/image%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/SucQkTYnpGI/AAAAAAAAAzo/EOMrefsfnkY/image_thumb%5B2%5D.png?imgmax=800" width="545" height="431" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Learning&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In the samples there is a solution called Samples101 that you can build and run:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/SucQk80k68I/AAAAAAAAAzs/d9mwK27ipNA/s1600-h/image%5B11%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/SucQlm2xZ4I/AAAAAAAAAzw/BspYWj1yDMA/image_thumb%5B7%5D.png?imgmax=800" width="1001" height="845" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Concurrency&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the development center site there a book chapter about asynchronous and concurrent programming (&lt;a href="http://download.microsoft.com/download/b/b/6/bb666ebe-e643-496f-b290-03527d157b47/Expert.F.Sharp_Ch13_8504Syme.pdf"&gt;Apress&lt;/a&gt;). Unfortunately this book is based on an older version. I found some slides from &lt;a href="http://www.slideshare.net/mattpodwysocki/async-and-parallel-f"&gt;Matthew Podwysocki&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The technique I am interested in is called “asynchronous workflows” (a powerful set of techniques for structuring asynchronous programs in a natural way).&lt;/p&gt; &lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green128\blue0;\red255\green255\blue255;\red0\green0\blue255;\red0\green0\blue0;\red128\green0\blue0;}??\fs24 \cf1 // mleder.blogspot.com : my.net\par ??// my first f# concurrent program\par ??\par ??\cf3 #light \par ??\par ??\cf1 // import or open namespaces\par ??\cf3 open\cf0  System.IO\par ??\cf3 open\cf0  Microsoft.FSharp.Control.CommonExtensions\par ??\par ??\cf1 // define array of key/value pairs\par ??\cf3 let\cf0  people = [\cf5 "Markus"\cf0 , \cf5 "F# is cool"\cf0 ;\par ??               \cf5 "Jonas"\cf0 , \cf5 "eff what?"\cf0 ;\par ??               \cf5 "Aaron"\cf0 , \cf5 "(doing something different)"\cf0 ;\par ??               \cf5 "Elias"\cf0 , \cf5 "bla bla bla"\cf0 ]\par ??\par ??\cf1 // define a function to be executed asynchonously                       \par ??\cf3 let\cf0  myAsync(name:string, comment:string) =\par ??    async \{\par ??        System.Console.WriteLine(\cf5 "Waiting \{0\} ... \{1\} / \{2\}"\cf0 , System.Threading.Thread.CurrentThread.ManagedThreadId, name, comment)\par ??        System.Threading.Thread.Sleep 1000        \par ??        System.Console.WriteLine(\cf5 "Waited! \{0\}"\cf0 , name)\par ??    \}\par ??        \par ??\cf1 // change the number of threads in the pool\par ??// let ok = System.Threading.ThreadPool.SetMinThreads(10,10)\par ??\par ??// start function on thread pool threads\par ??\cf3 for\cf0  nm,url \cf3 in\cf0  people \cf3 do\par ??\cf0     Async.Start(myAsync(nm,url))\par ??    \par ??\cf1 // wait for termination (using the "pass-forward" or "pipe-forward" operator to chain calls)\par ??\cf0 System.Console.ReadKey() |&amp;gt; ignore\par ??}&lt;br /&gt;--&gt;  &lt;div style="font-family: courier new; background: white; color: black; font-size: 12pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// mleder.blogspot.com : my.net&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// my first f# concurrent program&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;#light &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// import or open namespaces&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; System.IO&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; Microsoft.FSharp.Control.CommonExtensions&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// define array of key/value pairs&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; people = [&lt;span style="color: maroon"&gt;&amp;quot;Markus&amp;quot;&lt;/span&gt;, &lt;span style="color: maroon"&gt;&amp;quot;F# is cool&amp;quot;&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: maroon"&gt;&amp;quot;Jonas&amp;quot;&lt;/span&gt;, &lt;span style="color: maroon"&gt;&amp;quot;eff what?&amp;quot;&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: maroon"&gt;&amp;quot;Aaron&amp;quot;&lt;/span&gt;, &lt;span style="color: maroon"&gt;&amp;quot;(doing something different)&amp;quot;&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: maroon"&gt;&amp;quot;Elias&amp;quot;&lt;/span&gt;, &lt;span style="color: maroon"&gt;&amp;quot;bla bla bla&amp;quot;&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// define a function to be executed asynchonously&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; myAsync(name:string, comment:string) =&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; async {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Console.WriteLine(&lt;span style="color: maroon"&gt;&amp;quot;Waiting {0} ... {1} / {2}&amp;quot;&lt;/span&gt;, System.Threading.Thread.CurrentThread.ManagedThreadId, name, comment)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Threading.Thread.Sleep 1000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Console.WriteLine(&lt;span style="color: maroon"&gt;&amp;quot;Waited! {0}&amp;quot;&lt;/span&gt;, name)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// change the number of threads in the pool&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// let ok = System.Threading.ThreadPool.SetMinThreads(10,10)&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// start function on thread pool threads&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; nm,url &lt;span style="color: blue"&gt;in&lt;/span&gt; people &lt;span style="color: blue"&gt;do&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; Async.Start(myAsync(nm,url))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// wait for termination (using the &amp;quot;pass-forward&amp;quot; or &amp;quot;pipe-forward&amp;quot; operator to chain calls)&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;System.Console.ReadKey() |&amp;gt; ignore&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Which seems to run on 2 pool threads (instead of 2 per CPU which would mean 4) !?:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SucQmL3aNJI/AAAAAAAAAz0/K9Nk6kOjtNg/s1600-h/image%5B30%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/SucQmyJjiGI/AAAAAAAAAz4/RA5p1Eyq3TM/image_thumb%5B18%5D.png?imgmax=800" width="555" height="204" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Uncommenting the SetMinThread line above gives a different behavior&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/SucQndiUH3I/AAAAAAAAAz8/qZmgLcIUBkM/s1600-h/image%5B37%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/SucQoTGRzrI/AAAAAAAAA0A/aOP-B8dRS2k/image_thumb%5B23%5D.png?imgmax=800" width="559" height="224" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;F# Summary&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;a language you have to get used to&lt;/li&gt;    &lt;li&gt;steep learning curve (for a C# guy like me)&lt;/li&gt;    &lt;li&gt;not widely used yet. Check maintainability and people skills.&lt;/li&gt;    &lt;li&gt;suited for certain problem domains (like mathematics, analytics, simulation, …); to be preferred to other CLR languages&lt;/li&gt;    &lt;li&gt;building on existing .NET framework assets&lt;/li&gt;    &lt;li&gt;well integrated into Visual Studio (even if my often used “go to definition”/F12 does not work)&lt;/li&gt;    &lt;li&gt;concurrent and asynchronous operation is an integrated part of the language&lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5054968511762113827?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5054968511762113827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/10/f-sharp-what.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5054968511762113827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5054968511762113827'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/10/f-sharp-what.html' title='F# – sharp what?'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/SucQhhLjRHI/AAAAAAAAAzY/uuWJBtiuUe0/s72-c/image_thumb%5B14%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6791050499822412719</id><published>2009-10-14T09:03:00.001+01:00</published><updated>2009-10-14T09:03:37.954+01:00</updated><title type='text'>ASP.NET MVC 2 Resources</title><content type='html'>&lt;p&gt;I’ve been asked about MVC tutorials, blogs, how to learn. Here are some useful links to get started for all of you:&lt;/p&gt;  &lt;p&gt;&lt;img alt="ASP.NET MVC" src="http://i2.asp.net/common/www-css/i/mvc-logo-landing-page.png?cdn_id=22" /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The official Microsoft ASP.NET MVC web site is &lt;a href="http://www.asp.net/mvc/"&gt;here&lt;/a&gt; under &lt;a title="http://www.asp.net/mvc/" href="http://www.asp.net/mvc/"&gt;http://www.asp.net/mvc/&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;As MVC is Open Source Software (OSS) see also &lt;a href="http://aspnet.codeplex.com/Wiki/View.aspx?title=MVC"&gt;codeplex&lt;/a&gt; under &lt;a href="http://aspnet.codeplex.com/Wiki/View.aspx?title=MVC"&gt;http://aspnet.codeplex.com/Wiki/View.aspx?title=MVC&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;There’s the blog of &lt;a href="http://weblogs.asp.net/Scottgu/"&gt;ScottGu&lt;/a&gt; (“who lives in Seattle and builds a few products for Microsoft” :-) under &lt;a href="http://weblogs.asp.net/Scottgu/"&gt;http://weblogs.asp.net/Scottgu/&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Upcoming features of MVC 2 on &lt;a href="http://dotnetslackers.com/articles/aspnet/A-First-Look-at-ASP-NET-MVC-2.aspx"&gt;dotnetslackers.com&lt;/a&gt; from Ben Scheirman here &lt;a title="http://dotnetslackers.com/articles/aspnet/A-First-Look-at-ASP-NET-MVC-2.aspx" href="http://dotnetslackers.com/articles/aspnet/A-First-Look-at-ASP-NET-MVC-2.aspx"&gt;http://dotnetslackers.com/articles/aspnet/A-First-Look-at-ASP-NET-MVC-2.aspx&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Sample chapter from Wiley &lt;a href="http://media.wiley.com/assets/1539/15/professionalaspnet35mvc_chapter13.pdf "&gt;“Professional ASP.NET 3.5”&lt;/a&gt; here &lt;a href="http://media.wiley.com/assets/1539/15/professionalaspnet35mvc_chapter13.pdf"&gt;http://media.wiley.com/assets/1539/15/professionalaspnet35mvc_chapter13.pdf&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Great cheat sheets from &lt;a href="http://www.sadev.co.za/content/aspnet-mvc-cheat-sheets"&gt;SADev.co.za&lt;/a&gt; under &lt;a title="http://www.sadev.co.za/content/aspnet-mvc-cheat-sheets" href="http://www.sadev.co.za/content/aspnet-mvc-cheat-sheets"&gt;http://www.sadev.co.za/content/aspnet-mvc-cheat-sheets&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Have fun!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6791050499822412719?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6791050499822412719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/10/aspnet-mvc-2-resources.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6791050499822412719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6791050499822412719'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/10/aspnet-mvc-2-resources.html' title='ASP.NET MVC 2 Resources'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-518427070221382585</id><published>2009-09-23T07:31:00.001+01:00</published><updated>2009-09-23T07:44:08.085+01:00</updated><title type='text'>Unit Testing – A Book you have been waiting for</title><content type='html'>&lt;p&gt;Does your project have low test coverage, unreadable test code, high investments in maintaining unit tests? Do you feel writing unit test being awkward and time consuming, questioning the overall benefit, not trusting some of the unit tests? Ever had discussions about fake/stubs/mocks, what is better Record-Replay or Arrange/Act/Assert (triple A) syntax, where to set up your fakes, differences between unit and integration tests, testing best practices, different tools and test frameworks?&lt;/p&gt;  &lt;p&gt;No? Working as a hair dresser or what? Then you can easily forget about the following …&lt;/p&gt;  &lt;p&gt;I just finished reading Roy Osherove’s (300 pages) book “The Art of Unit Testing” which is an easy but &lt;strong&gt;MUST-READ book&lt;/strong&gt;, I’ve been waiting for a long time now. You do not have to agree with all of his views, but definitively opens up your mind concerning unit testing.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.de/Art-Unit-Testing-Examples-NET/dp/1933988274/ref=sr_1_1?ie=UTF8&amp;amp;s=books-intl-de&amp;amp;qid=1253686572&amp;amp;sr=8-1"&gt;&lt;img src="http://ecx.images-amazon.com/images/I/51zH-XJjRsL._SS500_.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Go an get it. Or if you are a team lead or manager go and get a stack of it. Your investment will pay back soon!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-518427070221382585?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/518427070221382585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/unit-testing-book-you-have-been-waiting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/518427070221382585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/518427070221382585'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/unit-testing-book-you-have-been-waiting.html' title='Unit Testing – A Book you have been waiting for'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8749248759499291212</id><published>2009-09-22T16:32:00.001+01:00</published><updated>2009-09-22T16:32:31.896+01:00</updated><title type='text'>VS MSTEST Test Run Deployment Item Error – DLL not trusted</title><content type='html'>&lt;p&gt;I remember having this error for a couple of times already during the last few years – so I write a post of my own about the solution to the following issue:&lt;/p&gt;  &lt;p&gt;Running Visual Studio 2008 (MSTEST) unit tests fails with:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Failed to queue test run '2009-09-22 17:11:11': Test Run deployment issue: The location of the file or directory 'sqlite3.dll' is not trusted.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SrjuB0XGbSI/AAAAAAAAAys/h46ao-QjGs4/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="157" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/SrjuCmZ-_RI/AAAAAAAAAyw/-ZH_-ME7xQM/image_thumb%5B1%5D.png?imgmax=800" width="346" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There were some hints about using the caspol tool to add full trust to the assembly which DID NOT WORK FOR ME:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;C:\Program Files\Microsoft Visual Studio 9.0\VC&amp;gt;&lt;strong&gt;caspol -m -ag 1.2 -url &lt;/strong&gt;&lt;/font&gt;&lt;a href="file://\\localhost\c$\project\tools\"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;\\localhost\c$\project\tools\&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;* FullTrust       &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Microsoft (R) .NET Framework CasPol 2.0.50727.4016     &lt;br /&gt;Copyright (c) Microsoft Corporation.&amp;#160; All rights reserved. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;The operation you are performing will alter security policy.     &lt;br /&gt;Are you sure you want to perform this operation? (yes/no)      &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;yes       &lt;br /&gt;&lt;/strong&gt;Added union code group with &amp;quot;-url&amp;quot; membership condition to the Machine level.      &lt;br /&gt;Success&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;A better approach was:&lt;/p&gt;  &lt;p&gt;1. Remove the reference to the dll from VS   &lt;br /&gt;2. Shut down VS    &lt;br /&gt;3. Right click the assembly (here the sqlite3.dll) und click the UNBLOCK button.     &lt;br /&gt;4. Restart Visual Studio    &lt;br /&gt;5. Re-add the reference to the file&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SrjuDBrVNgI/AAAAAAAAAy0/wSIPUYbuYhk/s1600-h/image%5B8%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="517" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/SrjuDujTaII/AAAAAAAAAy4/RYSR3YGaL50/image_thumb%5B4%5D.png?imgmax=800" width="388" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; (thanks to &lt;a href="http://stackoverflow.com/questions/201327/mstest-run-fails-because-source-assembly-is-not-trusted"&gt;markrob35&lt;/a&gt;)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8749248759499291212?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8749248759499291212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/vs-mstest-test-run-deployment-item.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8749248759499291212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8749248759499291212'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/vs-mstest-test-run-deployment-item.html' title='VS MSTEST Test Run Deployment Item Error – DLL not trusted'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/SrjuCmZ-_RI/AAAAAAAAAyw/-ZH_-ME7xQM/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7961657973661597760</id><published>2009-09-15T12:44:00.001+01:00</published><updated>2009-09-15T12:44:12.290+01:00</updated><title type='text'>WLW Syntax Highlighting with CopyAsHtml</title><content type='html'>&lt;p&gt;Some of my fellow blogger colleagues at my company hinted using &lt;a href="http://www.codeplex.com/wlwSyntaxHighlighter"&gt;SyntaxHighlighter&lt;/a&gt; to post source code. As I am using &lt;a href="http://copysourceashtml.codeplex.com/"&gt;CopyAsHtml&lt;/a&gt; (Visual Studio plugin) for quite some time now and found out about the HTML view in Windows Live Writer &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/Sq9-AZw7kjI/AAAAAAAAAyk/M2XmOKDSn6U/s1600-h/image%5B8%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="409" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/Sq9-CvbTPTI/AAAAAAAAAyo/TDhWo_jwvMc/image_thumb%5B4%5D.png?imgmax=800" width="443" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I keep sticking to it. Looks much better again:&lt;/p&gt; &lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red163\green21\blue21;}??\fs24 \cf1 private\cf0  \cf1 void\cf0  timer1_Tick(\cf1 object\cf0  sender, \cf4 EventArgs\cf0  e)\par ??\{\par ??    \cf4 Color\cf0  c = \cf4 ColorUnderCursor\cf0 .Get();\par ??    \cf1 this\cf0 .label1.Text = \cf5 "Color under cursor = "\cf0  + c.ToArgb().ToString(\cf5 "x8"\cf0 ) + \cf5 " [hex]"\cf0 ;\par ??    \cf1 this\cf0 .label2.Text = c.ToArgb().ToString() + \cf5 " [int]"\cf0 ;\par ??\}}&lt;br /&gt;--&gt;  &lt;div style="font-size: 12pt; background: white; color: black; font-family: courier new"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&amp;#160;&amp;#160; 21&lt;/span&gt;&amp;#160;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; timer1_Tick(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&amp;#160;&amp;#160; 22&lt;/span&gt; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&amp;#160;&amp;#160; 23&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Color&lt;/span&gt; c = &lt;span style="color: #2b91af"&gt;ColorUnderCursor&lt;/span&gt;.Get();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&amp;#160;&amp;#160; 24&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.label1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Color under cursor = &amp;quot;&lt;/span&gt; + c.ToArgb().ToString(&lt;span style="color: #a31515"&gt;&amp;quot;x8&amp;quot;&lt;/span&gt;) + &lt;span style="color: #a31515"&gt;&amp;quot; [hex]&amp;quot;&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&amp;#160;&amp;#160; 25&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.label2.Text = c.ToArgb().ToString() + &lt;span style="color: #a31515"&gt;&amp;quot; [int]&amp;quot;&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: #2b91af"&gt;&amp;#160;&amp;#160; 26&lt;/span&gt; }&lt;/p&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7961657973661597760?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7961657973661597760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/wlw-syntax-highlighting-with-copyashtml.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7961657973661597760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7961657973661597760'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/wlw-syntax-highlighting-with-copyashtml.html' title='WLW Syntax Highlighting with CopyAsHtml'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/Sq9-CvbTPTI/AAAAAAAAAyo/TDhWo_jwvMc/s72-c/image_thumb%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-2583628656567554834</id><published>2009-09-14T12:46:00.001+01:00</published><updated>2009-09-15T07:31:02.474+01:00</updated><title type='text'>Color under Cursor in C#</title><content type='html'>&lt;p&gt;To easily “steal” some styles and colors from a given web app, I wrote the following little application to find out the color under the mouse pointer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/Sq4tEzXLGCI/AAAAAAAAAyc/SVwdTHA-xRs/s1600-h/image%5B2%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="117" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/Sq4tFNAU2gI/AAAAAAAAAyg/o-s0tH5A2W4/image_thumb.png?imgmax=800" width="192" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And here’s the code for the major parts:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;using System;      &lt;br /&gt;using System.Drawing;       &lt;br /&gt;using System.Runtime.InteropServices; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;namespace ColorUnderPixel      &lt;br /&gt;{       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public class ColorUnderCursor       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [DllImport(&amp;quot;gdi32&amp;quot;)]       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public static extern uint GetPixel(IntPtr hDC, int XPos, int YPos); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [DllImport(&amp;quot;user32.dll&amp;quot;, CharSet = CharSet.Auto)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public static extern bool GetCursorPos(out POINT pt); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [DllImport(&amp;quot;User32.dll&amp;quot;, CharSet = CharSet.Auto)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public static extern IntPtr GetWindowDC(IntPtr hWnd); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// Gets the System.Drawing.Color from under the mouse cursor.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;returns&amp;gt;The color value.&amp;lt;/returns&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public static Color Get()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IntPtr dc = GetWindowDC(IntPtr.Zero); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; POINT p;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; GetCursorPos(out p); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; long color = GetPixel(dc, p.X, p.Y);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return Color.FromArgb((int)color);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; [StructLayout(LayoutKind.Sequential)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public struct POINT       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public int X;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public int Y;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public POINT(int x, int y)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; X = x;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Y = y;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;[Update] Please note that the hex values must be reversed to represent a RGB value like in a CSS &lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;background-color: #3b5998;&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-2583628656567554834?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/2583628656567554834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/color-under-cursor-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2583628656567554834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2583628656567554834'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/color-under-cursor-in-c.html' title='Color under Cursor in C#'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_8SuFzywowiM/Sq4tFNAU2gI/AAAAAAAAAyg/o-s0tH5A2W4/s72-c/image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-2340525888342737186</id><published>2009-09-14T09:32:00.001+01:00</published><updated>2009-09-14T09:32:52.874+01:00</updated><title type='text'>Human Interaction Workflow</title><content type='html'>&lt;p&gt;Windows Workflow Foundation 4.0 does not provide explicit framework classes or tools for workflow human interaction (e.g. waiting for a real actor of a workflow to make a decision how to continue).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Approach&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Therefore we gave the following approach a try:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create a workflow with a SQL persistence extension that represent an order confirmation process &lt;/li&gt;    &lt;li&gt;Send email to actor, including a link to a ASP.NET application, a URL with request argument (the workflow instance id) &lt;/li&gt;    &lt;li&gt;Add a pick activity with two pickbranches, each including a aec.CreateNamedBookmark(&amp;lt;bm&amp;gt;) &lt;/li&gt;    &lt;li&gt;Create an ASP.NET application page to confirm a process, loading the workflow instance and calling ResumeNamedBookmark(&amp;lt;bm&amp;gt;) &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Here a some details.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Bookmarks&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To block the workflow and wait for human interaction we used the concept of “Bookmarks”. A bookmark is a named point in your workflow to unload and later resume. To create a bookmark and unload we created a simple custom activity:&lt;/p&gt;  &lt;p&gt;public class CreateBookmark : NativeActivity   &lt;br /&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public InArgument&amp;lt;string&amp;gt; Bookmark { get; set; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; protected override void Execute(ActivityExecutionContext context)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;context.CreateNamedBookmark(Bookmark.Get(context), new BookmarkCallback(BookmarkCallback));     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; private void BookmarkCallback(ActivityExecutionContext executionContext, Bookmark bookmark, object value)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; executionContext.RemoveAllBookmarks();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sending Email&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;[Credits for this code to Alex]&lt;/p&gt;  &lt;p&gt;Before we can unload our workflow we need to send an URL to the human. The link requests a page that resumes our workflow later on.&lt;/p&gt;  &lt;p&gt;public class SendMailActivity : CodeActivity   &lt;br /&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public InArgument&amp;lt;string&amp;gt; From { get; set; }    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public InArgument&amp;lt;string&amp;gt; To { get; set; }    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public InArgument&amp;lt;string&amp;gt; Subject { get; set; }    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public InArgument&amp;lt;string&amp;gt; Body { get; set; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; protected override void Execute(CodeActivityContext context)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var fromAddress = new MailAddress(From.Get(context));    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var toAddress = new MailAddress(To.Get(context)); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var addresses = new MailAddressCollection();   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; addresses.Add(toAddress); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; using (var message = new MailMessage(fromAddress, toAddress))   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; message.Subject = Subject.Get(context);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; message.Body = Body.Get(context); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var mail = new SmtpClient(&amp;quot;localhost&amp;quot;, 25);     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; mail.Send(message);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Get Workflow Instance Id&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;We did not find a simple way to get the workflow instance identifier in our workflow. To work around this we created another simple activity:&lt;/p&gt;  &lt;p&gt;public class WorkflowIdActivity : CodeActivity&amp;lt;Guid&amp;gt;   &lt;br /&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; protected override void Execute(CodeActivityContext context)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt; Result.Set(context, context.WorkflowInstanceId);     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Pick and Pickbranch&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To summarize: we have a workflow that sends a link to a human, persists and unloads. The question is now (the answer has cost me a &lt;a href="http://www.appenzellerbier.ch/"&gt;beer&lt;/a&gt;) what WF4 construct to use to continue our workflow; resuming on two parallel branches. We used the pick and pickbranch activities and included a CreateBookmark trigger activity:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;lt;p:Pick&amp;gt;     &lt;br /&gt;&amp;#160; &amp;lt;p:PickBranch&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;p:PickBranch.Trigger&amp;gt;      &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;w:CreateBookmark Bookmark=&amp;quot;[‘Accepted’]&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/p:PickBranch.Trigger&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;e:SendMailActivity Body=&amp;quot;[‘Your order has been accepted’]&amp;quot; From=&amp;quot;[‘goodboss@email.com’]&amp;quot; Subject=&amp;quot;[‘Laptop order’]&amp;quot; To=&amp;quot;[‘goodboss@email.com’]&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;/p:PickBranch&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;p:PickBranch&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;p:PickBranch.Trigger&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;w:CreateBookmark Bookmark=&amp;quot;[‘Rejected’]&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/p:PickBranch.Trigger&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;e:SendMailActivity Body=&amp;quot;[‘Your order has been rejected’]&amp;quot; From=&amp;quot;[‘badboss@email.com’]&amp;quot; Subject=&amp;quot;[‘Laptop order’]&amp;quot; To=&amp;quot;[‘badboss@email.com’]&amp;quot; /&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;/p:PickBranch&amp;gt;    &lt;br /&gt;&amp;lt;/p:Pick&amp;gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Web Page&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Last step is to build a simple web page, including a green and a red button. Note how we parsed the URL argument to get the workflow identifier.&lt;/p&gt;  &lt;p&gt;public partial class OrderConfirmationForm : System.Web.UI.Page   &lt;br /&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; static SqlPersistenceProviderFactory persistenceProviderFactory;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; static AutoResetEvent instanceUnloaded = new AutoResetEvent(false);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; private Guid workflowId; &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; protected void Page_Load(object sender, EventArgs e)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt; string id = this.Context.Request.Params[&amp;quot;id&amp;quot;];     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; workflowId = new Guid(id);&lt;/strong&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;strong&gt;&amp;#160; protected void btnAccept_Click(object sender, EventArgs e)     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ResumeWorkflow(&amp;quot;Accepted&amp;quot;);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160; &lt;strong&gt; protected void btnDecline_Click(object sender, EventArgs e)     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ResumeWorkflow(&amp;quot;Rejected&amp;quot;);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; private void ResumeWorkflow(string bookmark)   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SetupPersistence(); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PersistenceProvider persistenceProvider = persistenceProviderFactory.CreateProvider(workflowId);   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; WorkflowInstance instance = WorkflowInstance.Load(new OrderProcessing(), persistenceProvider);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; instance.Extensions.Add(persistenceProvider); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; instance.OnUnloaded = () =&amp;gt; instanceUnloaded.Set(); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;&amp;#160; instance.ResumeBookmark(bookmark, null);     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; instanceUnloaded.WaitOne(); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ClosePersistence();   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; static void SetupPersistence()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; persistenceProviderFactory = new SqlPersistenceProviderFactory(@&amp;quot;Database=Instances;Integrated Security=True&amp;quot;, false, false, TimeSpan.FromSeconds(60));    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; persistenceProviderFactory.Open();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; static void ClosePersistence()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; persistenceProviderFactory.Close();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }    &lt;br /&gt;} &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-2340525888342737186?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/2340525888342737186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/human-interaction-workflow.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2340525888342737186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2340525888342737186'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/human-interaction-workflow.html' title='Human Interaction Workflow'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-3227285374364419648</id><published>2009-09-14T09:06:00.001+01:00</published><updated>2009-09-14T09:06:42.887+01:00</updated><title type='text'>WIF (aka Geneva) Glossary</title><content type='html'>&lt;p&gt;Federated claims-based security as implemented in Microsoft Windows Identity Foundation brings a set of terms that are important to understand. Because I did not find a glossary “out there” I put together a list of terms annotated with a definition (copied from other sources like &lt;a href="http://download.microsoft.com/download/7/d/0/7d0b5166-6a8a-418a-addd-95ee9b046994/GenevaFrameworkWhitepaperForDevelopers.pdf"&gt;K. Brown&lt;/a&gt; or written myself).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://images.google.com/imgres?imgurl=http://www.ivf-infertility.com/images/book.gif&amp;amp;imgrefurl=http://www.ivf-infertility.com/help/glossary/index.php&amp;amp;usg=__jG1QWrvBNMZ-28iJTHiq9FIBprM=&amp;amp;h=361&amp;amp;w=346&amp;amp;sz=8&amp;amp;hl=de&amp;amp;start=13&amp;amp;sig2=kgvFIKkej42ZPVEkd9lCGA&amp;amp;um=1&amp;amp;tbnid=eTPPZcMkh-jzmM:&amp;amp;tbnh=121&amp;amp;tbnw=116&amp;amp;prev=/images%3Fq%3Dglossary%26hl%3Dde%26rls%3Dcom.microsoft:*:IE-SearchBox%26rlz%3D1I7GGIT_de%26um%3D1&amp;amp;ei=BuutSv3dAYvQmgOB0siOBQ"&gt;&lt;img height="121" src="http://t3.gstatic.com/images?q=tbn:eTPPZcMkh-jzmM:http://www.ivf-infertility.com/images/book.gif" width="116" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;[Sorry: partly in German]&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="0" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Term&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Description&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Claim&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;a bit of identity information such as name, email address, age, membership in the Sales role, and so on&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Token&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;A &lt;i&gt;security token &lt;/i&gt;is a serialized set of claims that is digitally signed by the issuing authority&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;STS&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;builds, signs, and issues security tokens according to the interoperable protocols&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;RP&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;an application that relies on claims&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;R-STS&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;the &lt;b&gt;.NET Access Control Service&lt;/b&gt; features a &lt;a href="http://blogs.msdn.com/vbertocci/archive/2007/09/24/the-resource-sts-r-sts-rp-sts-a-sts-the-other-face-of-token-issuing.aspx"&gt;Resource-STS&lt;/a&gt;: that &lt;b&gt;R-STS&lt;/b&gt; can be configured for accepting tokens from specific &lt;b&gt;IP-STSs&lt;/b&gt;, and perform various claim transformation including emitting authorization claims&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;IP-STS&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Identity provider STS, like Live ID/passport, ADFS, Sun Metro, CA SiteMinder, IBM, Oracle &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Issuer&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Issuing authority like Domain Controller, Certificate Authority, Ausweisbüro der Gemeinde/Kanton&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Rule&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Claims transformation rule (input -&amp;gt; output)&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Federate&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;“verbünden”, trust, establish base for SSO&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Claims transformation&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Values of input claims are transferred to output claim values (copied, constants, from claim type to other claim type). Mapping.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Scope&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Container for rules and token settings (like token renewal, etc.).&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Claim type&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;A URN string describing the meaning of a claim. There are standard claim types; you can add your own.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Action claim&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Claim representing an ACS right (e.g. servicebus send/listen/etc.)&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;ClaimsAuthorizationManager&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Modul/Handler used by an RP to implement special authorization. Also possible to do other claims transformation/mapping.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;ACS&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Azure .NET Services component for Identity und Access Control&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;         &lt;p&gt;Service Bus&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="403"&gt;         &lt;p&gt;Transparent, routed WCF web service through the cloud, providing quality of services.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="211"&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="403"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-3227285374364419648?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/3227285374364419648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/wif-aka-geneva-glossary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/3227285374364419648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/3227285374364419648'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/wif-aka-geneva-glossary.html' title='WIF (aka Geneva) Glossary'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-1807240412334899297</id><published>2009-09-09T14:59:00.001+01:00</published><updated>2009-09-09T14:59:04.895+01:00</updated><title type='text'>Code Contracts in Visual Studio 2010</title><content type='html'>&lt;p&gt;Currently still a Microsoft DevLabs Project (planned to be included in 4.0/VS2010) – Code Contracts is a very powerful tool “to sue your code”.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Definitions&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Preconditions: Required state for a method to run successfully. &lt;font face="Courier New"&gt;Contract.Requires();&lt;/font&gt;     &lt;br /&gt;Postconditions: Guarantees condition that will always be true upon completion of a method. &lt;font face="Courier New"&gt;Contract.Ensures(Contract.Result&amp;lt;int&amp;gt;() != 0);      &lt;br /&gt;&lt;font face="verda"&gt;Assertions:&lt;/font&gt; Contract.Assert(); Contract.Assumer();       &lt;br /&gt;&lt;/font&gt;Object Invariants: guarantees about conditions that will always be true for the objects. &lt;font face="Courier New"&gt;[ContractInvariantMethod]protected void ObjectInvariant()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Code Contracts are inherited (seems correct decision according to OO substitution principle), but preconditions cannot be added, postconditions can. Interface contracts can be applied with attributes, passing a class to specifiy contract.&lt;/p&gt;  &lt;p&gt;A basic concept is that your IL code is re-written with CC code (like it or not). Code can be statically checked or at runtime. In Visual Studio there is a new project settings tab “Code Contract”. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/Sqe0pOOQWUI/AAAAAAAAAyU/NIVyuqudelo/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="147" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/Sqe0p_AjzXI/AAAAAAAAAyY/TRlVWOdgSC0/image_thumb%5B1%5D.png?imgmax=800" width="777" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-1807240412334899297?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/1807240412334899297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/code-contracts-in-visual-studio-2010.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1807240412334899297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1807240412334899297'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/code-contracts-in-visual-studio-2010.html' title='Code Contracts in Visual Studio 2010'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_8SuFzywowiM/Sqe0p_AjzXI/AAAAAAAAAyY/TRlVWOdgSC0/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4841332743653749212</id><published>2009-09-09T13:57:00.001+01:00</published><updated>2009-09-09T13:57:43.836+01:00</updated><title type='text'>Unit Test Timeout</title><content type='html'>&lt;p&gt;A nice feature we were just shown is that a mstest [TestMethod] can get a [Timeout(100)] attribute to allow long-running (hanging) tests from blocking your unit test run for too long:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/SqemQeMIT9I/AAAAAAAAAyM/ZbuKyqA_CrM/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="181" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/SqemRkxonXI/AAAAAAAAAyQ/tLDRAFqdTjA/image_thumb%5B1%5D.png?imgmax=800" width="725" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4841332743653749212?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4841332743653749212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/unit-test-timeout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4841332743653749212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4841332743653749212'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/unit-test-timeout.html' title='Unit Test Timeout'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_8SuFzywowiM/SqemRkxonXI/AAAAAAAAAyQ/tLDRAFqdTjA/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6458352321600557604</id><published>2009-09-09T09:14:00.001+01:00</published><updated>2009-09-09T09:14:19.629+01:00</updated><title type='text'>WF 4.0 Persistence</title><content type='html'>&lt;p&gt;Day 3 starts with a recap of what we have done so far with WF4, including the &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Testing practices&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;we did. Important here:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;isolate dependecies (e.g. web service send/receive activities)&lt;/li&gt;    &lt;li&gt;design workflow for testability (like creating testable sub workflows and putting all the untestable plumbing activities into a top-level workflow&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Today we will have a look at the new workflow persistence concepts in WF4.0. There are samples to look at.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Workflow persistence&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;is a must for long-running workflows. An important concept here are &lt;strong&gt;bookmarks&lt;/strong&gt; which are a kind of marker for unloaded/persisted workflow instances that can be resumed. What was formerly known as workflow services are now &lt;strong&gt;extensions&lt;/strong&gt;. A &lt;strong&gt;persistence provider&lt;/strong&gt; creates a provider to persist your instances. There is one provider for SQL Server at the moment as far as we’ve seen.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;static SqlPersistenceProviderFactory persistenceProviderFactory;     &lt;br /&gt;persistenceProviderFactory = new SqlPersistenceProviderFactory(@&amp;quot;Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\SampleInstanceStore.mdf; Integrated Security=True&amp;quot;, false, false, TimeSpan.FromSeconds(60));      &lt;br /&gt;persistenceProviderFactory.Open();      &lt;br /&gt;…      &lt;br /&gt;// start, unload, run      &lt;br /&gt;WorkflowInstance instance = new WorkflowInstance(myWorkflow);      &lt;br /&gt;id = instance.Id;&amp;#160; &lt;br /&gt;instance.Extensions.Add(persistenceProviderFactory.CreateProvider(id));      &lt;br /&gt;instance.OnIdle = () =&amp;gt; IdleAction.Unload;      &lt;br /&gt;instance.OnUnloaded = () =&amp;gt; instanceUnloaded.Set();       &lt;br /&gt;instance.Persist();       &lt;br /&gt;instance.Run();      &lt;br /&gt;…      &lt;br /&gt;// load, resume      &lt;br /&gt;PersistenceProvider persistenceProvider = persistenceProviderFactory.CreateProvider(id);      &lt;br /&gt;WorkflowInstance instance = WorkflowInstance.Load(activity, persistenceProvider);      &lt;br /&gt;instance.Extensions.Add(persistenceProvider);&amp;#160; &lt;br /&gt;instance.OnUnloaded = () =&amp;gt; instanceUnloaded.Set();&amp;#160; &lt;br /&gt;instance.ResumeBookmark(readLineBookmark, input);      &lt;br /&gt;…      &lt;br /&gt;persistenceProviderFactory.Close()&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6458352321600557604?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6458352321600557604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/wf-40-persistence.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6458352321600557604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6458352321600557604'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/wf-40-persistence.html' title='WF 4.0 Persistence'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8285073450555921262</id><published>2009-09-09T07:26:00.001+01:00</published><updated>2009-09-09T07:26:27.701+01:00</updated><title type='text'>Code Generation with T4</title><content type='html'>&lt;p&gt;The text templating engine (tt or t4) is part of the Visual Studio environment for quite a few version now. It can be used to generate static wrapper classes for workflow in and out arguments.&lt;/p&gt;  &lt;p&gt;Static code (text) sections are mixed with dynamic C# code to emit the target file. My 3 minute sample here:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/SqdKimz9JpI/AAAAAAAAAyE/DAiDkbsFqE4/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="372" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/SqdKkhTuKUI/AAAAAAAAAyI/HDIcc3YvcBY/image_thumb%5B1%5D.png?imgmax=800" width="651" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Syntax highlighting comes from &lt;a href="http://t4-editor.tangible-engineering.com/T4-Editor-Visual-T4-Editing.html"&gt;tangible engineering&lt;/a&gt; VS plugin (a free edition exists).&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8285073450555921262?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8285073450555921262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/code-generation-with-t4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8285073450555921262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8285073450555921262'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/code-generation-with-t4.html' title='Code Generation with T4'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_8SuFzywowiM/SqdKkhTuKUI/AAAAAAAAAyI/HDIcc3YvcBY/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8030995901312128932</id><published>2009-09-08T10:54:00.001+01:00</published><updated>2009-09-08T10:54:42.770+01:00</updated><title type='text'>HelloWorld Workflow Exercise</title><content type='html'>&lt;p&gt;The task is creating a workflow that requests for a name (2 to 3 chars long) from the console and prints it, saying hello.&lt;/p&gt;  &lt;p&gt;Creating a new VS2010 workflow Flowchart console application crashes first time, but restarting allows continuing.&lt;/p&gt;  &lt;p&gt;We create a FlowChart workflow with a DoWhile activity, create a ReadlineActivity&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/SqYp0I7kqTI/AAAAAAAAAxs/8oE5HkBHE8Y/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="242" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/SqYp02l_4kI/AAAAAAAAAxw/gqc5wZEtp8Q/image_thumb%5B1%5D.png?imgmax=800" width="782" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/SqYp18M_03I/AAAAAAAAAx0/4a21GEhKQI0/s1600-h/image%5B7%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="351" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/SqYp3W7gqgI/AAAAAAAAAx4/PG8gD7WUPEQ/image_thumb%5B3%5D.png?imgmax=800" width="800" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;assign the result of the code activity (string) to workflow variable (id):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/SqYp3vyTTnI/AAAAAAAAAx8/X5dQryPmW5E/s1600-h/image%5B12%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="229" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/SqYp4Tw928I/AAAAAAAAAyA/rC_D_hV52mM/image_thumb%5B6%5D.png?imgmax=800" width="337" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;press “F9” to add breakpoint in workflow designer and run it with “F5”:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Enter name:     &lt;br /&gt;l      &lt;br /&gt;Enter name:      &lt;br /&gt;leder      &lt;br /&gt;Enter name:      &lt;br /&gt;lem      &lt;br /&gt;Hello lem from WF4.0      &lt;br /&gt;Press any key to continue . . .&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Now, we want to implement best practices and don’t block in an activity, so let’s refactor it to run asynchronous.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;using System;     &lt;br /&gt;using System.Collections.Generic;      &lt;br /&gt;using System.Linq;      &lt;br /&gt;using System.Text;      &lt;br /&gt;using System.Activities;      &lt;br /&gt;using System.Threading.Tasks; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;namespace HelloWorldWorkflow     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// Asynchronous code activity that does the bookmark plumbing code correctly.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;Type of the return value.&amp;lt;/typeparam&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public abstract class AsyncCodeActivity&amp;lt;T&amp;gt; : CodeActivity&amp;lt;T&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// Activity execution method.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;param name=&amp;quot;context&amp;quot;&amp;gt;The code activity context.&amp;lt;/param&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; protected override void Execute(CodeActivityContext context)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var asyncContext = context.SetupAsyncOperationBlock();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var task = new Task((ac) =&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var asyncCtx = (AsyncOperationContext)ac; &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; T ret = InternalExecute(context); &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; asyncCtx.CompleteOperation(new BookmarkCallback(InternalCompleteAsyncWork), ret);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }, asyncContext);        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; task.Start();        &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// Internal activity execution method.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;param name=&amp;quot;context&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; protected abstract T InternalExecute(CodeActivityContext context); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;summary&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// Internal async code activity completion method.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;/summary&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;param name=&amp;quot;ctx&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;param name=&amp;quot;bm&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /// &amp;lt;param name=&amp;quot;ret&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; protected virtual void InternalCompleteAsyncWork(ActivityExecutionContext ctx, Bookmark bm, object ret)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Result.Set(ctx, ret);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;and my ReadlineActivity would look like this:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class ReadlineActivity : &lt;strong&gt;AsyncCodeActivity&amp;lt;string&amp;gt;       &lt;br /&gt;&lt;/strong&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; protected override &lt;strong&gt;string&lt;/strong&gt; InternalExecute(System.Activities.CodeActivityContext context)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.Write(&amp;quot;Enter name: &amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string id = Console.ReadLine();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return id;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Much easier and less error prone!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8030995901312128932?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8030995901312128932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/helloworld-workflow-exercise.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8030995901312128932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8030995901312128932'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/helloworld-workflow-exercise.html' title='HelloWorld Workflow Exercise'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/SqYp02l_4kI/AAAAAAAAAxw/gqc5wZEtp8Q/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4224436412189004777</id><published>2009-09-08T09:08:00.001+01:00</published><updated>2009-09-08T09:08:55.843+01:00</updated><title type='text'>Workflow Foundation 4.0</title><content type='html'>&lt;p&gt;Now getting more technical with Alex, we start learning about the new framework and tools.&lt;/p&gt;  &lt;p&gt;But first we do an excursion to other workflow tools existing: K2 blackpearl, skelta BPM.NET (looks interesting, 100% embeddable, designer), Aspouse.Workflow for .NET, AddFlow for .NET (looks depricated?!), Nintex Workflow 2007 (runs only in SharePoint).&lt;/p&gt;  &lt;p&gt;&lt;img src="http://i.msdn.microsoft.com/dd347832.fig06_L(de-de).gif" /&gt;&lt;/p&gt;  &lt;p&gt;(source: &lt;a href="http://msdn.microsoft.com/de-de/magazine/2009.01.net40.aspx"&gt;msdn.microsoft.com&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What’s new:&lt;/strong&gt; new designer, new runtime, clearer data flow, new activities (no state-chart style yet, but new FlowChart), more activities, XAML only (no XOML), better WCF integration (WorkflowServiceHost, xamlx files for IIS activated workflows, threading based on ThreadPool, Rules and Expressions (as activities, no stand-alone engine yet, no forward-chaining (yet?), no vocabulary support), different programming models (WorkflowElement and WorkflowElement&amp;lt;T&amp;gt; as base type, with return value), bookmarks (set workflow to named idle state: aec.CreateNamedBookmarkus(“bm”, resumeCallback) and workflowInstance.ResumeBookmark(“bm”);), asynchronous operation: aec.SetupAsyncOperationBlock(); t = new Task(…), t.Start(); asyncContext.CompleteOperation(cb). &lt;/p&gt;  &lt;p&gt;Backwards compatiblity: WF3 runs under .NET 4.0 (WF3.0), old activities incompatible with WF4.&lt;/p&gt;  &lt;p&gt;Now let’s go hands-on.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4224436412189004777?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4224436412189004777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/workflow-foundation-40.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4224436412189004777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4224436412189004777'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/workflow-foundation-40.html' title='Workflow Foundation 4.0'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7456172481769372700</id><published>2009-09-08T08:11:00.001+01:00</published><updated>2009-09-08T08:11:06.525+01:00</updated><title type='text'>Business Modeling</title><content type='html'>&lt;p&gt;Day 2 is starting at 8 am with a very short introduction from Manuel into the modeling of business process. This should give all the foundations to dig into Windows Workflow Foundation 4.0 later today.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;“BM is the creation of a model of an abstract but real business”&lt;/strong&gt;. Like our software models, business models only represent a certain view onto a business. There is no just 1 correct model. “Modellieren = Hervorheben + Weglassen”. Models for an IT architect are typically much more detailed than for the business.&lt;/p&gt;  &lt;p&gt;Types of diagrams: Business Use Case (BUCD), Activity, Business Analysis (BAM).&lt;/p&gt;  &lt;p&gt;Process: Model –&amp;gt; Document –&amp;gt; Verify (iterate). BM Hamburger: Strategy –&amp;gt; Operations –&amp;gt; IT (business goals) and backwards (verification).&lt;/p&gt;  &lt;p&gt;A business process: &lt;strong&gt;has a goal, input, output, needs resources, has impact&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Model diagram: shows business actors and business workers, swim lanes, activities, sequences, parallelism/joins, decision nodes, start and end node(s)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;BPMN example&lt;/strong&gt; (one possible notation; quite complex and very detailed; not suitable for business people, this is a model diagram for IT specialists):&lt;/p&gt;  &lt;p&gt;&lt;img height="679" src="http://www.ebpml.org/blog/img43.jpg" width="1162" /&gt;&lt;/p&gt;  &lt;p&gt;(source: &lt;a href="http://www.ebpml.org/blog/30.htm"&gt;ebmpl.org&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;BPEL example: very exact; executable model&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7456172481769372700?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7456172481769372700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/business-modeling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7456172481769372700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7456172481769372700'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/business-modeling.html' title='Business Modeling'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7606970867987446954</id><published>2009-09-07T16:38:00.000+01:00</published><updated>2009-09-07T16:39:00.137+01:00</updated><title type='text'>.NET ServiceBus Exceptions</title><content type='html'>&lt;p&gt;I would like to collect some common exceptions from the service bus here in this post.&lt;/p&gt;  &lt;p&gt;Wrong solution name:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Unhandled Exception: System.ServiceModel.EndpointNotFoundException: No DNS entri      &lt;br /&gt;es exist for host &lt;strong&gt;mlede&lt;/strong&gt;.servicebus.windows.net. ---&amp;gt; System.Net.Sockets.SocketEx       &lt;br /&gt;ception: No such host is known       &lt;br /&gt;&amp;#160;&amp;#160; at System.Net.Dns.GetAddrInfo(String name)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Wrong password:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Unhandled Exception: System.ServiceModel.FaultException: authN failed: 'mleder'      &lt;br /&gt;of PasswordCredential (#&amp;lt;aGuid&amp;gt;)       &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(Tim       &lt;br /&gt;eSpan timeout)       &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Security.IssuanceTokenProviderBase`1.GetTokenCore(Time       &lt;br /&gt;Span timeout)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Timeout (happens quite often as the CTP cloud hosting infrastructure seems to be quite light weight):&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Unhandled Exception: System.TimeoutException: The open operation did not complet      &lt;br /&gt;e within the allotted timeout of 00:01:00. The time allotted to this operation m       &lt;br /&gt;ay have been a portion of a longer timeout. ---&amp;gt; System.TimeoutException: The so       &lt;br /&gt;cket transfer timed out after 00:00:59.9098704. You have exceeded the timeout se       &lt;br /&gt;t on your binding. The time allotted to this operation may have been a portion o       &lt;br /&gt;f a longer timeout. ---&amp;gt; System.Net.Sockets.SocketException: A connection attemp       &lt;br /&gt;t failed because the connected party did not properly respond after a period of       &lt;br /&gt;time, or established connection failed because connected host has failed to resp       &lt;br /&gt;ond       &lt;br /&gt;&amp;#160;&amp;#160; at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size,       &lt;br /&gt;SocketFlags socketFlags)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Problem with added ConnectionStatusBehavior:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;“ConnectionStatusBehavior requires an IChannelListener that exposes IConnectionStatus”&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Trying to emit service meta data:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;System.ServiceModel.EndpointNotFoundException was unhandled      &lt;br /&gt;&amp;#160; Message=&amp;quot;Could not connect to &lt;/font&gt;&lt;a href="http://servicebus.accesscontrol.windows.net/sts/username_for_certificate"&gt;&lt;font face="Courier New"&gt;http://servicebus.accesscontrol.windows.net/sts/username_for_certificate&lt;/font&gt;&lt;/a&gt;&lt;font face="Courier New"&gt;. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 65.55.54.15:80. &amp;quot;      &lt;br /&gt;&amp;#160; Source=&amp;quot;System.ServiceModel&amp;quot;       &lt;br /&gt;&amp;#160; StackTrace:       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Server stack trace:       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)       &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Cloud not reachable at the moment:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;System.ServiceModel.CommunicationException was unhandled      &lt;br /&gt;&amp;#160; Message=&amp;quot;Unable to reach servicebus.windows.net via TCP (818, 828) or HTTP (80, 443)&amp;quot;       &lt;br /&gt;&amp;#160; Source=&amp;quot;Microsoft.ServiceBus&amp;quot;       &lt;br /&gt;&amp;#160; StackTrace:       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; at Microsoft.ServiceBus.NetworkDetector.ChooseConnectivityModeForAutoDetect(Uri uri)&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7606970867987446954?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7606970867987446954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/net-servicebus-exceptions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7606970867987446954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7606970867987446954'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/net-servicebus-exceptions.html' title='.NET ServiceBus Exceptions'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6325538060587137596</id><published>2009-09-07T16:07:00.001+01:00</published><updated>2009-09-07T16:07:35.938+01:00</updated><title type='text'>Service Bus Meta Data</title><content type='html'>&lt;p&gt;The question came up how to emit WCF service meta data for possible clients. According to &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/netservices/thread/57f117df-c1bf-405d-ad6b-2ce62a34ad2a/"&gt;hhaaii&lt;/a&gt; this is not possible with wsHttRelayBinding but only with netTcpRelayBinding. netTcp did not work with svcutil so I tried the following:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;     &lt;br /&gt;&amp;lt;configuration&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;system.serviceModel&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;behaviors&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;endpointBehaviors&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;behavior name=&amp;quot;EndpointBehavior&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;transportClientEndpointBehavior credentialType=&amp;quot;UserNamePassword&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;clientCredentials&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;userNamePassword userName=&amp;quot;&amp;lt;solution&amp;gt;&amp;quot; password=&amp;quot;&amp;lt;password&amp;gt;&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/clientCredentials&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/transportClientEndpointBehavior&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/behavior&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/endpointBehaviors&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;serviceBehaviors&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;behavior name=&amp;quot;ServiceBehavior&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt; &amp;lt;serviceMetadata httpGetEnabled=&amp;quot;true&amp;quot; httpGetUrl=&amp;quot;meta&amp;quot; /&amp;gt;&lt;/strong&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/behavior&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/serviceBehaviors&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/behaviors&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;services&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;service behaviorConfiguration=&amp;quot;ServiceBehavior&amp;quot; name=&amp;quot;Microsoft.ServiceBus.Samples.EchoService&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;endpoint behaviorConfiguration=&amp;quot;EndpointBehavior&amp;quot; binding=&amp;quot;wsHttpRelayBinding&amp;quot;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; contract=&amp;quot;Microsoft.ServiceBus.Samples.IEchoContract&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;&amp;lt;endpoint address=&amp;quot;mex&amp;quot; binding=&amp;quot;wsHttpRelayBinding&amp;quot; bindingConfiguration=&amp;quot;&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; name=&amp;quot;MexEndpoint&amp;quot; contract=&amp;quot;IMetadataExchange&amp;quot; /&amp;gt;        &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/service&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/services&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;/system.serviceModel&amp;gt;      &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The service started. Going to the service bus registry, clicking the service asked for my credentials &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/SqUhqbX4kLI/AAAAAAAAAxc/DSHAZMKXAOc/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="244" alt="image" src="http://lh6.ggpht.com/_8SuFzywowiM/SqUhrMSwSwI/AAAAAAAAAxg/fbEe6NPve4Y/image_thumb%5B1%5D.png?imgmax=800" width="561" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;but then a Fault was generated:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/SqUhr6lUxyI/AAAAAAAAAxk/r4h46t6YQak/s1600-h/image%5B9%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="310" alt="image" src="http://lh3.ggpht.com/_8SuFzywowiM/SqUhtrrP2aI/AAAAAAAAAxo/VvoVRlFiKbo/image_thumb%5B5%5D.png?imgmax=800" width="1106" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Giving up, sorry.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6325538060587137596?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6325538060587137596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/service-bus-meta-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6325538060587137596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6325538060587137596'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/service-bus-meta-data.html' title='Service Bus Meta Data'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_8SuFzywowiM/SqUhrMSwSwI/AAAAAAAAAxg/fbEe6NPve4Y/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6337846226782786337</id><published>2009-09-07T14:49:00.001+01:00</published><updated>2009-10-16T13:02:12.988+01:00</updated><title type='text'>Service Bus Registry: public discovery</title><content type='html'>&lt;p&gt;One of the components in a SOA environment is the so-called service registry. A registry lists running services. In .NET Services there is a ATOM feed that shows your current publicly listed services:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_8SuFzywowiM/SqUPXp-SV7I/AAAAAAAAAxM/rxZhxDhL_yM/s1600-h/image3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_8SuFzywowiM/SqUPYjOogfI/AAAAAAAAAxQ/FG_hHLAhbh4/image_thumb1.png?imgmax=800" width="454" height="336" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The echoservice is only listed when a ServiceRegistrySettings behavior is added to the service endpoint:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;IEndpointBehavior serviceRegistrySettings = new &lt;strong&gt;ServiceRegistrySettings&lt;/strong&gt;(&lt;strong&gt;DiscoveryType.Public&lt;/strong&gt;);       &lt;br /&gt;endpoint.Behaviors.Add(serviceRegistrySettings);&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Otherwise it is not publicly visible!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_8SuFzywowiM/SqUPZuPkUYI/AAAAAAAAAxU/Mp0yQQPjHDc/s1600-h/image5.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/SqUPahh5UpI/AAAAAAAAAxY/Kyww6PvB7W0/image_thumb2.png?imgmax=800" width="464" height="346" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Unfortunately I could not add this registry behavior using app.config configuration. The WCF config editor tool does not even reflect on the behavior in the Microsoft.ServiceBus.dll. I’m not sure if I’m doing something wrong or this is not possible yet with July CTP.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6337846226782786337?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6337846226782786337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/service-bus-registry-public-discovery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6337846226782786337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6337846226782786337'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/service-bus-registry-public-discovery.html' title='Service Bus Registry: public discovery'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_8SuFzywowiM/SqUPYjOogfI/AAAAAAAAAxQ/FG_hHLAhbh4/s72-c/image_thumb1.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-2577110944726555874</id><published>2009-09-07T11:15:00.001+01:00</published><updated>2009-09-07T13:02:09.149+01:00</updated><title type='text'>Microsoft Azure .NET Services</title><content type='html'>&lt;p&gt;The upcoming series of posts are dedicated to “Herr Hannes”.    &lt;br /&gt;Starting today with the Microsoft Azure platform is Mario, 7.9.09.&lt;/p&gt;  &lt;p&gt;The main drivers to go into the Cloud are: Operation, Maintenance, Quality-of-Services, Security.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/SqTdS7U95bI/AAAAAAAAAw8/1PqZED7K1g4/s1600-h/clip_image001%5B6%5D.gif"&gt;&lt;img title="clip_image001" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="228" alt="clip_image001" src="http://lh3.ggpht.com/_8SuFzywowiM/SqTdTdeZtaI/AAAAAAAAAxE/K6h_-yHM3HI/clip_image001_thumb%5B3%5D.gif?imgmax=800" width="538" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Windows Azure Platform (source blogs.msdn.com)&lt;/p&gt;  &lt;h4&gt;Introduction&lt;/h4&gt;  &lt;h5&gt;Azure&lt;/h5&gt;  &lt;ul&gt;   &lt;li&gt;Microsoft Windows Azure (Platform; compute/store/manage; open for 3rd party hosters)      &lt;br /&gt;vs. Azure Services (Live Services, .NET Services, SQL Services, SharePoint Services, Dynamics CRM Services and more)&lt;/li&gt;    &lt;li&gt;for application and service hosting (in the cloud)&lt;/li&gt;    &lt;li&gt;Pricing &amp;amp; Licensing (2000 VM hours compute, 50 GB storage, 20 GB network throughput / day), then     &lt;br /&gt;compute 0.12$/hour, storage = 0.15$, SQL Azure 1 GB 10$/month or 100$/month,      &lt;br /&gt;.NET Services 0.15$/100k messages, 0.10$ bandwidth/GB&lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;.NET Services&lt;/h5&gt;  &lt;ul&gt;   &lt;li&gt;for .NET, Java, Ruby; REST, SOAP, RSS, ATOM. Focus on application integration and access control     &lt;br /&gt;Quality of Services, flexible scale out&lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;Service Bus&lt;/h5&gt;  &lt;ul&gt;   &lt;li&gt;Patterns: Service Registry, Connectivity (relay or direct), pub/sub     &lt;br /&gt;&amp;quot;abge-space-ter ESB&amp;quot;, NAT/firewall traversal, HTTP and TCP (using ports 808, 818, 819, 828)      &lt;br /&gt;Addressing: &lt;em&gt;[http|sb]://solution.servicebus.windows.net/project/serviceXy&lt;/em&gt; , new schema prefix &amp;quot;sb&amp;quot; for TCP      &lt;br /&gt;&amp;#160; One-way connection relays, &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img src="http://i.msdn.microsoft.com/dd569759.fig06(en-us).gif" /&gt;&lt;/p&gt;  &lt;p&gt;Service Connectivity (source: msdn.microsoft.com)&lt;/p&gt;  &lt;p&gt;Azure is building on existing assets such as WCF. WCF is enhanced in two areas: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;bindings (see below) and &lt;/li&gt;    &lt;li&gt;behaviors&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;WCF Bindings and new service bus &lt;em&gt;Relay&lt;/em&gt; bindings:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;BasicHttpBinding (&lt;b&gt;BasicHttpRelayBinding)     &lt;br /&gt;&lt;/b&gt;WebHttpBinding (&lt;b&gt;&lt;b&gt;WebHttpRelayBinding)       &lt;br /&gt;&lt;/b&gt;&lt;/b&gt;WSHttpBinding (&lt;b&gt;WSHttpRelayBinding)     &lt;br /&gt;&lt;/b&gt;WS2007HttpBinding (&lt;b&gt;WS2007HttpRelayBinding)     &lt;br /&gt;&lt;/b&gt;WSHttpContextBinding (&lt;b&gt;WSHttpRelayContextBinding)     &lt;br /&gt;&lt;/b&gt;WS2007HttpFederationBinding (&lt;b&gt;WS2007HttpRelayFederationBinding)     &lt;br /&gt;&lt;/b&gt;NetTcpBinding (&lt;b&gt;NetTcpRelayBinding)     &lt;br /&gt;&lt;/b&gt;NetTcpContextBinding (&lt;b&gt;NetTcpRelayContextBinding)     &lt;br /&gt;&lt;/b&gt;n/a&amp;#160; (&lt;b&gt;NetOnewayRelayBinding)     &lt;br /&gt;&lt;/b&gt;n/a&amp;#160; (&lt;b&gt;NetEventRelayBinding)&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.microsoft.com/DownLoads/details.aspx?familyid=38D8CF79-FC39-4AEF-B3FD-EF280F2E9FA6&amp;amp;displaylang=en"&gt;Microsoft .NET Services SDK&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.microsoft.com/downloadS/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&amp;amp;displaylang=en"&gt;Windows Azure Platfrom Kit&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So let’s do some hands-on. There’s a sample called EchoService in the SDK.&lt;/p&gt;  &lt;p&gt;As always with WCF you create a contract:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;[ServiceContract(Name = &amp;quot;IEchoContract&amp;quot;, Namespace = &amp;quot;&lt;/font&gt;&lt;a href="http://samples.microsoft.com/ServiceModel/Relay/&amp;quot;)]"&gt;&lt;font face="Courier New"&gt;http://samples.microsoft.com/ServiceModel/Relay/&amp;quot;)]&lt;/font&gt;&lt;/a&gt;    &lt;br /&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;public interface IEchoContract       &lt;br /&gt;&lt;/strong&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [OperationContract]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; string Echo(string text);      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;implement the contract:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;[ServiceBehavior(Name = &amp;quot;EchoService&amp;quot;, Namespace = &amp;quot;&lt;/font&gt;&lt;a href="http://samples.microsoft.com/ServiceModel/Relay/&amp;quot;)]"&gt;&lt;font face="Courier New"&gt;http://samples.microsoft.com/ServiceModel/Relay/&amp;quot;)]&lt;/font&gt;&lt;/a&gt;    &lt;br /&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;class EchoService : IEchoContract       &lt;br /&gt;&lt;/strong&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public string Echo(string text)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;Echoing: {0}&amp;quot;, text);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return text;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Configure the self-hosting console application in app.config:&lt;/p&gt;  &lt;p&gt;&lt;font face="courier ne"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;     &lt;br /&gt;&amp;lt;configuration&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;system.serviceModel&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;services&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!-- Application Service --&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="courier ne"&gt;&lt;strong&gt;&amp;lt;service name=&amp;quot;Microsoft.ServiceBus.Samples.EchoService&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;endpoint contract=&amp;quot;Microsoft.ServiceBus.Samples.IEchoContract&amp;quot;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; binding=&amp;quot;netTcpRelayBinding&amp;quot; /&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/service&amp;gt;        &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/services&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;/system.serviceModel&amp;gt;      &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Do the self-hosting:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// Determine the system connectivity mode based on the command line     &lt;br /&gt;// arguments: -http, -tcp or -auto&amp;#160; (defaults to auto)      &lt;br /&gt;ServiceBusEnvironment.SystemConnectivity.Mode = GetConnectivityMode(args); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Console.Write(&amp;quot;Your Solution Name: &amp;quot;);     &lt;br /&gt;string solutionName = Console.ReadLine();      &lt;br /&gt;Console.Write(&amp;quot;Your Solution Password: &amp;quot;);      &lt;br /&gt;string solutionPassword = ReadPassword(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the endpoint address in the solution's namespace     &lt;br /&gt;&lt;strong&gt;Uri address = ServiceBusEnvironment.CreateServiceUri(&amp;quot;sb&amp;quot;, solutionName, &amp;quot;EchoService&amp;quot;);&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the credentials object for the endpoint     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;TransportClientEndpointBehavior userNamePasswordServiceBusCredential = new TransportClientEndpointBehavior();       &lt;br /&gt;&lt;/strong&gt;userNamePasswordServiceBusCredential.CredentialType = TransportClientCredentialType.UserNamePassword;      &lt;br /&gt;userNamePasswordServiceBusCredential.Credentials.UserName.UserName = solutionName;      &lt;br /&gt;userNamePasswordServiceBusCredential.Credentials.UserName.Password = solutionPassword; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the service host reading the configuration     &lt;br /&gt;ServiceHost host = new ServiceHost(typeof(EchoService), address); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the ServiceRegistrySettings behavior for the endpoint     &lt;br /&gt;&lt;strong&gt;IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public); &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// add the Service Bus credentials to all endpoints specified in configuration     &lt;br /&gt;foreach (ServiceEndpoint endpoint in host.Description.Endpoints)      &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; endpoint.Behaviors.Add(serviceRegistrySettings);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;endpoint.Behaviors.Add(userNamePasswordServiceBusCredential);&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// open the service     &lt;br /&gt;host.Open(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Console.WriteLine(&amp;quot;Service address: &amp;quot; + address);     &lt;br /&gt;Console.WriteLine(&amp;quot;Press [Enter] to exit&amp;quot;);      &lt;br /&gt;Console.ReadLine(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// close the service     &lt;br /&gt;host.Close();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;On the client side we are doing a similar thing using the ChannelFactory:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the service URI based on the solution name     &lt;br /&gt;&lt;strong&gt;Uri serviceUri = ServiceBusEnvironment.CreateServiceUri(&amp;quot;sb&amp;quot;, solutionName, &amp;quot;EchoService&amp;quot;);&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the credentials object for the endpoint     &lt;br /&gt;&lt;strong&gt;TransportClientEndpointBehavior userNamePasswordServiceBusCredential = new TransportClientEndpointBehavior();       &lt;br /&gt;&lt;/strong&gt;userNamePasswordServiceBusCredential.CredentialType = TransportClientCredentialType.UserNamePassword;      &lt;br /&gt;userNamePasswordServiceBusCredential.Credentials.UserName.UserName = solutionName;      &lt;br /&gt;userNamePasswordServiceBusCredential.Credentials.UserName.Password = solutionPassword; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create the channel factory loading the configuration     &lt;br /&gt;&lt;strong&gt;ChannelFactory&amp;lt;IEchoChannel&amp;gt; channelFactory = new ChannelFactory&amp;lt;IEchoChannel&amp;gt;(&amp;quot;RelayEndpoint&amp;quot;, new EndpointAddress(serviceUri));&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// apply the Service Bus credentials     &lt;br /&gt;&lt;strong&gt;channelFactory.Endpoint.Behaviors.Add(userNamePasswordServiceBusCredential);&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;// create and open the client channel     &lt;br /&gt;&lt;strong&gt;IEchoChannel channel = channelFactory.CreateChannel();&lt;/strong&gt;      &lt;br /&gt;channel.Open();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;So what was added to WCF for Azure:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;the binding (NetTcpRelayBinding)&lt;/li&gt;    &lt;li&gt;a cloud rendez-vouz address (“sb://mleder.servicebus.windows.net/EchoService”)&lt;/li&gt;    &lt;li&gt;a behavior (TransportClientEndpointBehavior) to pass Azure solution credentials&lt;/li&gt;    &lt;li&gt;a behavior for the registry (ServiceRegistrySettings)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Behaviors and credentials above can also be done using config files and the Microsoft Service Configuration Editor tool:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_8SuFzywowiM/SqTdUtqkCQI/AAAAAAAAAwk/60JEpmtpDrU/s1600-h/image%5B4%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="397" alt="image" src="http://lh5.ggpht.com/_8SuFzywowiM/SqTdV8wpuGI/AAAAAAAAAwo/OpSijVOeoNU/image_thumb%5B2%5D.png?imgmax=800" width="541" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;However, the new TransportClientEndpointBehavior has only one property (CrendentialType) that can be edited. Not very useful; hope this will be improved until release.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-2577110944726555874?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/2577110944726555874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/microsoft-azure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2577110944726555874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/2577110944726555874'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/microsoft-azure.html' title='Microsoft Azure .NET Services'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_8SuFzywowiM/SqTdTdeZtaI/AAAAAAAAAxE/K6h_-yHM3HI/s72-c/clip_image001_thumb%5B3%5D.gif?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-1108586224819389005</id><published>2009-09-03T07:49:00.001+01:00</published><updated>2009-09-03T07:49:30.623+01:00</updated><title type='text'>Blogging with Windows Live Writer</title><content type='html'>&lt;p&gt;Not using one of Scot Hanselman’s &lt;a href="http://feedproxy.google.com/~r/ScottHanselman/~3/yR1QNm19v-I/ScottHanselmans2009UltimateDeveloperAndPowerUsersToolListForWindows.aspx"&gt;The Big Ten Life and Work-Changing Utilities&lt;/a&gt; is rather provoking. So I decided to give Live Writer a try for blogging (which is infrequent I admit; because time or projects not permitting).&lt;/p&gt;  &lt;p&gt;It’s free, it’s WYSIWYG, can insert (well) text, &lt;/p&gt;  &lt;p&gt;pictures &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_8SuFzywowiM/Sp9m9hfjzNI/AAAAAAAAAwQ/rpgRL0Aymsg/s1600-h/DSCF1774%5B2%5D.jpg"&gt;&lt;img title="DSCF1774" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="DSCF1774" src="http://lh5.ggpht.com/_8SuFzywowiM/Sp9m-DcFXSI/AAAAAAAAAwU/rEjAk4ChWxU/DSCF1774_thumb.jpg?imgmax=800" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;maps&lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterEditableSmartContent" id="scid:84E294D0-71C9-4bd0-A0FE-95764E0368D9:e37d86fb-2532-476c-946b-22e01fda7f1e" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://www.bing.com/maps/default.aspx?v=2&amp;amp;cp=47.37941~8.075123&amp;amp;lvl=13&amp;amp;style=r&amp;amp;sp=aN.47.37964_8.077698_my.home_&amp;amp;mkt=en-us&amp;amp;FORM=LLWR" id="map-614490d3-ac24-4600-8cb4-f215b42d2da7" alt="View map" title="View map"&gt;&lt;img src="http://lh5.ggpht.com/_8SuFzywowiM/Sp9m-awsIAI/AAAAAAAAAwY/8fT5RxOTYJI/map-af63ea270716.jpg?imgmax=800" width="320" height="240" alt="Map picture"&gt;&lt;/a&gt;&lt;/div&gt; &lt;/p&gt;  &lt;p&gt;columns&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="400" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="200"&gt;Tool&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Impression&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;Live Writer&lt;/td&gt;        &lt;td valign="top" width="200"&gt;nice and slim&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;tags&lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e58295b5-1f13-4dfb-b4b9-75c2b7328af0" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/my.net" rel="tag"&gt;my.net&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET" rel="tag"&gt;.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Microsoft" rel="tag"&gt;Microsoft&lt;/a&gt;,&lt;a href="http://technorati.com/tags/C%23" rel="tag"&gt;C#&lt;/a&gt;&lt;/div&gt; &lt;/p&gt;  &lt;p&gt;spellcheck, etc. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-1108586224819389005?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/1108586224819389005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/09/blogging-with-windows-live-writer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1108586224819389005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/1108586224819389005'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/09/blogging-with-windows-live-writer.html' title='Blogging with Windows Live Writer'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_8SuFzywowiM/Sp9m-DcFXSI/AAAAAAAAAwU/rEjAk4ChWxU/s72-c/DSCF1774_thumb.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4697623661083833697</id><published>2009-08-25T07:26:00.002+01:00</published><updated>2009-08-25T07:38:38.351+01:00</updated><title type='text'>Finally: new WCF 4 Configuration</title><content type='html'>According to &lt;a href="http://blogs.msdn.com/drnick/archive/2009/08/24/what-s-new-in-wcf-4-more-on-services-and-configuration.aspx"&gt;Dr. Nick &lt;/a&gt;some long awaited improvements concerning WCF configuration come with .NET 4.0:&lt;br /&gt;&lt;br /&gt;- short type names for configuration extensions : have you ever used strong naming and assembly versioning in your project (sure you have)? have you ever implemented a WCF extension (maybe you have)? did you ever have to always change your config files with every new project (assembly) version, because you had to use the assembly qualified type name - including version and token - in the WCF configuration (I did)?! Therefore you probably also added your extension in code only. That's why I love this new one.&lt;br /&gt;&lt;br /&gt;- Channel factories with custom configuration: up to now you had two options for your WCF configuration (1. config file 2. create proxy the hard way in code). Now there's a third one (3. write your own serializable/persistable config OBJECT and pass it to channel factory).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4697623661083833697?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4697623661083833697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/08/finally-new-wcf-4-configuration.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4697623661083833697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4697623661083833697'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/08/finally-new-wcf-4-configuration.html' title='Finally: new WCF 4 Configuration'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8373971430859069209</id><published>2009-07-02T12:53:00.002+01:00</published><updated>2009-07-02T12:57:49.621+01:00</updated><title type='text'>p&amp;p Acceptance Test Engineering Guide</title><content type='html'>Patterns &amp; Practices J.D. Meier and his team just released a beta of a 209 pages paper about Acceptance testing ("...acceptance testing is the planned evaluation of a system by customers and customer proxies to assess to what degree it satisfies their expectations"). Very important topic.&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://blogs.msdn.com/jmeier/archive/2009/06/30/acceptance-test-engineering-guide-beta-2-now-available.aspx"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8373971430859069209?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8373971430859069209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/07/p-acceptance-test-engineering-guide.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8373971430859069209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8373971430859069209'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/07/p-acceptance-test-engineering-guide.html' title='p&amp;p Acceptance Test Engineering Guide'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7090731584643190007</id><published>2009-07-01T15:53:00.004+01:00</published><updated>2009-07-01T16:02:48.565+01:00</updated><title type='text'>Windows Mobile 6 with C# (compass control)</title><content type='html'>Actually the textual representation did not look to great. So I decided to look for a free .NET mobile compass control - which I did not find. &lt;br /&gt;&lt;br /&gt;Let's hack some dirty user control drawing code:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red128\green128\blue128;\red255\green255\blue255;\red0\green128\blue0;\red0\green0\blue255;\red0\green0\blue0;\red43\green145\blue175;\red163\green21\blue21;}??\fs20 \cf1 ///\cf3  \cf1 &amp;lt;summary&amp;gt;\par ??///\cf3  Paints the control.\par ??\cf1 ///\cf3  \cf1 &amp;lt;/summary&amp;gt;\par ??///\cf3  \cf1 &amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;\par ??\cf4 protected\cf0  \cf4 override\cf0  \cf4 void\cf0  OnPaintBackground(\cf6 PaintEventArgs\cf0  e)\par ??\{\par ??    \cf4 base\cf0 .OnPaintBackground(e);\par ??\par ??    \cf4 int\cf0  penWidth = 5;\par ??    \cf4 using\cf0  (\cf6 Graphics\cf0  g = \cf4 this\cf0 .CreateGraphics())\par ??    \cf4 using\cf0  (\cf6 Pen\cf0  penBlackThin = \cf4 new\cf0  \cf6 Pen\cf0 (\cf6 Color\cf0 .Black, penWidth - 3))\par ??    \cf4 using\cf0  (\cf6 Pen\cf0  penBlack = \cf4 new\cf0  \cf6 Pen\cf0 (\cf6 Color\cf0 .Black, penWidth))\par ??    \cf4 using\cf0  (\cf6 Pen\cf0  penDarkGray = \cf4 new\cf0  \cf6 Pen\cf0 (\cf6 Color\cf0 .DarkGray, penWidth))\par ??    \cf4 using\cf0  (\cf6 Pen\cf0  penRed = \cf4 new\cf0  \cf6 Pen\cf0 (\cf6 Color\cf0 .Red, penWidth + 3))\par ??    \cf4 using\cf0  (\cf6 Pen\cf0  penWhite = \cf4 new\cf0  \cf6 Pen\cf0 (\cf6 Color\cf0 .WhiteSmoke, penWidth + 3))\par ??    \cf4 using\cf0  (\cf6 Brush\cf0  brushDarkGray = \cf4 new\cf0  \cf6 SolidBrush\cf0 (\cf6 Color\cf0 .DarkGray))\par ??    \cf4 using\cf0  (\cf6 Brush\cf0  brushWhite = \cf4 new\cf0  \cf6 SolidBrush\cf0 (\cf6 Color\cf0 .White))\par ??    \cf4 using\cf0  (\cf6 Brush\cf0  brushLightGray = \cf4 new\cf0  \cf6 SolidBrush\cf0 (\cf6 Color\cf0 .LightGray))\par ??    \cf4 using\cf0  (\cf6 Brush\cf0  brushRed = \cf4 new\cf0  \cf6 SolidBrush\cf0 (\cf6 Color\cf0 .Red))\par ??    \{\par ??        \cf4 double\cf0  radius = (\cf4 this\cf0 .ClientRectangle.Width - 50) / 2;\par ??        \cf4 double\cf0  radiusInner = (\cf4 this\cf0 .ClientRectangle.Width - 70) / 2;\par ??        \cf4 int\cf0  xcenter = \cf4 this\cf0 .ClientRectangle.Width / 2;\par ??        \cf4 int\cf0  ycenter = \cf4 this\cf0 .ClientRectangle.Height / 2;\par ??        \cf4 float\cf0  halfFont = \cf4 this\cf0 .Font.Size / 2;\par ??\par ??        \cf3 // g.Clear(this.BackColor);\par ??\par ??\cf0         \cf3 // draw circles\par ??\cf0         g.FillEllipse(brushLightGray, penWidth, penWidth, \cf4 this\cf0 .ClientRectangle.Width - 2 * penWidth, \cf4 this\cf0 .ClientRectangle.Height - 2 * penWidth);\par ??        g.DrawEllipse(penDarkGray, penWidth, penWidth, \cf4 this\cf0 .ClientRectangle.Width - 2 * penWidth, \cf4 this\cf0 .ClientRectangle.Height - 2 * penWidth);\par ??        g.DrawEllipse(penBlack, 2 * penWidth, 2 * penWidth, \cf4 this\cf0 .ClientRectangle.Width - 4 * penWidth, \cf4 this\cf0 .ClientRectangle.Height - 4 * penWidth);\par ??\par ??        \cf3 // draw separator lines\par ??\cf0         \cf4 for\cf0  (\cf4 int\cf0  l = 0; l &amp;lt; 16; l++)\par ??        \{\par ??            \cf4 double\cf0  angle = l * 22.5 + \cf4 this\cf0 .Heading;\par ??            \cf4 double\cf0  xout = \cf6 Math\cf0 .Sin(\cf4 this\cf0 .ToRadian(angle)) * radiusInner;\par ??            \cf4 double\cf0  yout = \cf6 Math\cf0 .Cos(\cf4 this\cf0 .ToRadian(angle)) * radiusInner;\par ??            \cf4 double\cf0  xin = \cf6 Math\cf0 .Sin(\cf4 this\cf0 .ToRadian(angle)) * (radiusInner - 2 * \cf4 this\cf0 .Font.Size);\par ??            \cf4 double\cf0  yin = \cf6 Math\cf0 .Cos(\cf4 this\cf0 .ToRadian(angle)) * (radiusInner - 2 * \cf4 this\cf0 .Font.Size);\par ??            g.DrawLine(penBlackThin, (\cf4 int\cf0 )xout + xcenter, (\cf4 int\cf0 )yout + ycenter, (\cf4 int\cf0 )xin + xcenter, (\cf4 int\cf0 )yin + ycenter);\par ??        \}\par ??\par ??        \cf3 // draw N, W, E, S\par ??\cf0         \cf4 double\cf0  x = \cf6 Math\cf0 .Sin(\cf4 this\cf0 .ToRadian(\cf4 this\cf0 .Heading)) * radius;\par ??        \cf4 double\cf0  y = \cf6 Math\cf0 .Cos(\cf4 this\cf0 .ToRadian(\cf4 this\cf0 .Heading)) * radius;\par ??        g.DrawString(\cf7 "N"\cf0 , \cf4 this\cf0 .Font, brushRed, (\cf4 float\cf0 )(xcenter - x) - halfFont, (\cf4 float\cf0 )(ycenter - y) - halfFont);\par ??        g.DrawString(\cf7 "S"\cf0 , \cf4 this\cf0 .Font, brushRed, (\cf4 float\cf0 )(xcenter + x) - halfFont, (\cf4 float\cf0 )(ycenter + y) - halfFont);\par ??        g.DrawString(\cf7 "W"\cf0 , \cf4 this\cf0 .Font, brushRed, (\cf4 float\cf0 )(xcenter - y) - halfFont, (\cf4 float\cf0 )(ycenter + x) - halfFont);\par ??        g.DrawString(\cf7 "E"\cf0 , \cf4 this\cf0 .Font, brushRed, (\cf4 float\cf0 )(xcenter + y) - halfFont, (\cf4 float\cf0 )(ycenter - x) - halfFont);\par ??\par ??        \cf3 // draw needle\par ??\cf0         g.DrawLine(penWhite, xcenter, ycenter, xcenter, \cf4 this\cf0 .ClientRectangle.Height - 50);\par ??        g.DrawLine(penRed, xcenter, 50, xcenter, ycenter);\par ??\par ??        \cf3 // draw digital heading\par ??\cf0         g.FillRectangle(brushWhite, (\cf4 int\cf0 )(xcenter - 11 * halfFont), (\cf4 int\cf0 )(ycenter - 5 * halfFont), (\cf4 int\cf0 )(22 * halfFont), (\cf4 int\cf0 )(11 * halfFont));\par ??        g.DrawString(\cf4 string\cf0 .Format(\cf7 "\{0,3:000\}\'b0"\cf0 , \cf4 this\cf0 .Heading), \cf4 this\cf0 .Font, brushRed, xcenter - 4 * halfFont, ycenter - 5 * halfFont);\par ??\par ??        \cf3 // draw height above sea level\par ??\cf0         g.DrawString(\cf4 string\cf0 .Format(\cf7 "\{0,4:0000.0\}m"\cf0 , \cf4 this\cf0 .Height), \cf4 this\cf0 .Font, brushRed, xcenter - 10 * halfFont, ycenter);\par ??    \}\par ??\}}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Paints the control.&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: gray;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; OnPaintBackground(&lt;span style="color: #2b91af;"&gt;PaintEventArgs&lt;/span&gt; e)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;base&lt;/span&gt;.OnPaintBackground(e);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;int&lt;/span&gt; penWidth = 5;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Graphics&lt;/span&gt; g = &lt;span style="color: blue;"&gt;this&lt;/span&gt;.CreateGraphics())&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt; penBlackThin = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.Black, penWidth - 3))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt; penBlack = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.Black, penWidth))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt; penDarkGray = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.DarkGray, penWidth))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt; penRed = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.Red, penWidth + 3))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt; penWhite = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Pen&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.WhiteSmoke, penWidth + 3))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Brush&lt;/span&gt; brushDarkGray = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;SolidBrush&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.DarkGray))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Brush&lt;/span&gt; brushWhite = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;SolidBrush&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Brush&lt;/span&gt; brushLightGray = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;SolidBrush&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.LightGray))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Brush&lt;/span&gt; brushRed = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;SolidBrush&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.Red))&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; radius = (&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Width - 50) / 2;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; radiusInner = (&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Width - 70) / 2;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;int&lt;/span&gt; xcenter = &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Width / 2;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;int&lt;/span&gt; ycenter = &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Height / 2;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;float&lt;/span&gt; halfFont = &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font.Size / 2;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// g.Clear(this.BackColor);&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// draw circles&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.FillEllipse(brushLightGray, penWidth, penWidth, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Width - 2 * penWidth, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Height - 2 * penWidth);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawEllipse(penDarkGray, penWidth, penWidth, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Width - 2 * penWidth, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Height - 2 * penWidth);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawEllipse(penBlack, 2 * penWidth, 2 * penWidth, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Width - 4 * penWidth, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Height - 4 * penWidth);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// draw separator lines&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt; (&lt;span style="color: blue;"&gt;int&lt;/span&gt; l = 0; l &amp;lt; 16; l++)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; angle = l * 22.5 + &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Heading;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; xout = &lt;span style="color: #2b91af;"&gt;Math&lt;/span&gt;.Sin(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ToRadian(angle)) * radiusInner;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; yout = &lt;span style="color: #2b91af;"&gt;Math&lt;/span&gt;.Cos(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ToRadian(angle)) * radiusInner;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; xin = &lt;span style="color: #2b91af;"&gt;Math&lt;/span&gt;.Sin(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ToRadian(angle)) * (radiusInner - 2 * &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font.Size);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; yin = &lt;span style="color: #2b91af;"&gt;Math&lt;/span&gt;.Cos(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ToRadian(angle)) * (radiusInner - 2 * &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font.Size);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawLine(penBlackThin, (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)xout + xcenter, (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)yout + ycenter, (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)xin + xcenter, (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)yin + ycenter);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// draw N, W, E, S&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; x = &lt;span style="color: #2b91af;"&gt;Math&lt;/span&gt;.Sin(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ToRadian(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.Heading)) * radius;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;double&lt;/span&gt; y = &lt;span style="color: #2b91af;"&gt;Math&lt;/span&gt;.Cos(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ToRadian(&lt;span style="color: blue;"&gt;this&lt;/span&gt;.Heading)) * radius;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(&lt;span style="color: #a31515;"&gt;"N"&lt;/span&gt;, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font, brushRed, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(xcenter - x) - halfFont, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(ycenter - y) - halfFont);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(&lt;span style="color: #a31515;"&gt;"S"&lt;/span&gt;, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font, brushRed, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(xcenter + x) - halfFont, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(ycenter + y) - halfFont);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(&lt;span style="color: #a31515;"&gt;"W"&lt;/span&gt;, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font, brushRed, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(xcenter - y) - halfFont, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(ycenter + x) - halfFont);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(&lt;span style="color: #a31515;"&gt;"E"&lt;/span&gt;, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font, brushRed, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(xcenter + y) - halfFont, (&lt;span style="color: blue;"&gt;float&lt;/span&gt;)(ycenter - x) - halfFont);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// draw needle&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawLine(penWhite, xcenter, ycenter, xcenter, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.ClientRectangle.Height - 50);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawLine(penRed, xcenter, 50, xcenter, ycenter);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// draw digital heading&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.FillRectangle(brushWhite, (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)(xcenter - 11 * halfFont), (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)(ycenter - 5 * halfFont), (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)(22 * halfFont), (&lt;span style="color: blue;"&gt;int&lt;/span&gt;)(11 * halfFont));&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"{0,3:000}&amp;#176;"&lt;/span&gt;, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Heading), &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font, brushRed, xcenter - 4 * halfFont, ycenter - 5 * halfFont);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// draw height above sea level&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"{0,4:0000.0}m"&lt;/span&gt;, &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Height), &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Font, brushRed, xcenter - 10 * halfFont, ycenter);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;which looks about this on the device:&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_8SuFzywowiM/Skt5ifJ2iuI/AAAAAAAAAtc/zQPZTz13GAQ/s1600-h/DSCN2250-3.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 372px;" src="http://1.bp.blogspot.com/_8SuFzywowiM/Skt5ifJ2iuI/AAAAAAAAAtc/zQPZTz13GAQ/s400/DSCN2250-3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5353506215445301986" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Needs some adjustments, especially to look great on other screen resolutions too. Maybe later ...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_8SuFzywowiM/Skt6VkSKzlI/AAAAAAAAAts/km5nly8CCDk/s1600-h/DSCN2249-1.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://2.bp.blogspot.com/_8SuFzywowiM/Skt6VkSKzlI/AAAAAAAAAts/km5nly8CCDk/s400/DSCN2249-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5353507092995690066" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7090731584643190007?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7090731584643190007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/07/windows-mobile-6-with-c-compass-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7090731584643190007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7090731584643190007'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/07/windows-mobile-6-with-c-compass-control.html' title='Windows Mobile 6 with C# (compass control)'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_8SuFzywowiM/Skt5ifJ2iuI/AAAAAAAAAtc/zQPZTz13GAQ/s72-c/DSCN2250-3.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6427156387714372339</id><published>2009-07-01T15:27:00.002+01:00</published><updated>2009-07-01T15:51:19.669+01:00</updated><title type='text'>Windows Mobile 6 with C# (GPS)</title><content type='html'>It's been some time since my last fun project. So after getting my brand new &lt;a href="http://www.htc.com/de/product/touchdiamond2/overview.html"&gt;HTC Touch Diamond 2&lt;/a&gt; I thought about ending this period and digging somewhat into C#.NET mobile device development.&lt;br /&gt;&lt;br /&gt;As I am new to this platform I first browsed through the Mobile SDK samples to get an idea about the slighty restricted framework capabilities. An initial MyApp application was easily created using the older Visual Studio 2005. Changing the main form to my special 800x480 screen resolution did not work properly, so the designer does not represent my device screen.&lt;br /&gt;&lt;br /&gt;The fact that my HTC has a built-in GPS device fascinated me very much. So I had a closer look at the GPS application &lt;a href="http://msdn.microsoft.com/en-us/library/bb158699.aspx"&gt;GPS sample&lt;/a&gt; and copied some classes into MyApp. Instantiating goes like this:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 this\cf0 .gps = \cf1 new\cf0  \cf4 Gps\cf0 ();\par ??gps.DeviceStateChanged += \cf1 new\cf0  \cf4 DeviceStateChangedEventHandler\cf0 (gps_DeviceStateChanged);\par ??gps.LocationChanged += \cf1 new\cf0  \cf4 LocationChangedEventHandler\cf0 (gps_LocationChanged);}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;55&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;this&lt;/span&gt;.gps = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Gps&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;56&lt;/span&gt;&amp;nbsp;gps.DeviceStateChanged += &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;DeviceStateChangedEventHandler&lt;/span&gt;(gps_DeviceStateChanged);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;57&lt;/span&gt;&amp;nbsp;gps.LocationChanged += &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;LocationChangedEventHandler&lt;/span&gt;(gps_LocationChanged);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;getting a GpsPosition class instance with the following major fields:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green128\blue0;\red255\green255\blue255;\red0\green0\blue255;\red0\green0\blue0;}??\fs20 \cf1 //** Position + heading related\par ??\cf3 internal\cf0  \cf3 double\cf0  dblLatitude = 0.0;            \cf1 // Degrees latitude.  North is positive\par ??\cf3 internal\cf0  \cf3 double\cf0  dblLongitude = 0.0;           \cf1 // Degrees longitude.  East is positive\par ??\cf3 internal\cf0  \cf3 float\cf0  flSpeed = 0.0f;                \cf1 // Speed in knots\par ??\cf3 internal\cf0  \cf3 float\cf0  flHeading = 0.0f;              \cf1 // Degrees heading (course made good).  True North=0\par ??\cf3 internal\cf0  \cf3 double\cf0  dblMagneticVariation = 0.0;   \cf1 // Magnetic variation.  East is positive\par ??\cf3 internal\cf0  \cf3 float\cf0  flAltitudeWRTSeaLevel = 0.0f;  \cf1 // Altitute with regards to sea level, in meters\par ??\cf3 internal\cf0  \cf3 float\cf0  flAltitudeWRTEllipsoid = 0.0f; \cf1 // Altitude with regards to ellipsoid, in meters}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;//** Position + heading related&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;double&lt;/span&gt; dblLatitude = 0.0;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// Degrees latitude.&amp;nbsp; North is positive&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;double&lt;/span&gt; dblLongitude = 0.0;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// Degrees longitude.&amp;nbsp; East is positive&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;float&lt;/span&gt; flSpeed = 0.0f;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// Speed in knots&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;float&lt;/span&gt; flHeading = 0.0f;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: green;"&gt;// Degrees heading (course made good).&amp;nbsp; True North=0&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;double&lt;/span&gt; dblMagneticVariation = 0.0;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// Magnetic variation.&amp;nbsp; East is positive&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;float&lt;/span&gt; flAltitudeWRTSeaLevel = 0.0f;&amp;nbsp; &lt;span style="color: green;"&gt;// Altitute with regards to sea level, in meters&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;internal&lt;/span&gt; &lt;span style="color: blue;"&gt;float&lt;/span&gt; flAltitudeWRTEllipsoid = 0.0f; &lt;span style="color: green;"&gt;// Altitude with regards to ellipsoid, in meters&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;After a couple of seconds running the application I got my first position. Output formatted as string was fine ... for the first day ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6427156387714372339?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6427156387714372339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/07/windows-mobile-6-with-c-gps.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6427156387714372339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6427156387714372339'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/07/windows-mobile-6-with-c-gps.html' title='Windows Mobile 6 with C# (GPS)'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-8810460416125617160</id><published>2009-06-12T07:22:00.002+01:00</published><updated>2009-06-12T07:31:32.285+01:00</updated><title type='text'>Team Foundation Error: You are not logged in to Windows Live Messenger</title><content type='html'>You may know BizTalk or Sharepoint or PerformancePoint Server to be a cacophony of technologies. &lt;br /&gt;&lt;br /&gt;Team Foundation Server seems to be no better, or how do you read this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_8SuFzywowiM/SjH2EnmVCuI/AAAAAAAAAnc/TQ4LJ1FlC-0/s1600-h/TfsWindowsLiveMessenger.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 384px; height: 182px;" src="http://3.bp.blogspot.com/_8SuFzywowiM/SjH2EnmVCuI/AAAAAAAAAnc/TQ4LJ1FlC-0/s400/TfsWindowsLiveMessenger.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5346324791875144418" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-8810460416125617160?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/8810460416125617160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/06/team-foundation-error-you-are-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8810460416125617160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/8810460416125617160'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/06/team-foundation-error-you-are-not.html' title='Team Foundation Error: You are not logged in to Windows Live Messenger'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_8SuFzywowiM/SjH2EnmVCuI/AAAAAAAAAnc/TQ4LJ1FlC-0/s72-c/TfsWindowsLiveMessenger.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5951196412145414706</id><published>2009-02-17T11:15:00.004+01:00</published><updated>2009-02-17T11:43:26.491+01:00</updated><title type='text'>WPF Validation</title><content type='html'>Up until recently the mechanisms that Windows Presentation Foundation provided to implement validation were quite unsatisfying.&lt;br /&gt;&lt;br /&gt;Starting with .NET 3.0 there was a way to do simple field validation:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs24 &amp;lt;\cf3 Binding\cf0  Path=\cf4 "SemanticId"\cf0  \cf3 UpdateSourceTrigger\cf0 =\cf4 "PropertyChanged"\cf0 &amp;gt;\par ??    &amp;lt;\cf3 Binding\cf0 .ValidationRules&amp;gt;\par ??        &amp;lt;XyValidationRule/&amp;gt;\par ??    &amp;lt;/\cf3 Binding\cf0 .ValidationRules&amp;gt;\par ??&amp;lt;/\cf3 Binding\cf0 &amp;gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Binding&lt;/span&gt; Path=&lt;span style="color: #a31515;"&gt;"SemanticId"&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;UpdateSourceTrigger&lt;/span&gt;=&lt;span style="color: #a31515;"&gt;"PropertyChanged"&lt;/span&gt;&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #2b91af;"&gt;Binding&lt;/span&gt;.ValidationRules&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;XyValidationRule/&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #2b91af;"&gt;Binding&lt;/span&gt;.ValidationRules&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;lt;/&lt;span style="color: #2b91af;"&gt;Binding&lt;/span&gt;&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;For most applications this is not enough, however. Usually several fields from an entity are bound to several elements on a form and they have to be validated as a whole to be consistent.&lt;br /&gt;&lt;br /&gt;A new approach came with .NET 3.5 where an POCO entity could implement an interface to be used by :&lt;br /&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs24 \cf1 public\cf0  \cf1 class\cf0  \cf4 Contact\cf0  : \cf4 IDataErrorInfo}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Contact&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;IDataErrorInfo&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;What I don't like is messing up my entities with validation code. I would prefer a separated (aspect-oriented? and) configurable way.&lt;br /&gt;&lt;br /&gt;Rather unnoticed yet another approach came with 3.5 SP1, where you can group several element bindings to one or more entities and define validation rules for this named group:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs24 &amp;lt;\cf3 Grid\cf0 .BindingGroup&amp;gt;\par ??    &amp;lt;\cf3 BindingGroup\cf0  Name=\cf4 "TrainValidationGroup"\cf0 &amp;gt;\par ??        &amp;lt;BindingGroup.ValidationRules&amp;gt;\par ??            &amp;lt;my:\cf3 TrainValidationRule\cf0  ValidationStep=\cf4 "CommittedValue"\cf0 /&amp;gt;\par ??        &amp;lt;/BindingGroup.ValidationRules&amp;gt;\par ??    &amp;lt;/\cf3 BindingGroup\cf0 &amp;gt;\par ??&amp;lt;/\cf3 Grid\cf0 .BindingGroup&amp;gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Grid&lt;/span&gt;.BindingGroup&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #2b91af;"&gt;BindingGroup&lt;/span&gt; Name=&lt;span style="color: #a31515;"&gt;"TrainValidationGroup"&lt;/span&gt;&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;BindingGroup.ValidationRules&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;my:&lt;span style="color: #2b91af;"&gt;TrainValidationRule&lt;/span&gt; ValidationStep=&lt;span style="color: #a31515;"&gt;"CommittedValue"&lt;/span&gt;/&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/BindingGroup.ValidationRules&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #2b91af;"&gt;BindingGroup&lt;/span&gt;&amp;gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;lt;/&lt;span style="color: #2b91af;"&gt;Grid&lt;/span&gt;.BindingGroup&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;It is used in each binding&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs24 &amp;lt;\cf3 TextBox\cf0  Text=\cf4 "\{Binding Path=SemanticId, BindingGroupName=TrainValidationGroup, ValidatesOnDataErrors=true\}"\cf0 /&amp;gt;\par ??}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;TextBox&lt;/span&gt; Text=&lt;span style="color: #a31515;"&gt;"{Binding Path=SemanticId, BindingGroupName=TrainValidationGroup, ValidatesOnDataErrors=true}"&lt;/span&gt;/&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Not to forget to explicitely calling&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;}??\fs24 RootElement.BindingGroup.CommitEdit();}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;RootElement.BindingGroup.CommitEdit();&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Check out the excellent posts I had as source:&lt;br /&gt;&lt;a href="http://blogs.msdn.com/wpfsdk/archive/2007/10/02/data-validation-in-3-5.aspx"&gt;MSDN blog&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/vinsibal/archive/2008/08/11/wpf-3-5-sp1-feature-bindinggroups-with-item-level-validation.aspx"&gt;Vincent Sibal&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5951196412145414706?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5951196412145414706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/02/wpf-validation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5951196412145414706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5951196412145414706'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/02/wpf-validation.html' title='WPF Validation'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-240745338542691075</id><published>2009-02-02T08:41:00.002+01:00</published><updated>2009-02-02T08:48:48.645+01:00</updated><title type='text'>WCF behaviors on callback channel</title><content type='html'>Adding behaviors to a WCF channel is widely used and easy.&lt;br /&gt;&lt;br /&gt;For an IEndpointBehavior the following code can be used:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red0\green128\blue0;}??\fs24 \cf1 public\cf0  \cf1 void\cf0  ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)\par ??\{\par ??\tab \cf4 // add endpoint behavior to service side\par ??\cf0 \tab endpointDispatcher.DispatchRuntime.MessageInspectors.Add(\cf1 this\cf0 );\par ??\}\par ??}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// add endpoint behavior to service side&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endpointDispatcher.DispatchRuntime.MessageInspectors.Add(&lt;span style="color: blue;"&gt;this&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;A less documented way is to add the same behavior to the callback of a duplex channel:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red0\green128\blue0;}??\fs24 \cf1 public\cf0  \cf1 void\cf0  ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)\par ??\{\par ??\tab \cf4 // add endpoint behavior to callback\par ??\cf0 \tab clientRuntime.CallbackDispatchRuntime.MessageInspectors.Add(\cf1 this\cf0 );\par ??\}}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// add endpoint behavior to callback&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; clientRuntime.CallbackDispatchRuntime.MessageInspectors.Add(&lt;span style="color: blue;"&gt;this&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You just need to know ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-240745338542691075?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/240745338542691075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/02/wcf-behaviors-on-callback-channel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/240745338542691075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/240745338542691075'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/02/wcf-behaviors-on-callback-channel.html' title='WCF behaviors on callback channel'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4297625771609824089</id><published>2009-01-30T11:21:00.003+01:00</published><updated>2009-02-02T11:47:20.834+01:00</updated><title type='text'>Expression evaluation, thinking again</title><content type='html'>I recently discussed .NET runtime expression evaluation. Integrating some sample code into your productive applications may have some smells; so this may not be your prefered way to solve simple business logic expression evaluation issues.&lt;br /&gt;&lt;br /&gt;Reading a blog from Brad Abrams about &lt;a href="http://blogs.msdn.com/brada/archive/2009/01/26/framework-design-guidelines-avoiding-custom-delegates.aspx"&gt;Avoiding Custom Delegates&lt;/a&gt; explaining &lt;br /&gt;&lt;br /&gt;&lt;em&gt;Expression&lt;…&gt; represents function definitions that can be compiled and subsequently invoked at runtime but can also be serialized and passed to remote processes. Continuing with our example:&lt;/em&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue255;}??\fs24 \tab \tab \tab \cf3 Expression\cf0 &amp;lt;\cf3 Func\cf0 &amp;lt;\cf4 int\cf0 , \cf4 int\cf0 , \cf4 double\cf0 &amp;gt;&amp;gt; expression = (x, y) =&amp;gt; (\cf4 double\cf0 )x / (\cf4 double\cf0 )y;\par ??\tab \tab \tab \cf3 Func\cf0 &amp;lt;\cf4 int\cf0 , \cf4 int\cf0 , \cf4 double\cf0 &amp;gt; divide = expression.Compile();\par ??\tab \tab \tab \cf3 Console\cf0 .WriteLine(divide(2, 3));}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;int&lt;/span&gt;, &lt;span style="color: blue;"&gt;int&lt;/span&gt;, &lt;span style="color: blue;"&gt;double&lt;/span&gt;&amp;gt;&amp;gt; expression = (x, y) =&amp;gt; (&lt;span style="color: blue;"&gt;double&lt;/span&gt;)x / (&lt;span style="color: blue;"&gt;double&lt;/span&gt;)y;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;int&lt;/span&gt;, &lt;span style="color: blue;"&gt;int&lt;/span&gt;, &lt;span style="color: blue;"&gt;double&lt;/span&gt;&amp;gt; divide = expression.Compile();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(divide(2, 3));&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4297625771609824089?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4297625771609824089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/01/expession-evaluation-thinking-again.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4297625771609824089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4297625771609824089'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/01/expession-evaluation-thinking-again.html' title='Expression evaluation, thinking again'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-6048572315018732921</id><published>2009-01-30T10:32:00.003+01:00</published><updated>2009-01-30T11:00:55.078+01:00</updated><title type='text'>Microsoft .NET Services (Azure .NET Service Bus) samples and relay bindings</title><content type='html'>After some initial issues getting a Microsoft .NET Services invitation code and creating a solution on partially non-working servers I finally wanted to run some samples from the SDK.&lt;br /&gt;&lt;br /&gt;Being behind a NAT/firewall infrastructure (no open custom ports other than 80/443) of our organisation (yes, indeed the net.tcp samples all failed starting the service) I tried to get wsHttpRelayBinding sample working.&lt;br /&gt;&lt;br /&gt;The service is quite simple:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs24         \cf3 static\cf0  \cf3 void\cf0  Main(\cf3 string\cf0 [] args)\par ??        \{\par ??            \cf3 string\cf0  serviceBusSolutionName = GetServiceBusSolutionName();\par ??            \cf4 Uri\cf0  address = \cf3 new\cf0  \cf4 Uri\cf0 (\cf4 String\cf0 .Format(\cf5 "http://\{0\}/services/\{1\}/EchoService/"\cf0 , \cf4 ServiceBusEnvironment\cf0 .DefaultRelayHostName, serviceBusSolutionName));\par ??\par ??            \cf4 ServiceHost\cf0  host = \cf3 new\cf0  \cf4 ServiceHost\cf0 (\cf3 typeof\cf0 (\cf4 EchoService\cf0 ), address);\par ??            host.Open();\par ??\par ??            \cf4 Console\cf0 .WriteLine(\cf5 "Service address: "\cf0  + address);\par ??            \cf4 Console\cf0 .WriteLine(\cf5 "Press [Enter] to exit"\cf0 );\par ??            \cf4 Console\cf0 .ReadLine();\par ??\par ??            host.Close();\par ??        \}}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;string&lt;/span&gt; serviceBusSolutionName = GetServiceBusSolutionName();&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Uri&lt;/span&gt; address = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Uri&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"http://{0}/services/{1}/EchoService/"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;ServiceBusEnvironment&lt;/span&gt;.DefaultRelayHostName, serviceBusSolutionName));&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;ServiceHost&lt;/span&gt; host = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ServiceHost&lt;/span&gt;(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;EchoService&lt;/span&gt;), address);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; host.Open();&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"Service address: "&lt;/span&gt; + address);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"Press [Enter] to exit"&lt;/span&gt;);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.ReadLine();&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; host.Close();&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;with the following username/password configuration:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;\red0\green128\blue0;}??\fs24 \cf1 &amp;lt;?\cf3 xml\cf1  \cf4 version\cf1 =\cf0 "\cf1 1.0\cf0 "\cf1  \cf4 encoding\cf1 =\cf0 "\cf1 utf-8\cf0 "\cf1  ?&amp;gt;\par ??&amp;lt;\cf3 configuration\cf1 &amp;gt;\par ??  &amp;lt;\cf3 system.serviceModel\cf1 &amp;gt;\par ??    &amp;lt;\cf3 behaviors\cf1 &amp;gt;\par ??      &amp;lt;\cf3 endpointBehaviors\cf1 &amp;gt;\par ??        &amp;lt;\cf3 behavior\cf1  \cf4 name\cf1 =\cf0 "\cf1 UserNamePasswordCredentials\cf0 "\cf1 &amp;gt;\par ??          &amp;lt;\cf3 transportClientEndpointBehavior\cf1  \cf4 credentialType\cf1 =\cf0 "\cf1 UserNamePassword\cf0 "\cf1 &amp;gt;\par ??            &amp;lt;\cf3 clientCredentials\cf1 &amp;gt;\par ??              &amp;lt;\cf3 userNamePassword\cf1  \cf4 userName\cf1 =\cf0 "\cf1 solution\cf0 "\cf1  \cf4 password\cf1 =\cf0 "\cf1 password\cf0 "\cf1  /&amp;gt;  \par ??            &amp;lt;/\cf3 clientCredentials\cf1 &amp;gt;\par ??          &amp;lt;/\cf3 transportClientEndpointBehavior\cf1 &amp;gt;\par ??        &amp;lt;/\cf3 behavior\cf1 &amp;gt;\par ??      &amp;lt;/\cf3 endpointBehaviors\cf1 &amp;gt;\par ??    &amp;lt;/\cf3 behaviors\cf1 &amp;gt;\par ??\par ??    &amp;lt;\cf3 bindings\cf1 &amp;gt;\par ??      &amp;lt;!--\cf6  Application Binding \cf1 --&amp;gt;\par ??      &amp;lt;\cf3 wsHttpRelayBinding\cf1 &amp;gt;\par ??        &amp;lt;\cf3 binding\cf1  \cf4 name\cf1 =\cf0 "\cf1 default\cf0 "\cf1 &amp;gt;\par ??          &amp;lt;\cf3 security\cf1  \cf4 mode\cf1 =\cf0 "\cf1 None\cf0 "\cf1 /&amp;gt;\par ??        &amp;lt;/\cf3 binding\cf1 &amp;gt;\par ??      &amp;lt;/\cf3 wsHttpRelayBinding\cf1 &amp;gt;\par ??    &amp;lt;/\cf3 bindings\cf1 &amp;gt;\par ??\par ??    &amp;lt;\cf3 services\cf1 &amp;gt;\par ??      &amp;lt;!--\cf6  Application Service \cf1 --&amp;gt;\par ??      &amp;lt;\cf3 service\cf1  \cf4 name\cf1 =\cf0 "\cf1 Microsoft.ServiceBus.Samples.EchoService\cf0 "\cf1 &amp;gt;\par ??        &amp;lt;\cf3 endpoint\cf1  \cf4 name\cf1 =\cf0 "\cf1 RelayEndpoint\cf0 "\par ??\cf1                   \cf4 contract\cf1 =\cf0 "\cf1 Microsoft.ServiceBus.Samples.IEchoContract\cf0 "\par ??\cf1                   \cf4 binding\cf1 =\cf0 "\cf1 wsHttpRelayBinding\cf0 "\par ??\cf1                   \cf4 bindingConfiguration\cf1 =\cf0 "\cf1 default\cf0 "\cf1  \par ??                  \cf4 behaviorConfiguration\cf1 =\cf0 "\cf1 UserNamePasswordCredentials\cf0 "\par ??\cf1                   \cf4 address\cf1 =\cf0 ""\cf1  /&amp;gt;\par ??      &amp;lt;/\cf3 service\cf1 &amp;gt;\par ??    &amp;lt;/\cf3 services\cf1 &amp;gt;\par ??\par ??  &amp;lt;/\cf3 system.serviceModel\cf1 &amp;gt;\par ??&amp;lt;/\cf3 configuration\cf1 &amp;gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515;"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;behavior&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;UserNamePasswordCredentials&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;transportClientEndpointBehavior&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;credentialType&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;UserNamePassword&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;clientCredentials&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;userNamePassword&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;userName&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;solution&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;password&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;password&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;clientCredentials&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;transportClientEndpointBehavior&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;behavior&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;bindings&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; Application Binding &lt;/span&gt;&lt;span style="color: blue;"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsHttpRelayBinding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;binding&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;default&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;security&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;mode&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;None&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsHttpRelayBinding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;bindings&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;services&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; Application Service &lt;/span&gt;&lt;span style="color: blue;"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;service&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Microsoft.ServiceBus.Samples.EchoService&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;endpoint&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RelayEndpoint&lt;/span&gt;"&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;contract&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Microsoft.ServiceBus.Samples.IEchoContract&lt;/span&gt;"&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;binding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;wsHttpRelayBinding&lt;/span&gt;"&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;bindingConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;default&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;behaviorConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;UserNamePasswordCredentials&lt;/span&gt;"&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;address&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;""&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;service&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;services&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;configuration&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Checking the code looks like HTTP communication to me, that should pass our security perimeter infrastructure. Getting the following exception mentioning about net.tcp gives me some thinking.&lt;br /&gt;&lt;br /&gt;System.ServiceModel.EndpointNotFoundException was unhandled&lt;br /&gt;  Message="Could not connect to net.tcp://servicebus.windows.net:828/services/solution/UserNameAuthenticationService/. The connection attempt lasted for a time span of 00:00:21.0021000. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 65.55.54.16:828. "&lt;br /&gt;  Source="Microsoft.ServiceBus"&lt;br /&gt;  StackTrace:&lt;br /&gt;       at Microsoft.ServiceBus.RelayedOnewayTcpClient.Connect()&lt;br /&gt;       at Microsoft.ServiceBus.RelayedOnewayTcpClient.EnsureChannel()&lt;br /&gt;       at Microsoft.ServiceBus.RelayedOnewayTcpClient.OnOpen(TimeSpan timeout)&lt;br /&gt;       at Microsoft.ServiceBus.Channels.CommunicationObject.Open(TimeSpan timeout)&lt;br /&gt;       at Microsoft.ServiceBus.Channels.CommunicationObject.Open()&lt;br /&gt;       at Microsoft.ServiceBus.RelayedOnewayTcpListener.OnOpen(TimeSpan timeout)&lt;br /&gt;... &lt;br /&gt;&lt;br /&gt;Using TCP port 828...&lt;br /&gt;&lt;br /&gt;Is there some probing going on, even when specifying a HTTP binding? Trying again from home.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-6048572315018732921?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/6048572315018732921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/01/microsoft-net-services-azure-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6048572315018732921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/6048572315018732921'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/01/microsoft-net-services-azure-net.html' title='Microsoft .NET Services (Azure .NET Service Bus) samples and relay bindings'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-5140080940637224313</id><published>2009-01-23T15:32:00.007+01:00</published><updated>2009-01-23T15:59:56.437+01:00</updated><title type='text'>C# runtime expression evaluation</title><content type='html'>I recently found out about a &lt;a href="http://code.msdn.microsoft.com/LambdaConverter"&gt;XAML declarative value converter&lt;/a&gt; for WPF which is based on a Visual Studio Linq lambda expression sample called DynamicQuery (Dynamic.cs is bundled with VS2008 as part of &lt;VS 2008 Dir&gt;\Samples\1033\CSharpSamples.zip).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_8SuFzywowiM/SXnX62R0lHI/AAAAAAAAAbI/m_wD9TIgXlo/s1600-h/DynamicExpressionAPI.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 76px;" src="http://3.bp.blogspot.com/_8SuFzywowiM/SXnX62R0lHI/AAAAAAAAAbI/m_wD9TIgXlo/s400/DynamicExpressionAPI.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5294500242953376882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For a rule evaluation (engine) investigation I created a simple application that accepts a list of expression parameters and calculates the result of a formula:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_8SuFzywowiM/SXnbVselssI/AAAAAAAAAbY/13__w8Wn-eI/s1600-h/DynamicExpression.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 283px;" src="http://3.bp.blogspot.com/_8SuFzywowiM/SXnbVselssI/AAAAAAAAAbY/13__w8Wn-eI/s400/DynamicExpression.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5294504002713924290" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Takes a couple of [ms] the first time but performs great after the initial hit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-5140080940637224313?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/5140080940637224313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/01/c-runtime-expression-evaluation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5140080940637224313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/5140080940637224313'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/01/c-runtime-expression-evaluation.html' title='C# runtime expression evaluation'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_8SuFzywowiM/SXnX62R0lHI/AAAAAAAAAbI/m_wD9TIgXlo/s72-c/DynamicExpressionAPI.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7087268567401752712</id><published>2009-01-19T14:01:00.004+01:00</published><updated>2009-01-19T14:15:36.012+01:00</updated><title type='text'>WebBrowser in WPF</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_8SuFzywowiM/SXR6krHJeBI/AAAAAAAAAaw/9KFgf038ujM/s1600-h/MyRss.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 214px;" src="http://2.bp.blogspot.com/_8SuFzywowiM/SXR6krHJeBI/AAAAAAAAAaw/9KFgf038ujM/s320/MyRss.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5292990232533760018" /&gt;&lt;/a&gt;&lt;br /&gt;Sketching a very simple RSS reader for a demo today, I just faced the question on how to display HTML in the Windows Forms WebBrowser control in a WPF application.&lt;br /&gt;&lt;br /&gt;You just need to wrap it into a WindowsFormsHost element:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs24 \cf1 &amp;lt;\cf3 DockPanel\cf1  \cf4 Grid.Column\cf1 =\cf0 "\cf1 1\cf0 "\cf1  \cf4 Margin\cf1 =\cf0 "\cf1 10\cf0 "\cf1  \cf4 TextBlock.FontFamily\cf1 =\cf0 "\cf1 Verdana\cf0 "\cf1  &amp;gt;\par ??    &amp;lt;\cf3 TextBlock\cf1  \cf4 FontSize\cf1 =\cf0 "\cf1 16\cf0 "\cf1  \cf4 FontWeight\cf1 =\cf0 "\cf1 Bold\cf0 "\cf1  \cf4 x:Name\cf1 =\cf0 "\cf1 RssTitle\cf0 "\cf1  \cf4 DockPanel.Dock\cf1 =\cf0 "\cf1 Top\cf0 "\cf1 /&amp;gt;\par ??    &amp;lt;\cf3 WindowsFormsHost\cf1 &amp;gt;\par ??        &amp;lt;\cf3 wf:WebBrowser\cf1  \cf4 x:Name\cf1 =\cf0 "\cf1 RssBrowser\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;/\cf3 WindowsFormsHost\cf1 &amp;gt;\par ??&amp;lt;/\cf3 DockPanel\cf1 &amp;gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Margin&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;10&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;TextBlock.FontFamily&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Verdana&lt;/span&gt;"&lt;span style="color: blue;"&gt; &amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;16&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Bold&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;x:Name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RssTitle&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Top&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;WindowsFormsHost&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wf:WebBrowser&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;x:Name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RssBrowser&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;WindowsFormsHost&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;DockPanel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Setting the namespace for wf to &lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red255\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red0\green0\blue0;}??\fs24 \cf1 xmlns:wf\cf3 =\cf0 "\cf3 clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms\cf0 "}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: red;"&gt;xmlns:wf&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms&lt;/span&gt;"&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;and then call &lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;}??\fs24 \cf1 this\cf0 .RssBrowser.DocumentText = syndicationItem.Summary.Text;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;br /&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;this&lt;/span&gt;.RssBrowser.DocumentText = syndicationItem.Summary.Text;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;from code. Does anybode know how to set the font family, by the way?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-7087268567401752712?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/7087268567401752712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2009/01/webbrowser-in-wpf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7087268567401752712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/7087268567401752712'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2009/01/webbrowser-in-wpf.html' title='WebBrowser in WPF'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_8SuFzywowiM/SXR6krHJeBI/AAAAAAAAAaw/9KFgf038ujM/s72-c/MyRss.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-4262287256623749550</id><published>2008-12-01T14:49:00.002+01:00</published><updated>2008-12-01T14:53:50.764+01:00</updated><title type='text'>[ThreadStatic] and ThreadPool threads</title><content type='html'>You can use [ThreadStatic] on static fields of a class to store state - per thread.&lt;br /&gt;&lt;br /&gt;Please note that using the CLR ThreadPool may re-use a thread and the state is still sticking to that thread.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8040115472186352073-4262287256623749550?l=mleder.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mleder.blogspot.com/feeds/4262287256623749550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mleder.blogspot.com/2008/12/threadstatic-and-threadpool-threads.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4262287256623749550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8040115472186352073/posts/default/4262287256623749550'/><link rel='alternate' type='text/html' href='http://mleder.blogspot.com/2008/12/threadstatic-and-threadpool-threads.html' title='[ThreadStatic] and ThreadPool threads'/><author><name>Markus Leder</name><uri>http://www.blogger.com/profile/18420051096418489608</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://3.bp.blogspot.com/_8SuFzywowiM/SX3kXDwLlKI/AAAAAAAAAbk/shwRzuk47YI/S220/KlassenfreundeBild.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8040115472186352073.post-7161201356459398365</id><published>2008-05-18T22:11:00.002+02:00</published><updated>2008-05-18T22:36:47.022+02:00</updated><title type='text'>Creating a WSDL using C#</title><content type='html'>Have you ever thought about generating a WSDL file? For use in a DSL to create a web service description file directly?&lt;br /&gt;&lt;br /&gt;Version one I found out was&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red43\green145\blue175;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue255;\red163\green21\blue21;}??\fs24 \cf1 ContractDescription\cf0  cd = \cf1 ContractDescription\cf0 .GetContract(\cf4 typeof\cf0 (\cf1 IContract\cf0 ));\par ??System.ServiceModel.Description.\cf1 WsdlExporter\cf0  wexp = \cf4 new\cf0  System.ServiceModel.Description.\cf1 WsdlExporter\cf0 ();\par ??wexp.ExportContract(cd);\par ??\cf1 MetadataSet\cf0  mds = wexp.GetGeneratedMetadata();\par ??mds.WriteTo(\cf4 new\cf0  \cf1 XmlTextWriter\cf0 (\cf5 @".\\IContract.wsdl"\cf0 , \cf1 Encoding\cf0 .UTF8));}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;ContractDescription&lt;/span&gt; cd = &lt;span style="color: #2b91af;"&gt;ContractDescription&lt;/span&gt;.GetContract(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;IContract&lt;/span&gt;));&lt;/p&gt;&lt;p style="margin: 0px;"&gt;System.ServiceModel.Description.&lt;span style="color: #2b91af;"&gt;WsdlExporter&lt;/span&gt; wexp = &lt;span style="color: blue;"&gt;new&lt;/span&gt; System.ServiceModel.Description.&lt;span style="color: #2b91af;"&gt;WsdlExporter&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;wexp.ExportContract(cd);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;MetadataSet&lt;/span&gt; mds = wexp.GetGeneratedMetadata();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;mds.WriteTo(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlTextWriter&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;@".\IContract.wsdl"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;Encoding&lt;/span&gt;.UTF8));&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;for a simple contract like&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;\red163\green21\blue21;}??\fs24 \cf1 namespace\cf0  WsdlExporter\par ??\{\par ??    [\cf4 MessageContract\cf0 ]\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 RequestMessage\par ??\cf0     \{\par ??        \cf1 public\cf0  \cf4 Guid\cf0  ID;\par ??    \}\par ??\par ??    [\cf4 MessageContract\cf0 ]\par ??    \cf1 public\cf0  \cf1 class\cf0  \cf4 ResponseMessage\par ??\cf0     \{\par ??        \cf1 public\cf0  \cf1 string\cf0  Name;\par ??    \}\par ??\par ??    [\cf4 ServiceContract\cf0 (Namespace=\cf5 "http://www.mleder.blogspot.com/WsdlExporter/2008/04"\cf0 )]\par ??    \cf1 public\cf0  \cf1 interface\cf0  \cf4 IContract\par ??\cf0     \{\par ??        [\cf4 OperationContract\cf0 ]\par ??        \cf1 void\cf0  Op1(\cf1 string\cf0  s);\par ??\par ??        [\cf4 OperationContract\cf0 ]\par ??        \cf1 int\cf0  Op2();\par ??\par ??        [\cf4 OperationContract\cf0 ]\par ??        \cf4 ResponseMessage\cf0  Op3(\cf4 RequestMessage\cf0  req);\par ??    \}\par ??\}}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; WsdlExporter&lt;/p&gt;&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;MessageContract&lt;/span&gt;]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;RequestMessage&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt; ID;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;MessageContract&lt;/span&gt;]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ResponseMessage&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Name;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;ServiceContract&lt;/span&gt;(Namespace=&lt;span style="color: #a31515;"&gt;"http://www.mleder.blogspot.com/WsdlExporter/2008/04"&lt;/span&gt;)]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IContract&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;OperationContract&lt;/span&gt;]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Op1(&lt;span style="color: blue;"&gt;string&lt;/span&gt; s);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;OperationContract&lt;/span&gt;]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;int&lt;/span&gt; Op2();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af;"&gt;OperationContract&lt;/span&gt;]&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;ResponseMessage&lt;/span&gt; Op3(&lt;span style="color: #2b91af;"&gt;RequestMessage&lt;/span&gt; req);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I think this is verbose. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So I figured out version two, where I start with an "empty" WSDL file:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs24 \cf1 &amp;lt;?\cf3 xml\cf1  \cf4 version\cf1 =\cf0 "\cf1 1.0\cf0 "\cf1  \cf4 encoding\cf1 =\cf0 "\cf1 utf-8\cf0 "\cf1 ?&amp;gt;\par ??&amp;lt;\cf3 wsdl:definitions\cf1  \cf4 xmlns:tns\cf1 =\cf0 "\cf1 http://localhost/remote\cf0 "\cf1  \par ??                  \cf4 xmlns:s\cf1 =\cf0 "\cf1 http://www.w3.org/2001/XMLSchema\cf0 "\cf1  \par ??                  \cf4 xmlns:soap12\cf1 =\cf0 "\cf1 http://schemas.xmlsoap.org/wsdl/soap12/\cf0 "\cf1  \par ??                  \cf4 targetNamespace\cf1 =\cf0 "\cf1 http://localhost/remote\cf0 "\cf1  \par ??                  \cf4 xmlns:wsdl\cf1 =\cf0 "\cf1 http://schemas.xmlsoap.org/wsdl/\cf0 "\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:types\cf1 &amp;gt;\par ??    &amp;lt;\cf3 s:schema\cf1  \cf4 elementFormDefault\cf1 =\cf0 "\cf1 qualified\cf0 "\cf1  \cf4 targetNamespace\cf1 =\cf0 "\cf1 http://localhost/remote\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;/\cf3 s:schema\cf1 &amp;gt;\par ??  &amp;lt;/\cf3 wsdl:types\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:portType\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddServiceSoap12\cf0 "\cf1 &amp;gt;\par ??  &amp;lt;/\cf3 wsdl:portType\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:binding\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddServiceSoap12\cf0 "\cf1  \cf4 type\cf1 =\cf0 "\cf1 tns:RemoteAddServiceSoap12\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 soap12:binding\cf1  \cf4 transport\cf1 =\cf0 "\cf1 http://schemas.xmlsoap.org/soap/http\cf0 "\cf1  /&amp;gt;\par ??  &amp;lt;/\cf3 wsdl:binding\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:service\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddService\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 wsdl:port\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddServiceSoap12\cf0 "\cf1  \cf4 binding\cf1 =\cf0 "\cf1 tns:RemoteAddServiceSoap12\cf0 "\cf1 &amp;gt;\par ??      &amp;lt;\cf3 soap12:address\cf1  \cf4 location\cf1 =\cf0 "\cf1 http://localhost:8765/RemoteAddService.asmx\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;/\cf3 wsdl:port\cf1 &amp;gt;\par ??  &amp;lt;/\cf3 wsdl:service\cf1 &amp;gt;\par ??&amp;lt;/\cf3 wsdl:definitions\cf1 &amp;gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515;"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt;?&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:definitions&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:tns&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/remote&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:s&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://www.w3.org/2001/XMLSchema&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:soap12&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.xmlsoap.org/wsdl/soap12/&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;targetNamespace&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/remote&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:wsdl&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.xmlsoap.org/wsdl/&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:types&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;s:schema&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;elementFormDefault&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;qualified&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;targetNamespace&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/remote&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;s:schema&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:types&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:portType&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RemoteAddServiceSoap12&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:portType&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:binding&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RemoteAddServiceSoap12&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;tns:RemoteAddServiceSoap12&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;soap12:binding&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;transport&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.xmlsoap.org/soap/http&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:binding&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:service&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RemoteAddService&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:port&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RemoteAddServiceSoap12&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;binding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;tns:RemoteAddServiceSoap12&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;soap12:address&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;location&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost:8765/RemoteAddService.asmx&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:port&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:service&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:definitions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;and write some C# code:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green128\blue0;\red255\green255\blue255;\red43\green145\blue175;\red0\green0\blue0;\red163\green21\blue21;\red0\green0\blue255;}??\fs24 \cf1 // load an "empty" WSDL file (no types, messages, operations, ...) \par ??// to start from and add operations by code\par ??\cf3 ServiceDescription\cf0  wsdl = \cf3 ServiceDescription\cf0 .Read(\cf5 "empty.wsdl"\cf0 );\par ??\par ??\cf1 // add operation binding\par ??\cf3 OperationBinding\cf0  myOperationBinding = \cf6 new\cf0  \cf3 OperationBinding\cf0 ();\par ??myOperationBinding.Name = \cf5 "Add"\cf0 ;\par ??\cf3 Soap12OperationBinding\cf0  myOperation = \cf6 new\cf0  \cf3 Soap12OperationBinding\cf0 ();\par ??myOperation.Style = \cf3 SoapBindingStyle\cf0 .Document;\par ??myOperation.SoapAction = \cf5 "http://localhost/remote/Add"\cf0 ;\par ??myOperationBinding.Extensions.Add(myOperation);\par ??\par ??\cf1 // add input binding\par ??\cf3 InputBinding\cf0  myInput = \cf6 new\cf0  \cf3 InputBinding\cf0 ();\par ??\cf3 Soap12BodyBinding\cf0  soap12BodyInputBinding = \cf6 new\cf0  \cf3 Soap12BodyBinding\cf0 ();\par ??soap12BodyInputBinding.Use = \cf3 SoapBindingUse\cf0 .Literal;\par ??myInput.Extensions.Add(soap12BodyInputBinding);\par ??myOperationBinding.Input = myInput;\par ??\par ??\cf1 // add output binding\par ??\cf3 OutputBinding\cf0  myOutput = \cf6 new\cf0  \cf3 OutputBinding\cf0 ();\par ??\cf3 Soap12BodyBinding\cf0  soap12BodyOutputBinding = \cf6 new\cf0  \cf3 Soap12BodyBinding\cf0 ();\par ??soap12BodyOutputBinding.Use = \cf3 SoapBindingUse\cf0 .Literal;\par ??myOutput.Extensions.Add(soap12BodyOutputBinding);\par ??myOperationBinding.Output = myOutput;\par ??wsdl.Bindings[0].Operations.Add(myOperationBinding);\par ??\par ??\cf1 // 1. ==&amp;gt; add operation to port type\par ??\cf3 Operation\cf0  operation = \cf6 new\cf0  \cf3 Operation\cf0 ();\par ??operation.Name = \cf5 "Add"\cf0 ;\par ??\cf3 OperationMessage\cf0  outputMessage = (\cf3 OperationMessage\cf0 )\cf6 new\cf0  \cf3 OperationOutput\cf0 ();\par ??outputMessage.Message = \cf6 new\cf0  \cf3 XmlQualifiedName\cf0 (\cf5 "tns:AddOutput"\cf0 );\par ??\cf3 OperationInput\cf0  inputMessage = \cf6 new\cf0  \cf3 OperationInput\cf0 ();\par ??inputMessage.Message = \cf6 new\cf0  \cf3 XmlQualifiedName\cf0 (\cf5 "tns:AddInput"\cf0 );\par ??operation.Messages.Add(inputMessage);\par ??operation.Messages.Add(outputMessage);\par ??wsdl.PortTypes[0].Operations.Add(operation);\par ??\par ??\cf1 // add first message\par ??\cf3 Message\cf0  message1 = \cf6 new\cf0  \cf3 Message\cf0 ();\par ??message1.Name = \cf5 "AddInput"\cf0 ;\par ??\cf3 MessagePart\cf0  messagePart1 = \cf6 new\cf0  \cf3 MessagePart\cf0 ();\par ??messagePart1.Name = \cf5 "parameter1"\cf0 ;\par ??messagePart1.Type = \cf6 new\cf0  \cf3 XmlQualifiedName\cf0 (\cf5 "s:int"\cf0 );\par ??\cf3 MessagePart\cf0  messagePart2 = \cf6 new\cf0  \cf3 MessagePart\cf0 ();\par ??messagePart2.Name = \cf5 "parameter2"\cf0 ;\par ??messagePart2.Type = \cf6 new\cf0  \cf3 XmlQualifiedName\cf0 (\cf5 "s:int"\cf0 );\par ??message1.Parts.Add(messagePart1);\par ??message1.Parts.Add(messagePart2);\par ??\par ??\cf1 // add second message\par ??\cf3 Message\cf0  message2 = \cf6 new\cf0  \cf3 Message\cf0 ();\par ??message2.Name = \cf5 "AddOutput"\cf0 ;\par ??\par ??\cf1 // add third message\par ??\cf3 MessagePart\cf0  messagePart3 = \cf6 new\cf0  \cf3 MessagePart\cf0 ();\par ??messagePart3.Name = \cf5 "result"\cf0 ;\par ??messagePart3.Type = \cf6 new\cf0  \cf3 XmlQualifiedName\cf0 (\cf5 "s:int"\cf0 );\par ??message2.Parts.Add(messagePart3);\par ??\par ??\cf1 // 2. ==&amp;gt; add messages\par ??\cf0 wsdl.Messages.Add(message1);\par ??wsdl.Messages.Add(message2);\par ??\par ??\cf1 // write the service description into a WSDL file.\par ??\cf0 wsdl.Write(\cf5 "empty_add.wsdl"\cf0 );\par ??\cf3 Console\cf0 .WriteLine(\cf5 "WSDL file named empty_add.wsdl created successfully."\cf0 );}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// load an "empty" WSDL file (no types, messages, operations, ...) &lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// to start from and add operations by code&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;ServiceDescription&lt;/span&gt; wsdl = &lt;span style="color: #2b91af;"&gt;ServiceDescription&lt;/span&gt;.Read(&lt;span style="color: #a31515;"&gt;"empty.wsdl"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// add operation binding&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;OperationBinding&lt;/span&gt; myOperationBinding = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;OperationBinding&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOperationBinding.Name = &lt;span style="color: #a31515;"&gt;"Add"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Soap12OperationBinding&lt;/span&gt; myOperation = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Soap12OperationBinding&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOperation.Style = &lt;span style="color: #2b91af;"&gt;SoapBindingStyle&lt;/span&gt;.Document;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOperation.SoapAction = &lt;span style="color: #a31515;"&gt;"http://localhost/remote/Add"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOperationBinding.Extensions.Add(myOperation);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// add input binding&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;InputBinding&lt;/span&gt; myInput = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;InputBinding&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Soap12BodyBinding&lt;/span&gt; soap12BodyInputBinding = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Soap12BodyBinding&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;soap12BodyInputBinding.Use = &lt;span style="color: #2b91af;"&gt;SoapBindingUse&lt;/span&gt;.Literal;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myInput.Extensions.Add(soap12BodyInputBinding);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOperationBinding.Input = myInput;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// add output binding&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;OutputBinding&lt;/span&gt; myOutput = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;OutputBinding&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Soap12BodyBinding&lt;/span&gt; soap12BodyOutputBinding = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Soap12BodyBinding&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;soap12BodyOutputBinding.Use = &lt;span style="color: #2b91af;"&gt;SoapBindingUse&lt;/span&gt;.Literal;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOutput.Extensions.Add(soap12BodyOutputBinding);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;myOperationBinding.Output = myOutput;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;wsdl.Bindings[0].Operations.Add(myOperationBinding);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// 1. ==&amp;gt; add operation to port type&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Operation&lt;/span&gt; operation = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Operation&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;operation.Name = &lt;span style="color: #a31515;"&gt;"Add"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;OperationMessage&lt;/span&gt; outputMessage = (&lt;span style="color: #2b91af;"&gt;OperationMessage&lt;/span&gt;)&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;OperationOutput&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;outputMessage.Message = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlQualifiedName&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"tns:AddOutput"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;OperationInput&lt;/span&gt; inputMessage = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;OperationInput&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;inputMessage.Message = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlQualifiedName&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"tns:AddInput"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;operation.Messages.Add(inputMessage);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;operation.Messages.Add(outputMessage);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;wsdl.PortTypes[0].Operations.Add(operation);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// add first message&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Message&lt;/span&gt; message1 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Message&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;message1.Name = &lt;span style="color: #a31515;"&gt;"AddInput"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;MessagePart&lt;/span&gt; messagePart1 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MessagePart&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;messagePart1.Name = &lt;span style="color: #a31515;"&gt;"parameter1"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;messagePart1.Type = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlQualifiedName&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"s:int"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;MessagePart&lt;/span&gt; messagePart2 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MessagePart&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;messagePart2.Name = &lt;span style="color: #a31515;"&gt;"parameter2"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;messagePart2.Type = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlQualifiedName&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"s:int"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;message1.Parts.Add(messagePart1);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;message1.Parts.Add(messagePart2);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// add second message&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Message&lt;/span&gt; message2 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Message&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;message2.Name = &lt;span style="color: #a31515;"&gt;"AddOutput"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// add third message&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;MessagePart&lt;/span&gt; messagePart3 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MessagePart&lt;/span&gt;();&lt;/p&gt;&lt;p style="margin: 0px;"&gt;messagePart3.Name = &lt;span style="color: #a31515;"&gt;"result"&lt;/span&gt;;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;messagePart3.Type = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlQualifiedName&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"s:int"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;message2.Parts.Add(messagePart3);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// 2. ==&amp;gt; add messages&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;wsdl.Messages.Add(message1);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;wsdl.Messages.Add(message2);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: green;"&gt;// write the service description into a WSDL file.&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;wsdl.Write(&lt;span style="color: #a31515;"&gt;"empty_add.wsdl"&lt;/span&gt;);&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"WSDL file named empty_add.wsdl created successfully."&lt;/span&gt;);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Using version two, you have full control over all types, messages, operations, bindings, etc. and get a short and easy:&lt;br /&gt;&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs24 \cf1 &amp;lt;?\cf3 xml\cf1  \cf4 version\cf1 =\cf0 "\cf1 1.0\cf0 "\cf1  \cf4 encoding\cf1 =\cf0 "\cf1 utf-8\cf0 "\cf1 ?&amp;gt;\par ??&amp;lt;\cf3 wsdl:definitions\cf1  \cf4 xmlns:tns\cf1 =\cf0 "\cf1 http://localhost/remote\cf0 "\cf1  \cf4 xmlns:s\cf1 =\cf0 "\cf1 http://www.w3.org/2001/XMLSchema\cf0 "\cf1  \cf4 xmlns:soap12\cf1 =\cf0 "\cf1 http://schemas.xmlsoap.org/wsdl/soap12/\cf0 "\cf1  \cf4 targetNamespace\cf1 =\cf0 "\cf1 http://localhost/remote\cf0 "\cf1  \cf4 xmlns:wsdl\cf1 =\cf0 "\cf1 http://schemas.xmlsoap.org/wsdl/\cf0 "\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:types\cf1 &amp;gt;\par ??    &amp;lt;\cf3 s:schema\cf1  \cf4 elementFormDefault\cf1 =\cf0 "\cf1 qualified\cf0 "\cf1  \cf4 targetNamespace\cf1 =\cf0 "\cf1 http://localhost/remote\cf0 "\cf1  /&amp;gt;\par ??  &amp;lt;/\cf3 wsdl:types\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:message\cf1  \cf4 name\cf1 =\cf0 "\cf1 AddInput\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 wsdl:part\cf1  \cf4 name\cf1 =\cf0 "\cf1 parameter1\cf0 "\cf1  \cf4 type\cf1 =\cf0 "\cf1 s:int\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;\cf3 wsdl:part\cf1  \cf4 name\cf1 =\cf0 "\cf1 parameter2\cf0 "\cf1  \cf4 type\cf1 =\cf0 "\cf1 s:int\cf0 "\cf1  /&amp;gt;\par ??  &amp;lt;/\cf3 wsdl:message\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:message\cf1  \cf4 name\cf1 =\cf0 "\cf1 AddOutput\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 wsdl:part\cf1  \cf4 name\cf1 =\cf0 "\cf1 result\cf0 "\cf1  \cf4 type\cf1 =\cf0 "\cf1 s:int\cf0 "\cf1  /&amp;gt;\par ??  &amp;lt;/\cf3 wsdl:message\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:portType\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddServiceSoap12\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 wsdl:operation\cf1  \cf4 name\cf1 =\cf0 "\cf1 Add\cf0 "\cf1 &amp;gt;\par ??      &amp;lt;\cf3 wsdl:input\cf1  \cf4 message\cf1 =\cf0 "\cf1 tns:AddInput\cf0 "\cf1  /&amp;gt;\par ??      &amp;lt;\cf3 wsdl:output\cf1  \cf4 message\cf1 =\cf0 "\cf1 tns:AddOutput\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;/\cf3 wsdl:operation\cf1 &amp;gt;\par ??  &amp;lt;/\cf3 wsdl:portType\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:binding\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddServiceSoap12\cf0 "\cf1  \cf4 type\cf1 =\cf0 "\cf1 tns:RemoteAddServiceSoap12\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 soap12:binding\cf1  \cf4 transport\cf1 =\cf0 "\cf1 http://schemas.xmlsoap.org/soap/http\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;\cf3 wsdl:operation\cf1  \cf4 name\cf1 =\cf0 "\cf1 Add\cf0 "\cf1 &amp;gt;\par ??      &amp;lt;\cf3 soap12:operation\cf1  \cf4 soapAction\cf1 =\cf0 "\cf1 http://localhost/remote/Add\cf0 "\cf1  \cf4 style\cf1 =\cf0 "\cf1 document\cf0 "\cf1  /&amp;gt;\par ??      &amp;lt;\cf3 wsdl:input\cf1 &amp;gt;\par ??        &amp;lt;\cf3 soap12:body\cf1  \cf4 use\cf1 =\cf0 "\cf1 literal\cf0 "\cf1  /&amp;gt;\par ??      &amp;lt;/\cf3 wsdl:input\cf1 &amp;gt;\par ??      &amp;lt;\cf3 wsdl:output\cf1 &amp;gt;\par ??        &amp;lt;\cf3 soap12:body\cf1  \cf4 use\cf1 =\cf0 "\cf1 literal\cf0 "\cf1  /&amp;gt;\par ??      &amp;lt;/\cf3 wsdl:output\cf1 &amp;gt;\par ??    &amp;lt;/\cf3 wsdl:operation\cf1 &amp;gt;\par ??  &amp;lt;/\cf3 wsdl:binding\cf1 &amp;gt;\par ??  &amp;lt;\cf3 wsdl:service\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddService\cf0 "\cf1 &amp;gt;\par ??    &amp;lt;\cf3 wsdl:port\cf1  \cf4 name\cf1 =\cf0 "\cf1 RemoteAddServiceSoap12\cf0 "\cf1  \cf4 binding\cf1 =\cf0 "\cf1 tns:RemoteAddServiceSoap12\cf0 "\cf1 &amp;gt;\par ??      &amp;lt;\cf3 soap12:address\cf1  \cf4 location\cf1 =\cf0 "\cf1 http://localhost:8765/RemoteAddService.asmx\cf0 "\cf1  /&amp;gt;\par ??    &amp;lt;/\cf3 wsdl:port\cf1 &amp;gt;\par ??  &amp;lt;/\cf3 wsdl:service\cf1 &amp;gt;\par ??&amp;lt;/\cf3 wsdl:definitions\cf1 &amp;gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;div style="font-family: Courier New; font-size: 12pt; color: black; background: white;"&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515;"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;utf-8&lt;/span&gt;"&lt;span style="color: blue;"&gt;?&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:definitions&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:tns&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/remote&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:s&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://www.w3.org/2001/XMLSchema&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:soap12&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.xmlsoap.org/wsdl/soap12/&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;targetNamespace&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/remote&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:wsdl&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://schemas.xmlsoap.org/wsdl/&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:types&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;s:schema&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;elementFormDefault&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;qualified&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;targetNamespace&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/remote&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:types&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:message&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;AddInput&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:part&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;parameter1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;s:int&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:part&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;parameter2&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;s:int&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:message&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:message&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;AddOutput&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:part&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;result&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;s:int&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:message&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:portType&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;RemoteAddServiceSoap12&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:operation&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Add&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;wsdl:input&lt;/span&gt;&lt;span style="color: blue;"
