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

<channel>
	<title>ThumNet &#187; Jeffrey Tummers</title>
	<atom:link href="http://blog.thumnet.com/author/jeffreytummers/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thumnet.com</link>
	<description>Just a ThumNet blog</description>
	<lastBuildDate>Fri, 06 Aug 2010 09:34:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Automatically connect WebParts on a SharePoint page</title>
		<link>http://blog.thumnet.com/automatically-connect-webparts-on-sharepoint-page/201/</link>
		<comments>http://blog.thumnet.com/automatically-connect-webparts-on-sharepoint-page/201/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 09:34:55 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[sharepoint2007]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[webpart]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=201</guid>
		<description><![CDATA[For a recent project we had several WebParts (Provider and Consumer webparts) on a page which had to be connected to each other when the page was provisioned by our solution. Unfortunately this cannot be done within the Module.xml So I created a method which automatically connects the consumer WebParts to their correct provider WebParts. [...]]]></description>
			<content:encoded><![CDATA[<p>For a recent project we had several WebParts (Provider and Consumer webparts) on a page which had to be connected to each other when the page was provisioned by our solution.</p>
<p>Unfortunately this cannot be done within the Module.xml <img src='http://blog.thumnet.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>So I created a method which automatically connects the consumer WebParts to their correct provider WebParts.</p>
<p>To do this I basically used the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.splimitedwebpartmanager.aspx">SPLimitedWebPartManager</a>, <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.providerconnectionpoint.aspx">ProviderConnectionPoint</a>, <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.consumerconnectionpoint.aspx">ConsumerConnectionPoint </a>and some other nice classes.</p>
<p><strong>The method (warning long block of code)</strong></p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Connects the web parts on page.
/// &lt;/summary&gt;
/// &lt;param name=&quot;web&quot;&gt;The web.&lt;/param&gt;
/// &lt;param name=&quot;pageUrl&quot;&gt;The page URL.&lt;/param&gt;
/// &lt;param name=&quot;publish&quot;&gt;if set to &lt;c&gt;true&lt;/c&gt; [publish].&lt;/param&gt;
public static void ConnectWebPartsOnPage(SPWeb web, string pageUrl, bool publish)
{
	// get the page from the url
	SPFile page = web.GetFile(pageUrl);

	// make sure the page exists
	if (page.Exists)
	{
		// if the page is checked out, check it in because then the user can do an rollback
		if (page.Level == SPFileLevel.Checkout)
		{
			page.CheckIn(&quot;Page was checked out, needs to be checked in before connecting webparts&quot;, SPCheckinType.MinorCheckIn);
		}

		// check out the page because we are going to do changes on it
		page.CheckOut();

		// get the webpartmanager for the page
		using (Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = page.GetLimitedWebPartManager(PersonalizationScope.Shared))
		{
			try
			{
				// try to connect the webparts on the page
				if (ConnectWebParts(mgr))
				{
					string checkinComment = &quot;Auto connected WebParts on page&quot;;

					// webparts are connected so update the page and check it in
					page.Update();
					page.CheckIn(checkinComment);

					if (publish)
					{
						page.Publish(checkinComment);
						page.Approve(checkinComment);
					}
				}
			}
			catch (Exception ex)
			{
				page.UndoCheckOut();
				throw ex;
			}
		}
	}
}

/// &lt;summary&gt;
/// Checks if a WebPart connection exists.
/// &lt;/summary&gt;
/// &lt;param name=&quot;connections&quot;&gt;The connections.&lt;/param&gt;
/// &lt;param name=&quot;provider&quot;&gt;The provider.&lt;/param&gt;
/// &lt;param name=&quot;consumer&quot;&gt;The consumer.&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private static bool WebPartConnectionExist(Microsoft.SharePoint.WebPartPages.SPWebPartConnectionCollection connections,
	System.Web.UI.WebControls.WebParts.WebPart provider, System.Web.UI.WebControls.WebParts.WebPart consumer)
{
	foreach (Microsoft.SharePoint.WebPartPages.SPWebPartConnection conn in connections)
	{
		if (conn.Provider == provider &amp;&amp; conn.Consumer == consumer)
		{
			return true;
		}
	}

	return false;
}

/// &lt;summary&gt;
/// Connects the web parts.
/// &lt;/summary&gt;
/// &lt;param name=&quot;manager&quot;&gt;The manager.&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private static bool ConnectWebParts(Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager manager)
{
	bool connectionMade = false;

	// get the webparts on the page
	Microsoft.SharePoint.WebPartPages.SPLimitedWebPartCollection webparts = manager.WebParts;

	// only continu if there are any webparts
	if (webparts.Count &gt; 0)
	{
		ProviderConnectionPointCollection provColl;
		ConsumerConnectionPointCollection consColl;
		// walk through all the webparts on the page to find provider webparts
		foreach (System.Web.UI.WebControls.WebParts.WebPart providerPart in webparts)
		{

			// check if the webpart is a Provider webpart
			provColl = manager.GetProviderConnectionPoints(providerPart);
			if (provColl != null &amp;&amp; provColl.Default != null)
			{

				// walk through all the webparts on the page again now to find the consumer webparts
				foreach (System.Web.UI.WebControls.WebParts.WebPart consumerPart in webparts)
				{

					// first make sure the webpart isn't the provider webpart
					if (consumerPart != providerPart)
					{
						// check if the webpart is a Consumer webpart,
						// then make sure the consumer webpart isn't already connected to the provider webpart
						// then check if the interface of the consumer webpart is assignable from the interface of the provider webpart
						consColl = manager.GetConsumerConnectionPoints(consumerPart);
						if (consColl != null &amp;&amp; consColl.Default != null
							&amp;&amp; !WebPartConnectionExist(manager.SPWebPartConnections, providerPart, consumerPart)
							&amp;&amp; consColl.Default.InterfaceType.IsAssignableFrom(provColl.Default.InterfaceType))
						{
							// connect the webparts
							manager.SPConnectWebParts(providerPart, provColl.Default, consumerPart, consColl.Default);
							connectionMade = true;
						}
					}
				}
			}
		}
	}
	return connectionMade;
}
</pre>
<p><strong>Sample usage (console application)</strong></p>
<pre class="brush: csharp;">
try
{
	using (SPSite site = new SPSite(&quot;http://localhost&quot;))
	using (SPWeb web = site.OpenWeb())
	{
		ConnectWebPartsOnPage(web, &quot;pages/default.aspx&quot;, false);
	}
}
catch (Exception ex)
{
	Console.WriteLine();
	Console.WriteLine(&quot;Message:\n{0}\n\nStack:\n{1}\n\n&quot;, ex.Message, ex.StackTrace);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/automatically-connect-webparts-on-sharepoint-page/201/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>First NEN 2082 certified project with SharePoint 2010</title>
		<link>http://blog.thumnet.com/first-nen2082-certified-project-sharepoint-2010/180/</link>
		<comments>http://blog.thumnet.com/first-nen2082-certified-project-sharepoint-2010/180/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 15:01:39 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[nen2082]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[sharepoint2010]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=180</guid>
		<description><![CDATA[Together with 3 colleagues from QNH Business Integration I am currently finishing implementing a already NEN 2082 certified project based on SharePoint 2010. When SharePoint 2010 hits RTM there will be another audit for this version of SharePoint, because currently the pre release version has been certified. NEN 2082 is a Dutch standard which is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="QNH" src="http://www.qnh.eu/images/stories/logos/qnhLogo.png" alt="" width="190" height="65" /><br />
Together with 3 colleagues from QNH Business Integration I am currently finishing implementing a already NEN 2082 certified project based on SharePoint 2010.<br />
When SharePoint 2010 hits RTM there will be another audit for this version of SharePoint, because currently the pre release version has been certified.</p>
<p>NEN 2082 is a Dutch standard which is similar the DoD5015 and MoReq standards. </p>
<p>This project was done for the Gemeente Nieuwegein, which is a Dutch local Government.</p>
<div id="attachment_181" class="wp-caption aligncenter" style="width: 130px"><a href="http://blog.thumnet.com/wp-content/uploads/2010/03/NieuwegeinLogo.png" rel="lightbox[180]"><img class="size-full wp-image-181" title="Nieuwegein Logo" src="http://blog.thumnet.com/wp-content/uploads/2010/03/NieuwegeinLogo.png" alt="" width="120" height="120" /></a><p class="wp-caption-text">Gemeente Nieuwegein</p></div>
<p>For this project we have also been nominated for the &#8220;Innovation of the year&#8221; award:</p>
<div id="attachment_182" class="wp-caption aligncenter" style="width: 235px"><a href="http://blog.thumnet.com/wp-content/uploads/2010/03/lrg-partner-award-2010.jpg" rel="lightbox[180]"><img class="size-medium wp-image-182" title="LRG Innovator Nomination 2010" src="http://blog.thumnet.com/wp-content/uploads/2010/03/lrg-partner-award-2010-225x300.jpg" alt="" width="225" height="300" /></a><p class="wp-caption-text">LRG Innovator Nomination 2010</p></div>
<p><a href="http://www.qnh.eu/actueel/210-qnh-implementeert-als-eerste-dmsrma-met-sharepoint-2010-conform-nen2082">More information</a> (Dutch)</p>
<p>My colleagues at QNH:</p>
<ul>
<li>Jeroer Derde &#8211; <a href="http://derde.net/blog">http://derde.net/blog</a></li>
<li>Alexander Ketelaar &#8211; <a href="http://sharepoint2010.nl">http://sharepoint2010.nl</a></li>
<li>Robert Sep</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/first-nen2082-certified-project-sharepoint-2010/180/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem with VS2010 beta 2 Site Definition</title>
		<link>http://blog.thumnet.com/problem-vs2010-beta2-sitedefinition/159/</link>
		<comments>http://blog.thumnet.com/problem-vs2010-beta2-sitedefinition/159/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 10:40:23 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[site-definition]]></category>
		<category><![CDATA[visualstudio2010]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=159</guid>
		<description><![CDATA[I encountered the following problem while creating a new custom Site Definition in Visual Studio 2010 beta 2. The problem occurs when trying to create a new Document Library in the site based on the custom Site Definition. Error message: Error An error occurred while getting items from the &#34;&#34; provider: Cannot complete this action. Please try [...]]]></description>
			<content:encoded><![CDATA[<p>I encountered the following problem while creating a new custom Site Definition in Visual Studio 2010 beta 2.</p>
<p>The problem occurs when trying to create a new Document Library in the site based on the custom Site Definition.</p>
<div id="attachment_164" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.thumnet.com/wp-content/uploads/2009/12/00-error-while-creating-document-library.png" rel="lightbox[159]"><img class="size-medium wp-image-164" title="00-error-while-creating-document-library" src="http://blog.thumnet.com/wp-content/uploads/2009/12/00-error-while-creating-document-library-300x188.png" alt="Error while trying to add a new Document Library" width="300" height="188" /></a><p class="wp-caption-text">Error while trying to add a new Document Library</p></div>
<p><strong>Error message:</strong></p>
<pre class="brush: plain;">
Error

An error occurred while getting items from the &quot;&quot; provider:
Cannot complete this action.

Please try again.
</pre>
<p><em>Read on to see the solution for this error.</em></p>
<p>Visual Studio 2010 now has native integration of SharePoint 2010 projects.</p>
<div id="attachment_160" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.thumnet.com/wp-content/uploads/2009/12/01-new-site-definition-in-vs2010.png" rel="lightbox[159]"><img class="size-medium wp-image-160" title="01-new-site-definition-in-vs2010" src="http://blog.thumnet.com/wp-content/uploads/2009/12/01-new-site-definition-in-vs2010-300x168.png" alt="New Site Definition in Visual Studio 2010" width="300" height="168" /></a><p class="wp-caption-text">New Site Definition in Visual Studio 2010</p></div>
<p>After creating the new Site Definition Project in the <strong>onet.xml</strong> file<strong> </strong>contains the following:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Project Title=&quot;SampleSiteDefinition&quot; Revision=&quot;2&quot; ListDir=&quot;&quot; xmlns:ows=&quot;Microsoft SharePoint&quot; xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;NavBars&gt;
  &lt;/NavBars&gt;
  &lt;Configurations&gt;
    &lt;Configuration ID=&quot;0&quot; Name=&quot;SampleSiteDefinition&quot;&gt;
      &lt;Lists/&gt;
      &lt;SiteFeatures&gt;
      &lt;/SiteFeatures&gt;
      &lt;WebFeatures&gt;
      &lt;/WebFeatures&gt;
      &lt;Modules&gt;
        &lt;Module Name=&quot;DefaultBlank&quot; /&gt;
      &lt;/Modules&gt;
    &lt;/Configuration&gt;
  &lt;/Configurations&gt;
  &lt;Modules&gt;
    &lt;Module Name=&quot;DefaultBlank&quot; Url=&quot;&quot; Path=&quot;&quot;&gt;
      &lt;File Url=&quot;default.aspx&quot;&gt;
      &lt;/File&gt;
    &lt;/Module&gt;
  &lt;/Modules&gt;
&lt;/Project&gt;
</pre>
<p><em>Now you can modify to the onet.xml and default.aspx as you like. </em></p>
<p>When deploying the new Site Definition, creating a site, and then trying to create a new Document Library you get the error above.  The solution for the error turned out to be the <strong>missing </strong>declaration of the <strong>&lt;DocumentTemplates&gt;</strong> XML node.</p>
<p>Correct default <strong>onet.xml</strong> should be:</p>
<pre class="brush: xml; highlight: [5,6];">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Project Title=&quot;SampleSiteDefinition&quot; Revision=&quot;2&quot; ListDir=&quot;&quot; xmlns:ows=&quot;Microsoft SharePoint&quot; xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;NavBars&gt;
  &lt;/NavBars&gt;
  &lt;DocumentTemplates&gt;
  &lt;/DocumentTemplates&gt;
  &lt;Configurations&gt;
      &lt;Lists/&gt;
      &lt;SiteFeatures&gt;
      &lt;/SiteFeatures&gt;
      &lt;WebFeatures&gt;
      &lt;/WebFeatures&gt;
      &lt;Modules&gt;
        &lt;Module Name=&quot;DefaultBlank&quot; /&gt;
      &lt;/Modules&gt;
    &lt;/Configuration&gt;
  &lt;/Configurations&gt;
  &lt;Modules&gt;
    &lt;Module Name=&quot;DefaultBlank&quot; Url=&quot;&quot; Path=&quot;&quot;&gt;
      &lt;File Url=&quot;default.aspx&quot;&gt;
      &lt;/File&gt;
    &lt;/Module&gt;
  &lt;/Modules&gt;
&lt;/Project&gt;
</pre>
<p>After re-deploying the Site Definition and creating a new Site, you are able to create a Document Library.</p>
<div id="attachment_170" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.thumnet.com/wp-content/uploads/2009/12/02-correctly-working-new-doclib-screen.png" rel="lightbox[159]"><img class="size-medium wp-image-170" title="02-correctly-working-new-doclib-screen" src="http://blog.thumnet.com/wp-content/uploads/2009/12/02-correctly-working-new-doclib-screen-300x188.png" alt="Working new Document Library" width="300" height="188" /></a><p class="wp-caption-text">Working new Document Library</p></div>
<h5>Reference:</h5>
<p><a href="http://msdn.microsoft.com/en-us/library/ms474369(office.14).aspx">Microsoft&#8217;s Reference for SharePoint 2010 onet.xml</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/problem-vs2010-beta2-sitedefinition/159/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Looking for SharePoint 2010 Feature (GU)IDs</title>
		<link>http://blog.thumnet.com/looking-for-sharepoint-2010-feature-guid/142/</link>
		<comments>http://blog.thumnet.com/looking-for-sharepoint-2010-feature-guid/142/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 17:23:29 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[feature-guid]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[site-definition]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=142</guid>
		<description><![CDATA[Have you ever been looking for a feature (GU)ID in SharePoint? Well here is an easy way to find them. I needed default SharePoint feature guids for the development of a custom Site Definition. Using a custom Site Definition you can automatically activate SharePoint features within the onet.xml file. Here we go: Open the SharePoint [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been looking for a feature (GU)ID in SharePoint? Well here is an easy way to find them.</p>
<p>I needed default SharePoint feature guids for the development of a custom Site Definition. Using a custom Site Definition you can automatically activate SharePoint features within the onet.xml file.</p>
<p>Here we go:</p>
<ol>
<li>Open the SharePoint site in IE8 (or IE7).</li>
<li style="text-align: left;">Go to the Site Settings page.<br />
<img class="size-full wp-image-143" title="site-settings-menu" src="http://blog.thumnet.com/wp-content/uploads/2009/12/site-settings-menu.jpg" alt="site-settings-menu" width="259" height="587" /></li>
<li>Click on the Manage Site features (or Site Collection features)<br />
<img class="alignnone size-full wp-image-144" title="site-features" src="http://blog.thumnet.com/wp-content/uploads/2009/12/site-features.jpg" alt="site-features" width="287" height="131" /></li>
<li>Use the Developer Tools (shortcut F12)</li>
<li>Click in the toolbar on Find &#8211;&gt; Select Element by Click (shortcut CTRL+B, but this opens bookmarks manager on my machine)<br />
<img class="alignnone size-full wp-image-145" title="developertools-select" src="http://blog.thumnet.com/wp-content/uploads/2009/12/developertools-select.jpg" alt="developertools-select" width="393" height="168" /></li>
<li>Select the Activate (or Deactivate) button next to the feature you need the GUID from.<br />
<img class="alignnone size-full wp-image-147" title="select-feature-activate-button" src="http://blog.thumnet.com/wp-content/uploads/2009/12/select-feature-activate-button.jpg" alt="select-feature-activate-button" width="748" height="84" /></li>
<li>Developer Tools scrolls down to the HTML source for the specific button, the button tag is contained within a Div tag. This Div tag contains an ID attribute and thats the GUID for the feature!<br />
<img class="alignnone size-full wp-image-148" title="selected-feature-html" src="http://blog.thumnet.com/wp-content/uploads/2009/12/selected-feature-html.jpg" alt="selected-feature-html" width="502" height="213" /></li>
<li>In this case the GUID is: <strong>9c03e124-eef7-4dc6-b5eb-86ccd207cb87</strong><br />
<img class="alignnone size-full wp-image-149" title="selected-feature-guid" src="http://blog.thumnet.com/wp-content/uploads/2009/12/selected-feature-guid.jpg" alt="selected-feature-guid" width="492" height="145" /></li>
</ol>
<p>This trick also works for SharePoint 2007!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/looking-for-sharepoint-2010-feature-guid/142/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# 4.0 .NET becomes dynamic</title>
		<link>http://blog.thumnet.com/csharp4-dotnet-becomes-dynamic/73/</link>
		<comments>http://blog.thumnet.com/csharp4-dotnet-becomes-dynamic/73/#comments</comments>
		<pubDate>Fri, 29 May 2009 17:09:23 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[DevDays09]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[qnh]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=73</guid>
		<description><![CDATA[This post is about the session called C# 4.0 / The Future of C# given by Krishnan Subramanian. First off let me start with a quick summary of main new feauture for the different versions of the C# that are released. C# 1.0, Managed code C# 2.0, Generics C# 3.0, Language Integrated Query, short LINQ [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about the session called <strong>C# 4.0 / The Future of C#</strong> given by Krishnan Subramanian.</p>
<p><img src="http://blog.thumnet.com/wp-content/uploads/2009/05/csharp41.png" alt="csharp4-dlr" width="464" height="300" /></p>
<p>First off let me start with a quick summary of main new feauture for the different versions of the C# that are released.</p>
<ul>
<li>C# 1.0, Managed code</li>
<li>C# 2.0, Generics</li>
<li>C# 3.0, Language Integrated Query, short LINQ</li>
<li>C# 4.0, Dynamic programming</li>
</ul>
<p>Some off the innovation for C# 4.0 are:</p>
<p><strong>Dynamic Language Runtime</strong><br />
The new version of C# has a new type of object declaration, called <code>dynamic</code>. This looks a bit the <code>var</code> keyword. With the var keyword the compiler replaced the var with the object type on compile time, intellisense and code completion still was available in Visual Studio. With the new dynamic keyword the compiler doesn&#8217;t replace this and even more important the compiler can&#8217;t check for syntax error on a dynamic object. Intellisense and code complition are also not available for objects defined with dynamic.</p>
<p>Dynamic objects are losely typed instead of strongly. </p>
<p>After reading this you might think whats the use of this new DLR, in the following sample I&#8217;ll try to explain this. We have a simple C# class called Calculator, and use it like below.</p>
<pre class="brush: csharp;">
Calculator calc = GetCalculator();
int sum = calc.Add(10, 20);
</pre>
<p>Now suppose the calculator class is not strongly typed, the code would like something like the following</p>
<pre class="brush: csharp;">
object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember(&quot;Add&quot;, BindingFlags.InvokeMethod, null, new object[] { 10, 20 });
int sum = Convert.ToInt32(res);
</pre>
<p>With the new dynamic keyword in C# 4.0 it would simply be</p>
<pre class="brush: csharp;">
dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);
</pre>
<p><strong>Optional Named Parameters</strong><br />
To show you the what this means take a look at the examples below.</p>
<p>In previous version of C# method overloads would be used.</p>
<pre class="brush: csharp;">
public void Add(string lineOfText);
public void Add(string lineOfText, bool isError);
public void Add(string lineOfText, int repeat);
public void Add(string lineOfText, int repeat, bool isError);
</pre>
<p>With the new C# 4.0, the method declaration would like this</p>
<pre class="brush: csharp;">
public void Add(string lineOfText, int repeat = 1, bool isError = false);
</pre>
<p>As you can see in the sample above, it&#8217;s now possible to specify default values for a method parameter. Some samples of how to use the Add method are:</p>
<pre class="brush: csharp;">
Add(&quot;This is the line&quot;, repeat : 5);
Add(isError : true, lineOfText : &quot;Another line of text&quot;);
</pre>
<p>For people using JavaScript this might look very familiar.</p>
<p>Another cewl new thing I saw at the demo, was the ability to interpret and compile a string of C# code at runtime. This functionality offers some great new possibilities. Again for the Javascript people reading this it&#8217;s like the <code>eval</code> function.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/csharp4-dotnet-becomes-dynamic/73/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 3 Validation and Dataform control</title>
		<link>http://blog.thumnet.com/silverlight-3-validation-dataform-control/66/</link>
		<comments>http://blog.thumnet.com/silverlight-3-validation-dataform-control/66/#comments</comments>
		<pubDate>Thu, 28 May 2009 21:48:02 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[DevDays09]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[silverlight3]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=66</guid>
		<description><![CDATA[This post is about the session calledWhat’s new in Silverlight 3 given by Mike Taulty. Silverlight 3 has a new way for validating data. The validation rules can be set in a number of different ways: Throwing an exception Adding specific attributes to the classes properties I specifically like the way the business rules can [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about the session called<strong>What’s new in Silverlight 3</strong> given by Mike Taulty.</p>
<p>Silverlight 3 has a new way for validating data. The validation rules can be set in a number of different ways:</p>
<ul>
<li>Throwing an exception</li>
<li>Adding specific attributes to the classes properties</li>
</ul>
<p>I specifically like the way the business rules can be applied to an object. Some samples of specifying the validation are shown below.</p>
<pre class="brush: csharp;">
class Person
{
[Required(ErrorMessage = “The name of the person is required”)]
public string Name { get; set; }

[Range(18, 65, ErrorMessage = ”The person must be between 18 and 65 years old”)]
[DefaultValue(20)]
public int Age { get; set; }
}
</pre>
<p>More validation attributes are available at <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.aspx">MSDN</a></p>
<p>The nice thing about the new version of Silverlight 3 is that the default input controls can handle these validation errors and show them to the user, this is very similar to the way we know validation controls in ASP.NET. The way in which these messages are shown is fully customizable through themes.</p>
<p><img class="aligncenter size-full wp-image-67" src="http://blog.thumnet.com/wp-content/uploads/2009/05/sl3_dataform.png" alt="sl3_dataform" width="605" height="292" /></p>
<p>The screenshot above shows an example of the new Dataform which is also available in Silverlight 3. It also gives you an example of the standard way a user is informed about errors.</p>
<p>With the new Dataform control it is possible to automatically render the CRUD GUI for an object or list of objects.</p>
<p>By implementing the IEditableObject interface for an object, the following events can be handled within the class: BeginEdit, CancelEdit and EndEdit</p>
<p>For more information about the Dataform control see the <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/03/18/a-quick-look-at-silverlight-3-dataform-control.aspx">following blog</a> post of Mike Taulty, another post by Mike Taulty is <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/03/18/a-quick-look-at-silverlight-3-data-validation.aspx">about data validation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/silverlight-3-validation-dataform-control/66/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New features in ASP.NET AJAX 4.0</title>
		<link>http://blog.thumnet.com/new-features-aspnet-ajax-4/44/</link>
		<comments>http://blog.thumnet.com/new-features-aspnet-ajax-4/44/#comments</comments>
		<pubDate>Thu, 28 May 2009 21:21:43 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[DevDays09]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[aspnet]]></category>
		<category><![CDATA[qnh]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=44</guid>
		<description><![CDATA[This post is about the session called ASP.NET AJAX 4.0 given by Fritz Onion A preview of the new version of ASP.NET AJAX is avaible on codeplex since the 28th of May. And it can be used within Visual Studio 2008. This version mainly focuses on new client side features, some of these are be [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about the session called <strong>ASP.NET AJAX 4.0</strong> given by Fritz Onion</p>
<p>A preview of the new version of ASP.NET AJAX is avaible on <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24645" title="download link">codeplex</a> since the 28th of May. And it can be used within Visual Studio 2008.
<p>This version mainly focuses on new client side features, some of these are be discussed below.</p>
<p>
	<strong>Live data binding</strong><br />
	Gives the developer an easy way to bind multiple controls to a single datasource, if a value changes all controls are automatically updated client side.
</p>
<p>
	<strong>Observer pattern</strong><br />
	This provides observer functionality to ordinary JavaScript objects, when a change occurs for an  observed object a notification is caused, which can be handled accordingly
</p>
<p>
	<strong>Client templates</strong><br />
	In an asp.net web application a list of data can be shown using a Repeater control, which is server sided. In 4.0 this can be done client sided as well. The way to define this is by using a XHTML compliant template, as shown below.</p>
<pre class="brush: xml;">
	&lt;table id=&quot;resultTable&quot; class=&quot;sys-template&quot;&gt;
		&lt;tr&gt;
			&lt;td&gt;{{Name}}&lt;/td&gt;
			&lt;td&gt;{{Id}}&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
	</pre>
<p>
	This type of databinding notation is similar to Silverlight/WPF.
	</p>
<p>
	<strong>Inclusion of and support for jQuery library</strong><br />
	The development team at Microsoft has acknowledged the use of the jQuery library and it will be included in the next release
</p>
<p>
	<strong>Web service invocation</strong><br />
	It is now easy to invoke a method of a WCF service. A downside is that the service must support JSON serialization and AJAX proxy generation, by default this is possible with WCF services.
</p>
<p>Some nice new features the development team is working on are:</p>
<ul>
<li>Client sided sorting, pagination and filtering</li>
<li>Sending changes to the server</li>
<li>AJAX Control Toolkit will get rolled into the core release (previously this was a separate download)</li>
</ul>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/new-features-aspnet-ajax-4/44/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QNH at Microsoft DevDays09</title>
		<link>http://blog.thumnet.com/qnh-at-microsoft-devdays09/14/</link>
		<comments>http://blog.thumnet.com/qnh-at-microsoft-devdays09/14/#comments</comments>
		<pubDate>Mon, 25 May 2009 15:14:04 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[DevDays09]]></category>
		<category><![CDATA[qnh]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=14</guid>
		<description><![CDATA[On the 28st and 29nd of May 2009 (upcomming thursday and friday), Laurens &#8216;t Hardt and me (Jeffrey Tummers) are going to the Microsoft DevDays &#8217;09. The trip is sponsored by our employee QNH, on the days of the event we will be posting several blogposts on this site. Be sure to check the new [...]]]></description>
			<content:encoded><![CDATA[<p>On the 28st and 29nd of May 2009 (upcomming thursday and friday), Laurens &#8216;t Hardt and me (Jeffrey Tummers) are going to the <a title="Microsoft DevDays 09" href="http://www.devdays.nl/">Microsoft DevDays &#8217;09</a>.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-26" src="http://blog.thumnet.com/wp-content/uploads/2009/05/devdays09_-qnh_logo.jpg" alt="QNH @ DevDay09" width="555" height="95" /></p>
<p>The trip is sponsored by our employee <a title="QNH Business Integration" href="http://www.qnh.eu">QNH</a>, on the days of the event we will be posting several blogposts on this site. Be sure to check the new posts <a title="Posts on DevDays09" href="http://blog.thumnet.com/category/devdays09">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/qnh-at-microsoft-devdays09/14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
