<?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>techBox</title>
	<atom:link href="http://www.thegecko.org/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thegecko.org</link>
	<description>Buggies, tech and programming...</description>
	<lastBuildDate>Tue, 01 Jun 2010 21:09:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pluggable MVC 2.0 using MEF and strongly-typed views</title>
		<link>http://www.thegecko.org/index.php/2010/06/pluggable-mvc-2-0-using-mef-and-strongly-typed-views/</link>
		<comments>http://www.thegecko.org/index.php/2010/06/pluggable-mvc-2-0-using-mef-and-strongly-typed-views/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:09:23 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MEF]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.thegecko.org/?p=355</guid>
		<description><![CDATA[The problem&#8230;
I&#8217;ve been putting together a pluggable MVC framework using MEF in C# 4.0.
MEF was chosen over other solutions such as Portable Areas as it allows all plugins to be composed together as a single site at runtime without the assemblies needing to reference each other.
After scouring the web for ideas, I stumbled upon Maarten [...]]]></description>
			<content:encoded><![CDATA[<h2>The problem&#8230;</h2>
<p>I&#8217;ve been putting together a pluggable MVC framework using MEF in C# 4.0.</p>
<p>MEF was chosen over other solutions such as <a title="Portable Areas" href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx">Portable Areas</a> as it allows all plugins to be composed together as a single site at runtime without the assemblies needing to reference each other.</p>
<p>After scouring the web for ideas, I stumbled upon Maarten Balliauw&#8217;s excellent posts for accomplishing this task:</p>
<p><a title="ASP.NET MVC and the Managed Extensibility Framework (MEF)" href="http://blog.maartenballiauw.be/post/2009/04/21/ASPNET-MVC-and-the-Managed-Extensibility-Framework-%28MEF%29.aspx">ASP.NET MVC and the Managed Extensibility Framework (MEF)</a></p>
<p><a title="Revised: ASP.NET MVC and the Managed Extensibility Framework (MEF)" href="http://blog.maartenballiauw.be/post/2009/06/17/Revised-ASPNET-MVC-and-the-Managed-Extensibility-Framework-%28MEF%29.aspx">Revised: ASP.NET MVC and the Managed Extensibility Framework (MEF)</a></p>
<p>It seems that there are issues using strongly-typed views in this scenario, though, as the types referenced in the views are not found or loaded at runtime. Maarten&#8217;s solution is to copy the plugins into the main website&#8217;s bin directory so that they can be discovered at runtime.</p>
<h2>The solution&#8230;</h2>
<p>This can also be solved in another (more elegant?) way by using AssemblyResolve to tell the framework where to load a type from when it is requested by the views.<br />
In this way, your plugin directory needn&#8217;t be a sub-directory of the website&#8217;s bin folder.</p>
<p>Unfortunately, this doesn&#8217;t work without a bit of fettling and the key to getting it working is to give the framework a hint to the assembly the type is in. This in turn forces the AssemblyResolve event to fire. To accomplish this, use an assembly directive at the top of your strongly-typed views as follows:</p>
<pre class="brush: csharp;">
&lt;%@ Assembly Name=&quot;Web.Plugins.Controls&quot; %&gt;
&lt;%@ Control Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewUserControl&lt;Web.Plugins.Controls.Models.MenuModel&gt;&quot; %&gt;
</pre>
<p>An example of using AssemblyResolve by David Morton can be found here:</p>
<p><a title="Assembly Resolution with AppDomain.AssemblyResolve" href="http://blog.codinglight.com/2009/07/assembly-resolution-with.html">Assembly Resolution with AppDomain.AssemblyResolve</a></p>
<p>Which can be bent to our will:</p>
<pre class="brush: csharp;">
public void Initialize()
{
	// Add assembly handler for strongly-typed view models
	AppDomain.CurrentDomain.AssemblyResolve += PluginAssemblyResolve;
}

private Assembly PluginAssemblyResolve(object sender, ResolveEventArgs resolveArgs)
{
	Assembly[] currentAssemblies = AppDomain.CurrentDomain.GetAssemblies();

	// Check we don't already have the assembly loaded
	foreach (Assembly assembly in currentAssemblies)
	{
		if (assembly.FullName == resolveArgs.Name || assembly.GetName().Name == resolveArgs.Name)
		{
			return assembly;
		}
	}

	// Load from directory
	return LoadAssemblyFromPath(resolveArgs.Name, _fullPluginPath);
}

private static Assembly LoadAssemblyFromPath(string assemblyName, string directoryPath)
{
	foreach (string file in Directory.GetFiles(directoryPath))
	{
		Assembly assembly;

		if (TryLoadAssemblyFromFile(file, assemblyName, out assembly))
		{
			return assembly;
		}
	}

	return null;
}

private static bool TryLoadAssemblyFromFile(string file, string assemblyName, out Assembly assembly)
{
	try
	{
		// Convert the filename into an absolute file name for
		// use with LoadFile.
		file = new FileInfo(file).FullName;

		if (AssemblyName.GetAssemblyName(file).Name == assemblyName)
		{
			assembly = Assembly.LoadFile(file);
			return true;
		}
	}
	catch
	{
	}

	assembly = null;
	return false;
}
</pre>
<h2>The download&#8230;</h2>
<p><a title="Download example" href="http://www.thegecko.org/uploads/MefMvc.zip">http://www.thegecko.org/uploads/MefMvc.zip</a></p>
<p>This is an example framework based on Maarten&#8217;s using this method. It requires C# 4.0 and Visual Studio 2010 and it is recommended to run without debugging to avoid slow execution when view caching is disabled (<a title="Don't Panic!" href="http://codeclimber.net.nz/archive/2009/04/22/how-to-improve-htmlhelper.renderpartial-performances-donrsquot-run-in-debug-mode.aspx">Don&#8217;t Panic</a>).</p>
<p>The sample framework includes the following functionality:</p>
<ul>
<li> Embedded resources handling</li>
<li>Plugin registration priority for selecting controllers and views</li>
<li>Menu and menu item registration with ordering</li>
<li>Sample authentication module</li>
<li>Automatic site.master resolving</li>
</ul>
<p>The resource handling is borrowed from the Spark view engine sample modules:</p>
<p><a title="Spark modules" href="http://github.com/loudej/spark/tree/cb60a413bf72dfd0bc7cf7bd6b6a111a8ea2ab63/src/Samples/Modules/Spark.Modules">Spark modules</a></p>
<p>This should serve as a nice starting point for your next MVC pluggable project <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2010/06/pluggable-mvc-2-0-using-mef-and-strongly-typed-views/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>BunnyBot version 1.0.1 released!</title>
		<link>http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-1-released/</link>
		<comments>http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-1-released/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 10:24:01 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[bunny]]></category>
		<category><![CDATA[msn]]></category>
		<category><![CDATA[nabaztag]]></category>

		<guid isPermaLink="false">http://www.thegecko.org/?p=350</guid>
		<description><![CDATA[Hot on the heels of my recent announcement for version 1.0.0, version 1.0.1 has been released.
This includes a minor update which automatically adds any new contacts to the nabaztag MSN contact list.
Enjoy!
http://code.google.com/p/bunnybot/
]]></description>
			<content:encoded><![CDATA[<p>Hot on the heels of my recent <a href="http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-0-released/">announcement for version 1.0.0</a>, version 1.0.1 has been released.</p>
<p>This includes a minor update which automatically adds any new contacts to the nabaztag MSN contact list.</p>
<p>Enjoy!</p>
<p><a href="http://code.google.com/p/bunnybot/">http://code.google.com/p/bunnybot/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BunnyBot version 1.0.0 released!</title>
		<link>http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-0-released/</link>
		<comments>http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-0-released/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 19:15:42 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[bunny]]></category>
		<category><![CDATA[msn]]></category>
		<category><![CDATA[nabaztag]]></category>

		<guid isPermaLink="false">http://www.thegecko.org/?p=346</guid>
		<description><![CDATA[
I have just released version 1.0.0 of my current pet project, BunnyBot.
This C#/.Net project is a windows service or console applicatrion which logs your nabaztag bunny into an MSN account whenever it is awake. Any messages sent to the MSN account is spoken by the bunny.
To download the binaries, jump over to:
http://code.google.com/p/bunnybot/
]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-thumbnail wp-image-347" title="nabaztag" src="http://www.thegecko.org/wp-content/uploads/2010/01/nabaztag-150x150.jpg" alt="nabaztag" width="150" height="150" /></p>
<p>I have just released version 1.0.0 of my current pet project, BunnyBot.<br />
This C#/.Net project is a windows service or console applicatrion which logs your nabaztag bunny into an MSN account whenever it is awake. Any messages sent to the MSN account is spoken by the bunny.</p>
<p>To download the binaries, jump over to:</p>
<p><a href="http://code.google.com/p/bunnybot/">http://code.google.com/p/bunnybot/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2010/01/bunnybot-version-1-0-0-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New blog, content still lacking</title>
		<link>http://www.thegecko.org/index.php/2009/03/new-blog-content-still-lacking/</link>
		<comments>http://www.thegecko.org/index.php/2009/03/new-blog-content-still-lacking/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 18:46:56 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thegecko.org/wordpress/?p=246</guid>
		<description><![CDATA[I have finally switched to WordPress as I was sick of filtering through all the spam comments I was getting with myBloggie.
I chose WP so I don&#8217;t have to spend a lot of time designing the site as there are loads of great existing designs out there. I was halfway to implementing BlogEngine.Net but ran [...]]]></description>
			<content:encoded><![CDATA[<p>I have finally switched to WordPress as I was sick of filtering through all the spam comments I was getting with myBloggie.</p>
<p>I chose WP so I don&#8217;t have to spend a lot of time designing the site as there are loads of great existing designs out there. I was halfway to implementing BlogEngine.Net but ran out of time writing a decent theme.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2009/03/new-blog-content-still-lacking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nipples n stuff</title>
		<link>http://www.thegecko.org/index.php/2007/07/nipples-n-stuff/</link>
		<comments>http://www.thegecko.org/index.php/2007/07/nipples-n-stuff/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 21:35:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Buggy]]></category>
		<category><![CDATA[build]]></category>

		<guid isPermaLink="false">/post/2007/07/Nipples-n-stuff.aspx</guid>
		<description><![CDATA[        I dry-assembled the front suspension today to get the car rolling.
        Just need to mount the discs and wheels and that end is done.
        Had some fun with an angle grinder removing some [...]]]></description>
			<content:encoded><![CDATA[<p>        I dry-assembled the front suspension today to get the car rolling.<br />
        Just need to mount the discs and wheels and that end is done.</p>
<p>        Had some fun with an angle grinder removing some unwanted bits (included the front tow point) to make it fit correctly.</p>
<p>        I also found that the grease nipples on the beam are right in the way of the mounting brackets, but have been assured that the grease will stay in if they are removed <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>        I will be designing some sort of bonnet lifting mechanism in the coming weeks so watch this space for some more CAD drawings <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>        The work continues&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2007/07/nipples-n-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bought more bits</title>
		<link>http://www.thegecko.org/index.php/2007/05/bought-more-bits/</link>
		<comments>http://www.thegecko.org/index.php/2007/05/bought-more-bits/#comments</comments>
		<pubDate>Sun, 27 May 2007 12:37:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Buggy]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[lights]]></category>

		<guid isPermaLink="false">/post/2007/05/Bought-more-bits.aspx</guid>
		<description><![CDATA[        I have taken delivery of some new parts, some nice shiny 7&#8243; front lights and a brake master cylinder, both from http://www.coolairvw.co.uk/. Mmm free delivery  
        I&#8217;m also thinking about engines and have decided to build one from scratch [...]]]></description>
			<content:encoded><![CDATA[<p>        I have taken delivery of some new parts, some nice shiny 7&#8243; front lights and a brake master cylinder, both from <a href="http://www.coolairvw.co.uk/" target="_blank" class="postlink">http://www.coolairvw.co.uk/</a>. Mmm free delivery <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>        I&#8217;m also thinking about engines and have decided to build one from scratch using a custom kit from <a href="http://www.vwspeedshop.co.uk/" target="_blank" class="postlink">http://www.vwspeedshop.co.uk/</a>.</p>
<p>        Just finalising some details about the size of components to use to decide the overall engine capacity to end up with. At the moment it&#8217;s looking to be between 1776 and 2017 cc, but I need to investigate torque levels and power curves some more. <br />
        Any advice for something thats a bit beefy and has quick acceleration without going overboard (I like my gearbox unbroken), greatly received.</p>
<p>        Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2007/05/bought-more-bits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>French fibreglassing</title>
		<link>http://www.thegecko.org/index.php/2007/05/french-fibreglassing/</link>
		<comments>http://www.thegecko.org/index.php/2007/05/french-fibreglassing/#comments</comments>
		<pubDate>Thu, 03 May 2007 20:33:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Buggy]]></category>
		<category><![CDATA[bodyshell]]></category>

		<guid isPermaLink="false">/post/2007/05/French-fibreglassing.aspx</guid>
		<description><![CDATA[        Have today created a mould with Mel Hubbard to knock out some pods to house the rear lights. &#8216;Frenching&#8217; them in.
        Also created one pod and it&#8217;s perfect. Will be cutting it to size and begin chopping the rear of [...]]]></description>
			<content:encoded><![CDATA[<p>        Have today created a mould with Mel Hubbard to knock out some pods to house the rear lights. &#8216;Frenching&#8217; them in.</p>
<p>        Also created one pod and it&#8217;s perfect. Will be cutting it to size and begin chopping the rear of the buggy around to make them fit.<br />
        Also had a crash course in glassing and will be attacking the sidepods (blending them in) over the coming weeks. Work continues, if a bit slower than I&#8217;d hoped (darn bathroom:p).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2007/05/french-fibreglassing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New year, new parts</title>
		<link>http://www.thegecko.org/index.php/2007/03/new-year-new-parts/</link>
		<comments>http://www.thegecko.org/index.php/2007/03/new-year-new-parts/#comments</comments>
		<pubDate>Sun, 18 Mar 2007 15:54:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Buggy]]></category>
		<category><![CDATA[lights]]></category>

		<guid isPermaLink="false">/post/2007/03/New-year2c-new-parts.aspx</guid>
		<description><![CDATA[Well it&#8217;s another year and I&#8217;m starting to rekindle the buggy build.
I&#8217;ve been dreading venturing into the cold, windy garage, but bought some new parts to get me started again.
After much deliberation, I have chosen the rear lights and bought them (not nasty LED ones, either!).

Mmm, clear indicators.
I have also got some new wheel bearings [...]]]></description>
			<content:encoded><![CDATA[<p>Well it&#8217;s another year and I&#8217;m starting to rekindle the buggy build.<br />
I&#8217;ve been dreading venturing into the cold, windy garage, but bought some new parts to get me started again.</p>
<p>After much deliberation, I have chosen the rear lights and bought them (not nasty LED ones, either!).</p>
<p><img src="http://www.thegecko.org/wp-content/uploads/previous/rear_lights.jpg" alt="" width="400" height="300" /></p>
<p>Mmm, clear indicators.</p>
<p>I have also got some new wheel bearings and wheel bolts so I can eventually add the rims and get it all rolling. This will make working on it a lot easier as I will have more room wheeling it out of the garage.</p>
<p>A minor setback, though. The front discs have been drilled to fit the wheels (6 holes at 12mm diameter *just* fit!), but unfortunately the pitch was drilled to 1.75, not 1.5. More holes to follow <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2007/03/new-year-new-parts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The return</title>
		<link>http://www.thegecko.org/index.php/2006/08/the-return/</link>
		<comments>http://www.thegecko.org/index.php/2006/08/the-return/#comments</comments>
		<pubDate>Sun, 13 Aug 2006 10:40:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Buggy]]></category>
		<category><![CDATA[space frame]]></category>

		<guid isPermaLink="false">/post/2006/08/The-return.aspx</guid>
		<description><![CDATA[        Finally, I have taken delivery of the completed chassis (well hired a drop-side and driven 6 hours to pick it up  ).
        Now I have it all back, I&#8217;ll be concentrating on sorting out my A-B car (audi coupe [...]]]></description>
			<content:encoded><![CDATA[<p>        Finally, I have taken delivery of the completed chassis (well hired a drop-side and driven 6 hours to pick it up <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_eek.gif' alt='8O' class='wp-smiley' /> ).</p>
<p>        Now I have it all back, I&#8217;ll be concentrating on sorting out my A-B car (audi coupe quattro) for the next couple of Months (damn bushes!) before starting work on the buggy properly.</p>
<p>        Depending on the financial situation I&#8217;m hoping to get it to a rolling state before Christmas to be completed mid -2007, but I&#8217;ll keep you all posted!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2006/08/the-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arrival of seats</title>
		<link>http://www.thegecko.org/index.php/2006/05/arrival-of-seats/</link>
		<comments>http://www.thegecko.org/index.php/2006/05/arrival-of-seats/#comments</comments>
		<pubDate>Thu, 18 May 2006 10:33:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Buggy]]></category>
		<category><![CDATA[seats]]></category>

		<guid isPermaLink="false">/post/2006/05/Arrival-of-seats.aspx</guid>
		<description><![CDATA[Just a quick update for a few pictures of the seats I took delivery of today.
Very chuffed  

]]></description>
			<content:encoded><![CDATA[<p>Just a quick update for a few pictures of the seats I took delivery of today.</p>
<p>Very chuffed <img src='http://www.thegecko.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img src="http://www.thegecko.org/wp-content/uploads/previous/seats.jpg" alt="" width="511" height="300" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thegecko.org/index.php/2006/05/arrival-of-seats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
