<?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>Geospecialling &#187; Development</title>
	<atom:link href="http://www.geospecialling.com/index.php/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geospecialling.com</link>
	<description>Being a (G)IS Developer...</description>
	<lastBuildDate>Sun, 25 Jul 2010 05:15:41 +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>Creating .NET objects for Mapguide Enterprise 2011</title>
		<link>http://www.geospecialling.com/index.php/2010/07/creating-net-objects-for-mapguide-enterprise-2011/</link>
		<comments>http://www.geospecialling.com/index.php/2010/07/creating-net-objects-for-mapguide-enterprise-2011/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 05:15:41 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mapguide]]></category>
		<category><![CDATA[RADE]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Mapguide Enterprise]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/07/creating-net-objects-for-mapguide-enterprise-2011/</guid>
		<description><![CDATA[Better late than never…&#160; I’ve updated my Mapguide Enterprise .NET objects to work with 2011.&#160; The steps in my previous post for creating .NET objects for Mapguide Enterprise 2009&#160; have been modernized and simplified significantly.&#160;&#160; This post will show you how to create (or re-create) these objects for the 2011 release of Mapguide.&#160; Sorry for [...]]]></description>
			<content:encoded><![CDATA[<p>Better late than never…&#160; I’ve updated my <a title="Autodesk Mapguide" href="http://www.mapguide.com" target="_blank"></a><a title="Autodesk Mapguide Enterprise" href="http://www.mapguide.com" target="_blank">Mapguide Enterprise</a> .NET</a> objects to work with 2011.&#160; The steps in my <a title="Creating .NET objects for Mapguide XML schema definitions" href="http://www.webrade.com/blogs/darrin/2008/05/16/CreatingNETObjectsForMapguideXMLSchemaDefinitionsXSDUsingLINQ.aspx" target="_blank" rel="tag">previous post for creating .NET objects for Mapguide Enterprise 2009</a>&#160; have been modernized and simplified significantly.&#160;&#160; This post will show you how to create (or re-create) these objects for the 2011 release of Mapguide.&#160; Sorry for skipping 2010 =)</p>
<p>First, download the actual non-aplha release of <a title="LINQ to XSD" href="http://linqtoxsd.codeplex.com/releases/view/41258" target="_blank" rel="tag">LINQ to XSD</a> and extract it.&#160; You will need to have <a href="http://www.webrade.com/blogs/darrin/ct.ashx?id=f6d81338-14fd-4465-a8bd-8eeee747cdd4&amp;url=http%3a%2f%2fwww.microsoft.com%2fdownloads%2fdetails.aspx%3fFamilyID%3da45f58cd-fcfc-439e-b735-8182775560af%26displaylang%3den">.NET 3.5</a> installed to run LINQ to XSD.&#160; The project itself is a Visual Studio 2010, .NET 4.0 project.&#160; You should be able to change it to .NET 3.5 with no problems.&#160; I’m not sure about using .NET 2.0.&#160;&#160; I still assume these steps should work with <a title="Mapguide Open Source" href="http://mapguide.osgeo.org" target="_blank">Mapguide Open Source</a> 2.2 given its pretty much the same thing as MGE 2011.&#160; Please let me know if you try it and that is not the case.</p>
<h3>Building the classes</h3>
<p>Last time around we had to mess around with Visual Studio projects, building temporary code, finding and extracting that code from temporary files.&#160; This time around, we’re given a nice little executable that can be run in a batch file.&#160;&#160; I’ve posted a copy of my batch file below but it was simply made using a dir /b &gt; CreateMapguideNetObjects.cmd in the <a title="Autodesk Mapguide" href="http://www.mapguide.com" target="_blank">Mapguide</a> server schema folder (which by default is to c:\Program Files\Autodesk\MapGuideEnterprise2011\Server\Schema) .&#160; I then edited that file with a text editor that support macros and removed the following schema files:</p>
<ul>
<li>FdoProviderCapabilities-1.0.0.xsd </li>
<li>LoadProcedure-1.0.0.xsd </li>
<li>LoadProcedure-1.1.0.xsd </li>
<li>LayerDefinition-1.0.0.xsd </li>
<li>LayerDefinition-1.1.0.xsd </li>
<li>LayerDefinition-1.2.0.xsd </li>
<li>SiteInformation-1.0.0.xsd </li>
<li>SiteVersion-1.0.0.xsd </li>
<li>SymbolDefinition-1.0.0.xsd </li>
<li>WebLayout-1.0.0.xsd </li>
</ul>
<p>These files are deprecated object definitions from previous Mapguide releases.&#160; In the end each line in the batch file looks a little like this:</p>
<blockquote><p>LinqToXsd ApplicationDefinition-1.0.0.xsd /filename:ApplicationDefinition.cs</p>
</blockquote>
<p>Executing the batch file will create a number of C# files containing appropriately named classes.</p>
<h3>Setting up your project</h3>
<p>At this point you should be able to fire up Visual Studio and create a new C# project.&#160;&#160; If you have an existing project from a previous version of Mapguide its good to start fresh.&#160; Also, don’t try this in an existing solution that is dependant on the project that contains the Mapguide objects.&#160; This will just result in a bunch of extra screwing around to avoid compiler errors from missing code during the process.&#160;&#160;&#160; This time around its a lot easier.&#160; Create a new DLL project.&#160; Add a reference to the Xml.Schema.Linq.dll file that was included with LinqToXsd.exe.&#160;&#160; Add a reference to the following Mapguide dlls:</p>
<ul>
<li>OSGeo.Mapguide.Foundation</li>
<li>OSGeo.Mapguide.Geometry</li>
<li>OSGeo.Mapguide.MapguideCommon</li>
<li>OSGeo.Mapguide.PlatformBase</li>
<li>OSGeo.Mapguide.Web</li>
</ul>
<p>You’ll also need to ensure that the appropriate unmanaged assemblies are available in the calling applications bin folder when you go to run this stuff.&#160; </p>
<p>Next place all of the generated C# files in the new project.&#160; Once you build you’re going to see a ton of errors.&#160; We’ll clean those up.</p>
<p>To resolve a lot of these errors I did a global search and replace on “global::” and replaced it with nothing.&#160; Also, I wrapped each class in a unique wrapper classes to prevent duplicate type errors.&#160; Finally, the case issue with DataType was still an issue – and I resolved it by changing the case on DataType to be Datatype:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> DataType {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Datatype {</pre>
</p></div>
</div>
<p>For a complete view of the changes I made do a file compare between the code in the attached zip file and your newly generated code.</p>
<p>&lt;insert 3 week gap here, wherein I had <a title="Mapguide Enterprise 2011 installation and licensing fun" href="http://www.geospecialling.com/index.php/2010/07/mapguide-2011-javascript-error-openlayers-lang-is-null-or-not-an-object/" target="_blank" rel="tag">a hell of a time getting MGE 2011 installed and properly licensed</a> so that I could actually test this newly created code, oh and I also went on vacation for a few days too =)/&gt;</p>
<p>And back.&#160; The best part about this is that it seems ALL my old <a title="RADE" href="http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/" target="_blank" rel="tag">RADE</a> code just worked with upgraded basic layouts after changing it to look for the object definitions within the new wrapper classes.&#160;&#160; Now I just need to add support for flexible layouts and we’ll be laughing.</p>
<h3>The Code</h3>
<p>Please note – I didn’t rebase the code.&#160; It’s all in the RADE.MGE namespace.&#160; If you would like to use it, feel free to re-base it – or just leave it as is.&#160; Also, if you create any unit tests or enhancements and would like to share them – please feel free!&#160;&#160; </p>
<p>As I update the project myself, or receive updates I will update this file.</p>
<div class="wlWriterEditableSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:5b76b660-1647-415a-861e-ec611af03c8f" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p>Download the <a href="http://www.geospecialling.com/wp-content/uploads/2010/07/RADE.MGE_.2011.zip" target="_blank">Mapguide .NET Objects Visual Studio 2010 solution</a></p>
</div>
<p>.&#160;
<p>Finally, the <a title="Examples of using the Mapguide .NET objects" href="http://www.webrade.com/blogs/darrin/2008/05/21/DynamicAuthoringInMapguideEnterpriseBeforeTheViewerHasLoaded.aspx" target="_blank" rel="tag">example code I posted long ago</a> will still work with this new project.&#160; Perhaps one day, I’ll post some fancy new code in C# =) </p>
<p>Hope this comes in handy, I welcome your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/07/creating-net-objects-for-mapguide-enterprise-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Effortlessly map domain and DTO entities</title>
		<link>http://www.geospecialling.com/index.php/2010/06/effortlessly-map-domain-and-dto-entities/</link>
		<comments>http://www.geospecialling.com/index.php/2010/06/effortlessly-map-domain-and-dto-entities/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 04:19:19 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[DTO]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/06/effortlessly-map-domain-and-dto-entities/</guid>
		<description><![CDATA[I recently created a set of DTO objects to complement the domain entities we use for our data access layer for a new project we’re working on.&#160; I immediately set out to write a mapping utility.&#160; After a bit of thought pondering the complexity of the problem I decided to look around on the magical [...]]]></description>
			<content:encoded><![CDATA[<p>I recently created a set of <a title="data transfer object" href="http://en.wikipedia.org/wiki/Data_Transfer_Object" target="_blank" rel="tag">DTO</a> objects to complement the domain entities we use for our data access layer for a new project we’re working on.&#160; I immediately set out to write a mapping utility.&#160; After a bit of thought pondering the complexity of the problem I decided to look around on the magical internets to see what options were available.</p>
<p>Came across <a title="Automappper - convention-based object-object mapper" href="http://automapper.codeplex.com/" target="_blank" rel="tag">Automapper</a>.&#160;&#160; This is a perfect match for my needs:</p>
<blockquote><p>AutoMapper uses a fluent configuration API to define an object-object mapping strategy.&#160;&#160; AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.</p>
</blockquote>
<p>It was quick to setup, and painless to use.&#160; First define your object to object mappings:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> Mapper.CreateMap&lt;RADE.BO.Domain.Application, RADE.BO.Entity.Application&gt;();</pre>
</p></div>
</div>
<div>&#160;</div>
<div>Next, whip up a small conversion function:</div>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #008000">/// Convert a DTOApplication to abnd </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> <span style="color: #008000">/// &lt;param name=&quot;app&quot;&gt;&lt;/param&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span> <span style="color: #008000">/// &lt;returns&gt;&lt;/returns&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> RADE.BO.Domain.Application Convert(Application app)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>   <span style="color: #0000ff">if</span> (app == <span style="color: #0000ff">null</span>) <span style="color: #0000ff">return</span> <span style="color: #0000ff">null</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>   LoadDtoMappings();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>   <span style="color: #0000ff">return</span> AutoMapper.Mapper.Map&lt;Application, RADE.BO.Domain.Application&gt;(app);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span> }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>&#160; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span> <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span> <span style="color: #008000">/// Convert a list of domain Application objects to DTO Application objects</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span> <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span> <span style="color: #008000">/// &lt;param name=&quot;apps&quot;&gt;List of domain Application objects&lt;/param&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span> <span style="color: #008000">/// &lt;returns&gt;List of DTO Application objects&lt;/returns&gt;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> List&lt;Application&gt; Convert(List&lt;RADE.BO.Domain.Application&gt; apps)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>     LoadDtoMappings();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>     <span style="color: #0000ff">return</span> apps.Select(AutoMapper.Mapper.Map&lt;RADE.BO.Domain.Application, Application&gt;).ToList();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span> }</pre>
</p></div>
</div>
<p>It’s important to note that if your source object contains nested objects – a mapping for each nested object must also be defined.&#160; This goes on recursively through nested objects.&#160; My domain Application object contains some numerous sub objects – Map, Layer etc.&#160; In this case rather than establish mappings for these child objects – I removed these objects from my DTO as the client consuming these objects would never need that data.&#160; This also keeps the size of any data possibly being serialized down.&#160;&#160; Automapper dealt with this automatically.</p>
<p>I’ve only scratched the surface of what Automapper can do.&#160; Next step is to define unit test coverage using the <a title="Automapper configuration validation" href="http://automapper.codeplex.com/wikipage?title=Configuration%20Validation&amp;referringTitle=Home" target="_blank" rel="tag">configuration validation</a>, but it’s sleep time now… =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/06/effortlessly-map-domain-and-dto-entities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deployment project crashes on execution with .NET version error</title>
		<link>http://www.geospecialling.com/index.php/2010/04/deployment-project-crashes-on-execution-with-net-version-error/</link>
		<comments>http://www.geospecialling.com/index.php/2010/04/deployment-project-crashes-on-execution-with-net-version-error/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 20:47:58 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Installer]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/04/deployment-project-crashes-on-execution-with-net-version-error/</guid>
		<description><![CDATA[This week I jumped on the .NET 4 bandwagon.&#160; I had a proof of concept project that I wanted to bring up to the “real product” level.&#160;&#160; This new product consists of a console application, a windows service, and some business logic and data access assemblies.&#160; During the development of my proof I created a [...]]]></description>
			<content:encoded><![CDATA[<p>This week I jumped on the <a title=".NET 4.0 bandwagon" href="http://www.microsoft.com/visualstudio/en-us/" target="_blank" rel="tag">.NET 4</a> bandwagon.&#160; I had a proof of concept project that I wanted to bring up to the “real product” level.&#160;&#160; This new product consists of a console application, a windows service, and some business logic and data access assemblies.&#160; During the development of my proof I created a small deployment project to build a quick and dirty installer.&#160;&#160; </p>
<p>I’ve upgraded the solution to 2010.&#160; I’ve done all the refactoring and finished my work.&#160; Everything tests out great in both unit tests and “developers computer” tests.&#160; Just need to get the installer updated and get the pesky “other peoples computers” thing out of the way.&#160; </p>
<p>I’ve updated the pre-requisites on my installer to include .NET 4.0 – rebuilt the installer and boom.&#160; </p>
<blockquote><p>Error 1001.&#160; Exception occurred while initializing the installation.&#160; System.BadImageFormatException: Could not load file or assembly ‘file:///C:\Program Files\Landor\ … \RADE.Connect.Service.exe’ or one of its dependencies.&#160; This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.</p>
</blockquote>
<p>After much mucking around I found the hidden property that I needed to change.&#160; I needed to change the .NET version of the .NET Launch Condition.&#160; To find this gem right click on the deployment project in the solution explorer and choose View\Launch Conditions.&#160; Next right click on the “.NET Framework” under “Launch Conditions” and choose “properties”.&#160; In the properties dialog change the Version to be “.NET Framework 4”.</p>
<h4>Update 4/20/2010</h4>
<p>Don’t forget to edit the .NET version for both Release and Debug configurations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/04/deployment-project-crashes-on-execution-with-net-version-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 and .NET 4.0 Full available on MSDN!</title>
		<link>http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-and-net-4-0-full-available-on-msdn/</link>
		<comments>http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-and-net-4-0-full-available-on-msdn/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 16:06:51 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-and-net-4-0-full-available-on-msdn/</guid>
		<description><![CDATA[MSDN has been updated with the full releases of VS 2010 and .NET 4.0.&#160; Getting some decent download speeds too..
http://msdn.microsoft.com
wooo!
]]></description>
			<content:encoded><![CDATA[<p>MSDN has been updated with the full releases of VS 2010 and .NET 4.0.&#160; Getting some decent download speeds too..</p>
<p><a href="http://msdn.microsoft.com">http://msdn.microsoft.com</a></p>
<p>wooo!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-and-net-4-0-full-available-on-msdn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010, .NET 4.0, AND ReSharper 5.0 launch today!</title>
		<link>http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-net-4-0-and-resharper-5-0-launch-today/</link>
		<comments>http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-net-4-0-and-resharper-5-0-launch-today/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 14:32:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ReSharper]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-net-4-0-and-resharper-5-0-launch-today/</guid>
		<description><![CDATA[I may be weird, but I actually went to bed excited last night.&#160; VS 2010, .NET 4.0, AND Resharper 5.0 are supposed to be released today.&#160;&#160; For the first time in probably months I got out of bed at 7am -&#160; It’s now 7:30 Redmond time – but MSDN has not yet been updated!&#160; Apparently [...]]]></description>
			<content:encoded><![CDATA[<p>I may be weird, but I actually went to bed excited last night.&#160; VS 2010, .NET 4.0, AND <a title="Resharper 5.0" href="http://www.jetbrains.com/resharper/" target="_blank" rel="tag">Resharper 5.0</a> are supposed to be released today.&#160;&#160; For the first time in probably months I got out of bed at 7am -&#160; It’s now 7:30 Redmond time – but MSDN has not yet been updated!&#160; Apparently we have to wait until 8:30 Redmond time.&#160;&#160; Adobe is all over their release of CS5 today, and they didn’t make their users wait until 8:30 Redmond time! =) </p>
<p>In the meantime, The Register has a good write up on some of the <a title="Visual Studio 2010 goodies coming" href="http://www.theregister.co.uk/2010/04/12/visual_studio_2010_platform_challenge/" target="_blank" rel="tag">new goodies</a> coming in an hour or so.&#160; That will learn me for getting up early.&#160; Oh well, time for another <a title="mmmm mr. cappuccino how I love you..." href="http://www.healthycoder.com/index.php/2009/10/a-new-addiction-cappuccino/" target="_blank" rel="tag">cap</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/04/visual-studio-2010-net-4-0-and-resharper-5-0-launch-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate 2.1 throws System.InvalidCastException on Oracle 10g R1 client</title>
		<link>http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/</link>
		<comments>http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 21:52:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[nHibernate]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/</guid>
		<description><![CDATA[When deploying an early build of an up and coming product on a customers machine I came across the following error:
System.InvalidCastException: Unable to cast object of type &#8216;Oracle.DataAccess.Client.OracleConnection&#8217; to type &#8216;System.Data.Common.DbConnection&#8217; 
This was one of those awesome “doesn’t happen on any of my machine” errors.&#160; After some mucking around we determined that the client machine [...]]]></description>
			<content:encoded><![CDATA[<p>When deploying an early build of an up and coming product on a customers machine I came across the following error:</p>
<p><em>System.InvalidCastException: Unable to cast object of type &#8216;Oracle.DataAccess.Client.OracleConnection&#8217; to type &#8216;System.Data.Common.DbConnection&#8217; </em></p>
<p>This was one of those awesome “doesn’t happen on any of my machine” errors.&#160; After some mucking around we determined that the client machine was using the Oracle 10g&#160; R1 client.&#160; The machines and VMs here we used for testing were all running either 11g, or 10g R2.&#160; Doh!</p>
<p>The simple resolution to this was to modify the NHhibernate config and add the following property:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;hbm2ddl.keywords&quot;</span><span style="color: #0000ff">&gt;</span>none<span style="color: #0000ff">&lt;/</span><span style="color: #800000">property</span><span style="color: #0000ff">&gt;</span></pre>
</p></div>
</div>
<p>Depending on your underlying databases and mappings this could cause problems with your code project.&#160; Hopefully you’re not using reserved words, or bad Oracle syntax =).</p>
<p>Under the hood, the problem seems to be that the Oracle10gDialect does not provide an implementation of IDataBaseSchema for 10gR1.&#160;&#160; Fabio Maulo has provided some sample code and the steps on <a title="Create missing IDataBaseSchema for submission to NHibernate" href="http://fabiomaulo.blogspot.com/2009/06/from-where-start-to-implements.html" rel="tag">how to create the appropriate metadata</a> for your database and submit it to the NHibernate project for inclusion. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ReSharper 5.0 is coming!</title>
		<link>http://www.geospecialling.com/index.php/2010/04/resharper-5-0-is-coming/</link>
		<comments>http://www.geospecialling.com/index.php/2010/04/resharper-5-0-is-coming/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 23:29:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ReSharper]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/04/resharper-5-0-is-coming/</guid>
		<description><![CDATA[Ok, I’ve mentioned ReSharper in the past – but I had to bring it up again..&#160; Version 5 has some great new functionality and its coming soon!&#160; I’m especially excited about the huge functionality added for ASP.NET web development.&#160; I’ve been using the 5 beta and RC for probably a month or two and its [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I’ve <a title="Re-Sharper - A class creating machine" href="http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/" rel="tag">mentioned ReSharper</a> in the past – but I had to bring it up again..&#160; Version 5 has some great new functionality and its <a title="ReSharper 5 goes RC" href="http://blogs.jetbrains.com/dotnet/2010/03/resharper-50-goes-rc/" rel="tag">coming soon!</a>&#160; I’m especially excited about the huge <a title="ReSharper ASP.NET functionality" href="http://www.jetbrains.com/resharper/beta/beta.html#web_development" rel="tag">functionality added for ASP.NET</a> web development.&#160; I’ve been using the 5 beta and RC for probably a month or two and its great – I’ve been doing a metric butt-ton of refactoring and its great to have my changes go all the way into the .aspx files.&#160; </p>
<p>The NUnit test engine is great.&#160;&#160; I didn’t realize this was a ReSharper tool at first.&#160; Now, I can’t live without it.</p>
<p>The localization plugin is going to save me days of effort on an upcoming action item.&#160; </p>
<p>The class/code generating tools are indispensible – especially if you create a lot of classes (e.g NHibernate POCO’s). </p>
<p>The refactorings have been helping me slowly increase the legibility of my code – and also helping me build better coding habits.&#160; Check out the comparison between <a title="ReSharper 4.5 - 5.0 comparison" href="http://www.jetbrains.com/resharper/documentation/resharper5_vs_resharper45.html" rel="tag">version 5.0 and 4.5.</a></p>
<p>If you’ve never tried ReSharper – <a title="Try ReSharper" href="http://www.jetbrains.com/resharper/" rel="tag">now is the time.</a>&#160; only I could make the time to properly learn all the different tools available…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/04/resharper-5-0-is-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to NHibernate 2.1 for new Validators!</title>
		<link>http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/</link>
		<comments>http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 23:04:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[nHibernate]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/</guid>
		<description><![CDATA[I wanted to implemented the new NHibernate Validators which meant upgrading to NH 2.1.&#160;&#160; Found a great post documenting the new “breaking change” between 2.0 and 2.1 pertaining to the new proxy factory functionality in NH.&#160; “The ProxyFactoryFactory was not configured.” jumped up and bit me in the ass.&#160;&#160; 
NH used to assume Castle – [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to implemented the new <a title="NHibernate Validators" href="http://nhforge.org/wikis/validator/nhibernate-validator-1-0-0-documentation.aspx" rel="tag">NHibernate Validators</a> which meant upgrading to NH 2.1.&#160;&#160; Found a great post documenting the new “breaking change” between 2.0 and 2.1 pertaining to the new proxy factory functionality in NH.&#160; “The ProxyFactoryFactory was not configured.” jumped up and bit me in the ass.&#160;&#160; </p>
<p>NH used to assume Castle – but now it needs to be configured.&#160; In addition to the Castly proxy, there is a new LinFu proxy available too.&#160;&#160; <a title="Upgrading to NHibernate 2.1 - The ProxyFactoryFactory was not configured." href="http://davybrion.com/blog/2009/03/upgrading-to-nhibernate-21/" rel="tag">Don’t bother with NHibernate the release notes!</a> , Davy Brion has it all for you here =).&#160; </p>
<p>I opted to go with the Castly Dynamic Proxy – I’m not in a position to do any performance tests between– Castle has been around a long time and has a pretty big user base.&#160; Good <a title="Castly Dynamic Proxy vs LinFu" href="http://stackoverflow.com/questions/1406762/what-are-the-differences-between-linfu-dynamicproxy-and-castle-dynamicproxy" rel="tag">post on stackoverflow</a> on this subject.&#160; However, LinFu would have won if I was basing my choice on name alone…</p>
<p>After a bit of fiddling, I’m back up and running with NH 2.1 and shiny new validation attributes.&#160;&#160;&#160; </p>
<p>mmmm validation…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ReSharper 4.5 Released!</title>
		<link>http://www.geospecialling.com/index.php/2009/04/resharper-45-released/</link>
		<comments>http://www.geospecialling.com/index.php/2009/04/resharper-45-released/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 01:09:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ReSharper]]></category>

		<guid isPermaLink="false">http://www.landoris.com/blogs/darrin/index.php/2009/04/resharper-45-released/</guid>
		<description><![CDATA[JetBrains has just released ReSharper 4.5!&#160;&#160; Some of the key features of this upgrade are:

1. performance and memory usage improvements 
2. Solution-wide code inspections (tons of cool tools to find unused params, privates, etc) 
3. VB9 support (too bad I’ve been busy moving to C# =]) 
4. Native MSTest Support (I much prefer NUnit though) [...]]]></description>
			<content:encoded><![CDATA[<p>JetBrains has just released <a title="ReSharper 4.5 Released!" href="http://www.jetbrains.com/resharper/" target="_blank" rel="tag">ReSharper 4.5</a>!&#160;&#160; Some of the key features of this upgrade are:</p>
<ol>
<li>1. performance and memory usage improvements </li>
<li>2. Solution-wide code inspections (tons of cool tools to find unused params, privates, etc) </li>
<li>3. VB9 support (too bad I’ve been busy moving to C# =]) </li>
<li>4. Native MSTest Support (I much prefer <a title="NUnit - .NET Unit Testing" href="http://www.nunit.org/index.php" target="_blank" rel="tag">NUnit</a> though) </li>
</ol>
<p>&#160;</p>
<p>Check it out.&#160; ReSharper is one of the tools I use every day and couldn’t live without…One more day and I’ll be done in Visual Lisp and can actually try out the new release a little more =)</p>
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c19e754d-f489-4b40-b8e0-d62f44054fff" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/ReSharper" rel="tag">ReSharper</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2009/04/resharper-45-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Relative URLs in CSS with ASP.NET</title>
		<link>http://www.geospecialling.com/index.php/2009/04/using-relative-urls-in-css-with-aspnet/</link>
		<comments>http://www.geospecialling.com/index.php/2009/04/using-relative-urls-in-css-with-aspnet/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:42:23 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.landoris.com/blogs/darrin/index.php/2009/04/using-relative-urls-in-css-with-aspnet/</guid>
		<description><![CDATA[When we started redoing the company website I decided that this new site would be all CSS based.&#160; No more nasty tables.&#160;&#160; Once the initial xhtml/css template was made I moved it into and ASP.NET master page.&#160; As the site was fleshed out I ran into a problem where some of the images were not [...]]]></description>
			<content:encoded><![CDATA[<p>When we started redoing the <a title="Landor Information Systems" href="http://www.landorIS.com" target="_blank" rel="tag">company website</a> I decided that this new site would be all CSS based.&#160; No more nasty tables.&#160;&#160; Once the initial xhtml/css template was made I moved it into and ASP.NET master page.&#160; As the site was fleshed out I ran into a problem where some of the images were not loading as the master page was used deeper within the sites structure.&#160;&#160; A little inspection of the underlying CSS and I noticed this:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> #header {<span style="color: #0000ff">width</span>:<span style="color: #006080">100%;</span> <span style="color: #0000ff">height</span>:<span style="color: #006080">50px;</span>    <span style="color: #0000ff">background</span>: #7D7D7D url(images/header<span style="color: #cc6633">.gif</span>) <span style="color: #0000ff">left</span> <span style="color: #0000ff">top</span> no<span style="color: #006080">-repeat;</span>}</pre>
</p></div>
</div>
<p>&#160;</p>
<p>When the master page is used from a page deeper than the site root, the paths in the CSS become invalid.&#160; To work around this I made my CSS dynamic!&#160; I added a new page to my project in the CSS folder.&#160; I called this page allcss.aspx.css.&#160;&#160; Open up this new aspx file and remove all the html.&#160; Leave only the page header definition:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="background-color: #ffff00">&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;all.css.aspx.cs&quot; Inherits=&quot;landorIS.com.css.allcss&quot; ContentType=&quot;text/css&quot; %&gt;</span></pre>
</p></div>
</div>
<p><a href="http://www.landoris.com/blogs/darrin/wp-content/uploads/2009/04/image10.png"></a></p>
<p><a href="http://www.landoris.com/blogs/darrin/wp-content/uploads/2009/04/image10.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px" height="149" alt="image" src="http://www.landoris.com/blogs/darrin/wp-content/uploads/2009/04/image10-thumb.png" width="244" align="right" border="0" /></a></p>
<p>Note that you may need to update your classnames and stuff depending on how you name the file.&#160; I wanted my file name to reflect the fact that it was a CSS file – but it’s still needed to end with .aspx to ensure the file would be properly parsed by the ASP.NET engine without having to mess with the extension mapping on the web server.&#160; This resulted in Visual Studio making some illegal class names. </p>
<p>Also be sure that you add the ContentType attribute to the @Page definition, and set it to “text/css”, or you will get an error in some browsers stating that the Mime Type “text/html” is not “text/css”.&#160; Nice of Firefox to do a little validation on the content.</p>
<p>At this point you can add your CSS to the file and use &lt;%%&gt; tags or codebehind to manipulate the values.&#160; Now the CSS that was causing problems with the images looks like this:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">background</span>:url('<span style="color: #006080">&lt;</span>%=ResolveUrl(&quot;~/<span style="color: #0000ff">img</span>/header-bg<span style="color: #cc6633">.png</span>&quot;)%<span style="color: #006080">&gt;</span>') no<span style="color: #006080">-repeat 0 0;</span></pre>
</p></div>
</div>
<p>&#160;</p>
<p>Now when the CSS is requested by the browser and rendered out, the URL to the image file will be properly displayed as /RootFoolder/img/header-bg.png.&#160; This is a very simple modification, but one could go a little more crazy and do something like&#160; detect browser make/model and send out browser specific css in pre-defined literals, or possibly add authentication checks.&#160; </p>
<p>&#160;</p>
<p>&#160;</p>
</p>
</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d4c81f90-214f-4750-a10f-101a629a419d" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/ASP.NET" rel="tag">ASP.NET</a>,<a href="http://technorati.com/tags/CSS" rel="tag">CSS</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2009/04/using-relative-urls-in-css-with-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Click Builds Are A Beautiful Thing &#8211; Automated Build Studio</title>
		<link>http://www.geospecialling.com/index.php/2009/03/one-click-builds-are-a-beautiful-thing-automated-build-studio/</link>
		<comments>http://www.geospecialling.com/index.php/2009/03/one-click-builds-are-a-beautiful-thing-automated-build-studio/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 13:00:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Automated Build Studio]]></category>
		<category><![CDATA[One Click Build]]></category>

		<guid isPermaLink="false">http://www.landoris.com/blogs/darrin/index.php/2009/03/one-click-builds-are-a-beautiful-thing-automated-build-studio/</guid>
		<description><![CDATA[I’ve known for a long time that an automated build system is valuable, hey it’s number two on the Joel test.&#160; Recently the complexity of some of our products made an automated build system a requirement.&#160; It was getting to the point where creating a build of RADE was a four plus hour ordeal.&#160; It [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve known for a long time that an automated build system is valuable, hey it’s number two on <a title="The Joel Test" href="http://www.joelonsoftware.com/articles/fog0000000043.html" target="_blank" rel="tag">the Joel test</a>.&#160; Recently the complexity of some of our products made an automated build system a requirement.&#160; It was getting to the point where creating a build of <a title="RADE - Configurable Web based Solutions" href="http://www.landorIS.com/solutions/RADE" target="_blank" rel="tag">RADE</a> was a four plus hour ordeal.&#160; It had dozens of little steps, and missing even one would result in a defect.&#160;&#160; This defect would be a vicious cycle.&#160; We would have to debug to find the problem and fix it.&#160; This would cause ANOTHER four hour rebuilt, and the “cycle of bug” would continue.</p>
<p>This complexity resulted in infrequent builds and as a result the code was not tested as well as it should have been.&#160; Not to mention, I’d get really frustrated and even pissed off on build days.&#160;&#160; It took me a while to find a system that really made me happy.&#160; On a whim one night I downloaded <a title="Automated Build Studio - One Click Build Goodness!" href="http://www.automatedqa.com/products/abs/index.asp" target="_blank" rel="tag">Automated Build Studio</a> (ABS) and gave it a shot.&#160; After installing ABS on a new virtual machine that would become our dedicated build system I fired it up.&#160; I was pretty impressed with the wide range of actions and&#160; tools it supported.&#160; In our environment we had several must have items:</p>
<ul>
<li>1. SourceGear Vault </li>
<li>2. Visual Studio 2008 </li>
<li>3. Oracle/SQL Server </li>
<li>4. Installshield 2009 </li>
</ul>
<p>&#160;</p>
<p>ABS worked with all of them.&#160; In addition to the key requirements I had &#8211; it supported a <a title="Automated Build Studio operations" href="http://www.automatedqa.com/products/abs/operations.asp" target="_blank">plethora of other operations</a>.</p>
<p>First thing I did was sketch out a rough outline of what was involved in creating a build.&#160; Get latest source code, compile, delete temporary files, etc etc etc.&#160; I started selecting various options from the ABS and fleshing out my macro.&#160; Within a couple of hours, I had a sweet macro in place.&#160; My macro started to look like this:</p>
<ul>
<li>Getting the latest code from Vault </li>
<li>Compile all assemblies </li>
<li>Delete the temporary files </li>
<li>Build the needed release folder structure </li>
<li>Move the new files into the needed structure </li>
<li>Execute <a title="Remotesoft Protector" href="http://www.remotesoft.com/salamander/protector.html" target="_blank" rel="tag">Remotesoft Protector</a> on all assemblies </li>
<li>Increment the build version, and set the version on all assemblies </li>
<li>Create a label of the build in Vault </li>
<li>Build a zip of the release </li>
<li>Build the Installshield installer </li>
<li>Connect to the build FTP and upload the new build </li>
</ul>
<p>&#160;</p>
<p>The best part – all of this was occurring in a 100% reliable fashion, oh and it took minutes for a full build to occur.&#160; Over time, this project was tweaked, and copied.&#160; It evolved as I learned more about ABS – or thought up new requirements.&#160; Take <a title="FullCircle - Excel to Database" href="http://www.landorIS.com/solutions/fullcircle" target="_blank" rel="tag">FullCircle</a> for example, it has evolved into three editions, sharing a similar yet different set of source files.&#160; ABS lets me rebuild all three editions with the click of a button – in minutes.&#160;&#160; Long long ago, in the before times something like this would have taken days, and years off my life.</p>
<p>I’ve only scratched the surface of what I’ve been able to do with ABS – some other cool features worth mentioning is that builds can be scheduled to run, there is a web application for viewing build history as well as kicking off builds.&#160; It has a scripting language, and the support I’ve received is fantastic.&#160; The price of the product makes the decision to buy ABS a non issue.</p>
<p>Man, now I’m starting to sound like a sales guy. =)&#160; Seriously though, check out <a title="Automated Build Studio" href="http://www.automatedqa.com/products/abs/index.asp" target="_blank" rel="tag">Automated Build Studio</a> if you develop boxed, or even custom software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2009/03/one-click-builds-are-a-beautiful-thing-automated-build-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET 3.5 &#8220;Attempted to read or write protected memory&#8221; Caused by Remotesoft Protector</title>
		<link>http://www.geospecialling.com/index.php/2008/11/net-3-5-attempted-to-read-or-write-protected-memory-caused-by-remotesoft-protector/</link>
		<comments>http://www.geospecialling.com/index.php/2008/11/net-3-5-attempted-to-read-or-write-protected-memory-caused-by-remotesoft-protector/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 05:25:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Remotesoft Protector]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2008/11/net-3-5-attempted-to-read-or-write-protected-memory-caused-by-remotesoft-protector/</guid>
		<description><![CDATA[Months ago, I started getting the “Attempted to read or write protected memory” error.&#160; In hindsight (as always) its all clear.&#160; In short, it seems .NET 3.5 SP1 and Remotesoft Protector v2.x do not play nicely resulting in this error.&#160; Either stop using Protector, or upgrade to the latest version.
In long – for a number [...]]]></description>
			<content:encoded><![CDATA[<p>Months ago, I started getting the “Attempted to read or write protected memory” error.&#160; In hindsight (as always) its all clear.&#160; In short, it seems .NET 3.5 SP1 and <a title="Remotesoft Protector" href="http://www.remotesoft.com/salamander/protector.html" target="_blank" rel="tag">Remotesoft Protector</a> v2.x do not play nicely resulting in this error.&#160; Either stop using Protector, or upgrade to the latest version.</p>
<p>In long – for a number of reasons there was not a strait line between upgrading my machine to SP1 and noticing the problem.&#160; This made diagnosing the problem significantly more complicated because I had no idea when it actually started.&#160; At the time, I was dealing with <a title="Vista x64 and Oracle Client" href="http://www.webrade.com/blogs/darrin/2008/10/23/OracleClientODACOnVistaX64MostlyWorkingFinally.aspx" target="_blank" rel="tag">x64 and Oracle clients</a>.&#160; This had prompted me to start doing all my dev in an XP virtual machine.&#160; Eventually, the slowless of developing in a VM drove me insane and I just had to get my machine working again.&#160; So I got Oracle dealt with – but that left this annoying error.</p>
<p>It was a complete fluke that I noticed this.&#160; The stars aligned, and I manually compiled some assemblies, instead of pushing the big green button on my build system.&#160; This resulted in my assemblies not being run through the Remotesoft Protector.&#160; All of a sudden the problem went away.&#160; At the time I had been using Protector 2.x which would not support .NET 3.5 SP1 fully. So, either stop using Protector, or upgrade to the latest version which resolves this problem =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2008/11/net-3-5-attempted-to-read-or-write-protected-memory-caused-by-remotesoft-protector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ReSharper &#8211; A Class Creating Machine</title>
		<link>http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/</link>
		<comments>http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 13:43:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ReSharper]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/</guid>
		<description><![CDATA[Recently, I purchased a copy of ReSharper 4.0.&#160; I&#8217;m not even going to pretend I&#8217;ve scratched the surface of what ReSharper can do, but I can assure you it&#8217;s a massive time saver when creating classes from scratch.&#160; I&#8217;m furiously plugging away, implementing an nHibernate ORM for RADE, and to do that I needed to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I purchased a copy of <a title="ReSharper 4.0 - A Class Creating Machine!" href="http://www.jetbrains.com/resharper/index.html" target="_blank" rel="tag">ReSharper 4.0</a>.&#160; I&#8217;m not even going to pretend I&#8217;ve scratched the surface of what ReSharper can do, but I can assure you it&#8217;s a massive time saver when creating classes from scratch.&#160; I&#8217;m furiously plugging away, implementing an <a title="nHibernate Object Relational Mapper" href="http://www.nhibernate.org" target="_blank" rel="tag">nHibernate</a> ORM for RADE, and to do that I needed to create a lot of classes pretty much from scratch (oh, and do I have a few things to say about that, but that&#8217;s for another day).&#160; Let&#8217;s look at a simple example.&#160; To get things started, create a new class.&#160; Select the folder in the solution explorer, and press Alt+Insert:</p>
<p align="center"><a href="http://www.geospecialling.com/wp-content/uploads/2010/02/image6.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="184" alt="ReSharper Class Creation" src="http://www.geospecialling.com/wp-content/uploads/2010/02/image_thumb6.png" width="227" border="0" /></a> </p>
<p align="left">Press enter and you are prompted for the class name.&#160; So Visual Studio has this of course, but this is a small example of some of the time savings you can achieve.&#160; Enter the class name and you start off with an empty class.&#160; Next, lets define a couple of private members.&#160;&#160; Let&#8217;s run with the following example.</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> namespace RADE.BO.Domain</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>     public class SampleClass</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>         private Int32 _ID;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         private String _Description;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>         private Int64 _BiggerInt;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> }</pre>
</p></div>
</div>
<p>&#160;</p>
<p>Simple class.&#160; Three member variables.&#160; Here is where the big time savers come in.&#160; Next, click Alt+Insert again and you will be prompted with the following options:</p>
<p align="center"><a href="http://www.geospecialling.com/wp-content/uploads/2010/02/image7.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="Some ReSharper Code Generation Tools" src="http://www.geospecialling.com/wp-content/uploads/2010/02/image_thumb7.png" width="207" border="0" /></a> </p>
<p align="left">Choose Properties.&#160; You will now be given the option to select one or many fields, set the access rights, read only and virtual properties as well a bunch of others.&#160; </p>
<p align="center"><a href="http://www.geospecialling.com/wp-content/uploads/2010/02/image8.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="ReSharper Properties Generator" src="http://www.geospecialling.com/wp-content/uploads/2010/02/image_thumb8.png" width="244" border="0" /></a> </p>
<p align="left">Execute that and all of your get/sets are defined.&#160; My one complaint is that ReSharper is not maintaining the type on the properties.&#160; My Int32&#8217;s become int, and Int64&#8217;s become long&#8217;s.&#160; Apparently this is slated to be fixed.&#160;&#160; </p>
<p align="left">So yes, this sample class is tiny, but the time savings on larger classes, or projects full of classes are significant.&#160; The last feature I&#8217;ve been using extensively in this project is the generate constructor tool.&#160; Again, a form is displayed with the defined properties, select the ones you want and boom.&#160; You can create half a dozen different constructors in seconds.&#160; I&#8217;ve created a full object model on, roughly 20 different mildly complex objects in less than an hour, around midnight on a Sunday =)</p>
<p align="left">Some of the other things ReSharper does is suggest code cleanup ideas by removing unused directives, easy execution of <a title="NUnit unit-testing framework" href="http://www.nunit.org" target="_blank" rel="tag">NUnit tests</a>, improved code completion.&#160; I encourage you to check it out, <a title="ReSharper 4.0 Download Trial" href="http://www.jetbrains.com/resharper/download/" target="_blank" rel="tag">download a ReSharper trial</a>.</p>
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8dcb5def-80db-43d5-9cd3-dc2a526c7b9c" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/ReSharper" rel="tag">ReSharper</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.NET Code Protection &#8211; Remotesoft Protector to the Rescue!</title>
		<link>http://www.geospecialling.com/index.php/2008/05/net-code-protection-remotesoft-protector-to-the-rescue/</link>
		<comments>http://www.geospecialling.com/index.php/2008/05/net-code-protection-remotesoft-protector-to-the-rescue/#comments</comments>
		<pubDate>Sun, 25 May 2008 07:53:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Code Protection]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2008/05/net-code-protection-remotesoft-protector-to-the-rescue/</guid>
		<description><![CDATA[When .NET based assemblies go out the door, it&#8217;s incredibly simple for others to get access to your code.&#160;&#160; Download Lutz Roeder&#8217;s Reflector and take a look at what some of your assemblies have to say.&#160; The code visible is likely not going to be anywhere near as elegant as the original.&#160; The comments will [...]]]></description>
			<content:encoded><![CDATA[<p>When .NET based assemblies go out the door, it&#8217;s incredibly simple for others to get access to your code.&#160;&#160; Download <a title="Lutz Roeder&#39;s Reflector" href="http://www.aisto.com/roeder/dotnet/" target="_blank" rel="tag">Lutz Roeder&#8217;s Reflector</a> and take a look at what some of your assemblies have to say.&#160; The code visible is likely not going to be anywhere near as elegant as the original.&#160; The comments will be gone.&#160; The gist of what you are doing will be there.&#160; If you would prefer that your work be a little tougher to get at, read on.</p>
<p>Obfuscation was one of my first answers to this problem.&#160; An obfuscator ships with Visual Studio Pro, free and there are many available on the market.&#160; Obfuscation just didn&#8217;t do it for me.&#160; I once helped a customer troubleshoot problems with one of their software solutions from an unnamed vendor using Reflector and walking through the obfuscated code.&#160; This was really a painful experience, it does make it harder to figure out what is going on &#8211; but a friend of mine suggested a product that takes code protection one step further.</p>
<p>Hello <a title="Remotesoft Protector - protect your code" href="http://www.remotesoft.com/salamander/protector.html" target="_blank" rel="tag">Remotesoft Protector</a>.&#160; This product is pretty cool.&#160; If you purchase the protector product you will receive three components.&#160; Salamander .NET Decompiler, .NET Obfuscator, and .NET Protector.&#160; Initially I was processing my assemblies with both the obfuscator and the protector.&#160;&#160; Now a days, I pretty much only run my assemblies through the protector.</p>
<p>Once you&#8217;ve processed an assembly with the protector and you open it up in reflector things are going to look a little different.&#160; Here is a little before and after action for you:</p>
<p align="center"><a href="http://www.geospecialling.com/wp-content/uploads/2010/02/image2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="478" alt="Code as disassembled by Reflector" src="http://www.geospecialling.com/wp-content/uploads/2010/02/image_thumb2.png" width="644" border="0" /></a>&#160;</p>
<p align="left">Now lets take a look at the same code, but after being protected:</p>
<p align="center"><a href="http://www.geospecialling.com/wp-content/uploads/2010/02/image3.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="73" alt="image" src="http://www.geospecialling.com/wp-content/uploads/2010/02/image_thumb3.png" width="244" border="0" /></a> </p>
<p align="left">That&#8217;s it.&#160; Protector has made all your code go bye bye =)&#160; What&#8217;s happened here?&#160; As I understand it, Protector compiles all your managed .NET code into native code.&#160; So, yes, is it possible to disassemble native binaries.&#160; The difference here is the height of the bar &#8211; with plain .NET assemblies even my grand mother could get my code.&#160; Reverse engineering a native assembly is a different story.&#160; If someone with the skill to do that wants your code &#8211; well you must be writing some damn fine code.&#160; It would probably be easier for that kind of person to write it from scratch =)</p>
<p align="left">I&#8217;ve been working on increasing my <a title="The Joel Test - 12 Steps to Better Code" href="http://www.joelonsoftware.com/articles/fog0000000043.html" target="_blank" rel="tag">Joel Test</a> score lately.&#160; One of my biggies is the one step build for RADE.&#160; That sentence really doesn&#8217;t do the task justice.&#160; The first step I&#8217;m tackling in the one step build is automating the process of protecting my .NET assemblies.&#160; I could not find any resources on doing with with MSBuild.&#160; Once I get it working, I&#8217;ll post some code.</p>
<p align="left">All that said, I highly recommend you check out Protector if code protection is your thing.&#160; The price is a little bit steep at 1899$ for 1-5 developers &#8211; but how much money have you invested in that one little DLL or EXE file?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2008/05/net-code-protection-remotesoft-protector-to-the-rescue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
