<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Mindscape Blog</title>
	
	<link>http://www.mindscape.co.nz/blog</link>
	<description>The official blog of Mindscape</description>
	<lastBuildDate>Wed, 24 Jun 2009 00:03:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MindscapeBlog" type="application/rss+xml" /><item>
		<title>Refactoring in the LightSpeed designer</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/06/22/refactoring-in-the-lightspeed-designer/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/06/22/refactoring-in-the-lightspeed-designer/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 04:24:20 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=803</guid>
		<description><![CDATA[If you&#8217;ve used Visual Studio for any length of time, you undoubtedly make heavy use of refactoring.  Even the simple refactoring of renaming a class or method and having Visual Studio automatically update all references is a huge time-saver.  If, however, you use the LINQ to SQL or Entity Framework designer, and you [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve used Visual Studio for any length of time, you undoubtedly make heavy use of refactoring.  Even the simple refactoring of renaming a class or method and having Visual Studio automatically update all references is a huge time-saver.  If, however, you use the LINQ to SQL or Entity Framework designer, and you rename a class or property in the designer, the references to that class or property in your code <em>don&#8217;t</em> get updated: you need to go through and fix them up by hand.  Until recently, we admit, that&#8217;s also been the case in the LightSpeed designer.  But not any more!</p>
<p>In current nightly builds, you can right-click an entity or property and choose Refactor > Rename.  LightSpeed will then not only rename the entity or property, it will also update any existing references.  The Refactor > Rename command also gives you the option to keep the existing name as the &#8220;database name&#8221; (the Table Name for entities, the Column Name for properties), so that you don&#8217;t need to remember to remap the entity or property by hand.  (Of course, you&#8217;ll want to turn this option off if you also intend to rename the column in the database.)</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-refactor-rename.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-refactor-rename.png" alt="Rename refactoring in the LightSpeed designer" title="Rename refactoring in the LightSpeed designer" width="417" height="291" class="alignnone size-full wp-image-805" /></a></p>
<p>The Refactor menu also offers a couple of other time-saving utilities.  One that we&#8217;re going to find really handy is Convert to Manual Implementation.  This is useful when you want to customise the implementation of a property, for example by adding your own business logic or validation in the setter.  Convert to Manual Implementation marks the property to be excluded from code generation in future, and copies the existing generated property code to a partial class to provide you with a starting point that you can then edit to meet your requirements.  It even copies attributes such as column name mappings and validation attributes.</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-refactor-convert-to-manual-impl.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-refactor-convert-to-manual-impl.png" alt="Results of the Convert to Manual Implementation refactoring" title="Results of the Convert to Manual Implementation refactoring" width="550" height="279" class="alignnone size-full wp-image-812" /></a></p>
<p>Finally, Create Partial Class quickly creates a partial class declaration for you, and Extract Interface allows you to rapidly declare an interface containing selected properties of an entity.  (Extract Interface is available only in C# projects.)</p>
<p>One small caveat.  Most of these refactorings need access to the generated code, and the code is only generated when you save the .lsmodel file.  So if you try to refactor a model with unsaved changes, the designer will do its best, but you may get an error if refactoring needs to access one of those unsaved changes.  (Some refactorings may also fail if you&#8217;re using a sufficiently radical custom template.)</p>
<p>We&#8217;d love to hear your feedback on these refactoring features and whether there are any other similar refactorings you&#8217;d like to see in LightSpeed.  You can get the latest nightly of the <a href="http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx">free Express edition here</a>, or retail editions from the <a href="http://www.mindscape.co.nz/store/myaccount.aspx">store</a>.</p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Domain-model-refactoring-in-the-LightSpeed-designer"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fwww.mindscape.co.nz%2Fblog%2Findex.php%2F2009%2F06%2F22%2Frefactoring-in-the-lightspeed-designer%2F" style="border:0px"/></a><br />
<br/><br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.mindscape.co.nz%2fblog%2findex.php%2f2009%2f06%2f22%2frefactoring-in-the-lightspeed-designer%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.mindscape.co.nz%2fblog%2findex.php%2f2009%2f06%2f22%2frefactoring-in-the-lightspeed-designer%2f&#038;bgcolor=8850B3" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/06/22/refactoring-in-the-lightspeed-designer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visualising inheritance graphs in the LightSpeed designer</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/06/16/visualising-inheritance-graphs-in-the-lightspeed-designer/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/06/16/visualising-inheritance-graphs-in-the-lightspeed-designer/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 02:44:09 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=795</guid>
		<description><![CDATA[We&#8217;re continuing to add filtering capabilities to the LightSpeed designer, and have recently added a couple of new features.
The first feature is to show the inheritance graphs of the selected entity or entities.  This shows all entities derived from the selected entity, and all of its base types.  For example, consider this inheritance [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re continuing to add filtering capabilities to the LightSpeed designer, and have recently added a couple of new features.</p>
<p>The first feature is to show the inheritance graphs of the selected entity or entities.  This shows all entities derived from the selected entity, and all of its base types.  For example, consider this inheritance hierarchy:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-person-hierarchy.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-person-hierarchy.png" alt="Person hierarchy in LightSpeed designer" title="Person hierarchy in LightSpeed designer" width="445" height="282" class="alignnone size-full wp-image-796" /></a></p>
<p>Here&#8217;s the same model, with &#8220;Contractor&#8221; entered into the filter box and the new <strong>Show inheritance</strong> option selected:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-person-contractor-inheritance-graph.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-person-contractor-inheritance-graph.png" alt="Contractor inheritance graph" title="Contractor inheritance graph" width="319" height="270" class="alignnone size-full wp-image-798" /></a></p>
<p>As mentioned, if you enter an intermediate or base class then the designer shows all the derived classes as well.  Here&#8217;s the model filtered on the &#8220;Employee&#8221; inheritance graph:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-person-employee-inheritance-graph.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-person-employee-inheritance-graph.png" alt="Employee inheritance graph" title="Employee inheritance graph" width="361" height="278" class="alignnone size-full wp-image-797" /></a></p>
<p>The second new feature is the ability to invert a filter.  So if you want to show all entities <em>except</em> a particular one, you can now do so.  This can be handy for excluding common base classes which would otherwise have lines to them from everywhere in the diagram, creating clutter.  To do this, enter an exclamation mark (!) in front of the filter criterion:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-inverse-filter.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/lsdesigner-inverse-filter.png" alt="Inverting a filter" title="Inverting a filter" width="356" height="68" class="alignnone size-full wp-image-799" /></a></p>
<p>(We don&#8217;t have a menu helper for this yet &#8212; you&#8217;ll just have to remember it!)</p>
<p>Both of these features are in the current nightly build &#8212; <a href="http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx">free Express edition here</a>, or commercial editions from the <a href="http://www.mindscape.co.nz/store/myaccount.aspx">store</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/06/16/visualising-inheritance-graphs-in-the-lightspeed-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Join queries in LightSpeed 2</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/06/08/join-queries-in-lightspeed-2/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/06/08/join-queries-in-lightspeed-2/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 03:32:51 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=783</guid>
		<description><![CDATA[Join support is one of the most frequently requested features for LightSpeed, and it&#8217;s coming in version 3, but what people don&#8217;t always realise is that you don&#8217;t always need a join for a join query.  LightSpeed 3 join support will enable you to pull back data from across multiple tables; but if all [...]]]></description>
			<content:encoded><![CDATA[<p>Join support is one of the most frequently requested features for LightSpeed, and it&#8217;s coming in version 3, but what people don&#8217;t always realise is that you don&#8217;t always need a join for a join query.  LightSpeed 3 join support will enable you to pull back data from across multiple tables; but if all you want to is to pull back entities from a single table <em>using criteria from other tables</em>, you can often do that today.</p>
<p>Let&#8217;s look at a simple example of a video sharing site, based on something that came up in the forums recently.  In this model, the main entities are Contributions.  Each Contribution is associated with a Member (who uploaded it).  In addition, there is a many-to-many (through) association between Contributions and Tags, via a ContributionTags through entity.</p>
<p><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/06/ls-video-sharing-model.png" alt="Simple video sharing model" title="ls-video-sharing-model" width="552" height="208" class="size-full wp-image-786" /></p>
<p>Now suppose you want to find all the Contributions uploaded by a Member named &#8220;t-dogg&#8221; and tagged with a Tag named &#8220;sheep.&#8221;  Initially it might seem like you need a join for this, or at least a sequence of nested selects, but in fact you can do it efficiently in a single LINQ query:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">from</span> ct <span style="color: #0600FF;">in</span> UnitOfWork.<span style="color: #000000;">ContributionTags</span>
<span style="color: #0600FF;">where</span> ct.<span style="color: #000000;">Contribution</span>.<span style="color: #000000;">Contributor</span>.<span style="color: #000000;">Name</span> <span style="color: #000000;">==</span> <span style="color: #000000;">&quot;t-dogg&quot;</span> <span style="color: #000000;">&amp;&amp;</span> ct.<span style="color: #000000;">Tag</span>.<span style="color: #000000;">Value</span> <span style="color: #000000;">==</span> <span style="color: #000000;">&quot;sheep&quot;</span>
<span style="color: #0600FF;">select</span> ct.<span style="color: #000000;">Contribution</span></pre></div></div>

<p>The trick here is to work around LINQ&#8217;s collection issues by finding a start point where all the associations are many-to-one.  In this case, ContributionTag has many-to-one associations with Tag and with Contribution, and Contribution has a many-to-one association with Member.  So we can write the query in terms of ContributionTag objects without needing to do a join or an explicit subselect.  Then we can project the results along the many-to-one association to Contribution to get the Contributions instead of the ContributionTags.</p>
<p>The core API allows another syntax for the same query which you may find more natural:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp">UnitOfWork.<span style="color: #000000;">Find</span><span style="color: #000000;">&lt;</span>Contribution<span style="color: #000000;">&gt;</span><span style="color: #000000;">&#40;</span>
  Entity.<span style="color: #000000;">Attribute</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&quot;Contributor.Name&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">==</span> <span style="color: #000000;">&quot;t-dogg&quot;</span>
    <span style="color: #000000;">&amp;&amp;</span> Entity.<span style="color: #000000;">Attribute</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&quot;ContributionTags.Tag.Value&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">==</span> <span style="color: #000000;">&quot;sheep&quot;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Here it&#8217;s clearer from the Find<Contribution> call that the query is interested in Contributions, not in ContributionTags.  Notice also that LightSpeed is able to traverse the ContributionTags collection association without you needing to write an explicit join or subselect.</p>
<p>What LightSpeed can do automatically doesn&#8217;t cover every possible join query, and of course if you want to return data from multiple tables you currently have to use a view or a stored procedure rather than a join.  But for simple queries that return data from a single table but need to join to other tables only for the &#8220;where&#8221; criteria, there&#8217;s a good chance you can build a LightSpeed query to do the job.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/06/08/join-queries-in-lightspeed-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visualising eager load graphs in the LightSpeed designer</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/27/visualising-eager-load-graphs-in-the-lightspeed-designer/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/27/visualising-eager-load-graphs-in-the-lightspeed-designer/#comments</comments>
		<pubDate>Thu, 28 May 2009 02:10:22 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[LightSpeed]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=771</guid>
		<description><![CDATA[Understanding what gets loaded when is important to the efficient use of an object-relational mapper.  Load too little, and you can end up making lots and lots of round trips to the database.  Load too much, and you can end up hauling in dozens of entities when you only wanted one or two.
LightSpeed&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Understanding what gets loaded when is important to the efficient use of an object-relational mapper.  Load too little, and you can end up making lots and lots of round trips to the database.  Load too much, and you can end up hauling in dozens of entities when you only wanted one or two.</p>
<p>LightSpeed&#8217;s eager loading and named aggregate features provide a great way of controlling aggregate loading, and you can easily set up these aggregates via the LightSpeed designer.  However, in complex models it&#8217;s not always easy to see the aggregates once they&#8217;re set up.</p>
<p>We&#8217;ve now added a feature to the designer&#8217;s filtering capability which allows you to see which entities are participating in a named aggregate, and to display the eager load graph of any given entity.  Here&#8217;s a simple model for an order management application:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-order-mgmt-model.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-order-mgmt-model.png" alt="Order management model" title="Order management model" width="445" height="449" class="alignnone size-full wp-image-776" /></a></p>
<p>In this case, the Pickup entity eager-loads its associated Warehouse and its associated Shipments collection.  That&#8217;s not obvious from the display.  But if we go to the LightSpeed Model Explorer, filter on the Pickup entity and choose <strong>Show load graph</strong>, we can see exactly what is going to get loaded along with a Pickup:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/ls-designer-eager-load-pickup.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/ls-designer-eager-load-pickup.png" alt="LightSpeed designer eager load graph from Pickup" title="LightSpeed designer eager load graph from Pickup" width="472" height="443" class="alignnone size-full wp-image-777" /></a></p>
<p>The load graph feature chases cascading eager loads, so if you have a chain of entities you will be able to see the entire load graph.</p>
<p>Another feature we&#8217;ve added is the ability to see which entities participate in a named aggregate (that is, an aggregate which is only conditionally loaded).  This doesn&#8217;t show the load graph per se, but it enable you to rapidly zero in on which entities are involved in a named aggregate.  To do this, select Aggregate from the Filter By menu or enter the aggregate name prefixed by the @ symbol.  For example:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-filter-by-named-aggregate.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-filter-by-named-aggregate.png" alt="LightSpeed designer showing participants in WithAccount named aggregate" title="LightSpeed designer showing participants in WithAccount named aggregate" width="479" height="481" class="alignnone size-full wp-image-778" /></a></p>
<p>We hope that these features will be useful to you in visualising what will get brought in when you load a particular entity.  Download <a href="http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx">the latest build of the free Express edition</a> (or <a href="http://www.mindscape.co.nz/store/myaccount.aspx">get a full copy from the store</a>) and let us know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/27/visualising-eager-load-graphs-in-the-lightspeed-designer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sub-views in the LightSpeed designer</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/26/sub-views-in-the-lightspeed-designer/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/26/sub-views-in-the-lightspeed-designer/#comments</comments>
		<pubDate>Wed, 27 May 2009 00:42:06 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=765</guid>
		<description><![CDATA[We&#8217;ve been continuing to add navigational aids to the LightSpeed designer and one recent feature can be used to implement a simple form of sub-views.  By a sub-view I mean that you can filter down to just a limited set of entities &#8212; for example, a Sales sub-view, a Logistics sub-view, etc.
In recent builds [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been continuing to add <a href="http://www.mindscape.co.nz/blog/index.php/2009/05/11/navigating-around-models-in-the-lightspeed-designer/">navigational aids to the LightSpeed designer</a> and one recent feature can be used to implement a simple form of sub-views.  By a sub-view I mean that you can filter down to just a limited set of entities &#8212; for example, a Sales sub-view, a Logistics sub-view, etc.</p>
<p>In recent builds of the designer we&#8217;ve added a <em>tagging</em> facility where you can associate tags with each entity.  Once you&#8217;ve done this, you can filter to show just the entities with a given tag.</p>
<p>Here&#8217;s a simple example based on an order processing model.  (In reality you&#8217;d only use this feature when your model is too complex to fit on one screen, but I wanted to keep the screenshots simple!)  Here the entities fall into two sub-domains, Sales and Logistics, with one or two entities appearing on both sub-domains.  We can represent this by tagging each entity with the sub-domain it falls into (multiple tags can be separated by commas):</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-tagging.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-tagging.png" alt="LightSpeed designer tagging" title="LightSpeed designer tagging" width="610" height="521" class="alignnone size-full wp-image-766" /></a></p>
<p>Now when we want to focus on a particular sub-domain, we can go to the LightSpeed Model window and use the Filter box to show only the tags we&#8217;re interested in.  To tell the Filter box that you&#8217;re filtering on tags rather than names, prefix the filter with a # sign (you can use the Filter By menu to do this for you).  Here&#8217;s how the model looks after entering #sales to filter on the &#8220;sales&#8221; tag:</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-filter-by-tag.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/lsdesigner-filter-by-tag.png" alt="LightSpeed designer filtering by tag" title="LightSpeed designer filtering by tag" width="622" height="474" class="alignnone size-full wp-image-767" /></a></p>
<p>You can include multiple tags in the filter, again by comma-separating them.  And of course you can still also filter by <a href="http://www.mindscape.co.nz/blog/index.php/2009/05/11/navigating-around-models-in-the-lightspeed-designer/">entity name</a> as previously discussed; and we&#8217;re adding <a href="http://www.mindscape.co.nz/blog/index.php/2009/05/27/visualising-eager-load-graphs-in-the-lightspeed-designer/">eager load graph visualisation</a>.</p>
<p>We hope this navigational feature will help you to tame your larger models.  If you&#8217;ve got big complex models and you want to give it a go, you can download the latest nightly from <a href="http://www.mindscape.co.nz/store/">the store</a> (and of course the <a href="http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx">free Express edition here</a> if you&#8217;re getting lost even in an 8-table model!).</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.mindscape.co.nz%2fblog%2findex.php%2f2009%2f05%2f26%2fsub-views-in-the-lightspeed-designer%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.mindscape.co.nz%2fblog%2findex.php%2f2009%2f05%2f26%2fsub-views-in-the-lightspeed-designer%2f&#038;bgcolor=8850B3" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/26/sub-views-in-the-lightspeed-designer/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Feedback wanted: LightSpeed 3.0 samples</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/24/feedback-wanted-lightspeed-30-samples/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/24/feedback-wanted-lightspeed-30-samples/#comments</comments>
		<pubDate>Mon, 25 May 2009 04:18:09 +0000</pubDate>
		<dc:creator>John-Daniel Trask</dc:creator>
				<category><![CDATA[LightSpeed]]></category>
		<category><![CDATA[samples]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=760</guid>
		<description><![CDATA[With every release of LightSpeed we aim to provide improved sample applications. I&#8217;m tasked with the improvement of the existing sample applications as well as adding some new samples for developers to learn from and thought it best to ask the users to find out what you want.
To recap, currently LightSpeed ships with the following [...]]]></description>
			<content:encoded><![CDATA[<p>With every release of LightSpeed we aim to provide improved sample applications. I&#8217;m tasked with the improvement of the existing sample applications as well as adding some new samples for developers to learn from and thought it best to ask the users to find out what you want.</p>
<p>To recap, currently LightSpeed ships with the following samples:</p>
<ul>
<li>An ASP.NET MVC sample</li>
<li>A LINQ Queries sample allowing developers to see how to write specific queries using the LINQ API</li>
<li>A Queries sample allowing developers to see how to write specific queries using the native LightSpeed Query API</li>
<li>A simple localization sample</li>
<li>The Mats challenge application showing how to efficiently fetch data</li>
<li>An ASP.NET poker website sample</li>
<li>An ASP.NET ecommerce store sample</li>
<li>A Visual Basic sample</li>
</ul>
<p>Now these certainly need some freshening up &#8211; the MVC sample is a bit too complicated and currently uses an older drop of ASP.NET MVC. Most of the other samples target .NET 2.0 and therefore don&#8217;t use LINQ querying which is becoming the mainstream way that users wish to interact with LightSpeed. </p>
<p>We have had several requests for more standard ASP.NET samples (not ASP.NET MVC), IoC samples as well as larger more sophisticated samples. I thought it was best to put the question out to you, the LightSpeed developer &#8211; what would you find helpful? What about how we deliver them &#8211; how would you like them (we currently run of SQLite to save you setting up a database for example)?</p>
<p>I&#8217;d really appreciate your thoughts :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/24/feedback-wanted-lightspeed-30-samples/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>M/DB support update</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/21/mdb-support-update/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/21/mdb-support-update/#comments</comments>
		<pubDate>Fri, 22 May 2009 03:16:30 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>
		<category><![CDATA[SimpleDB Management Tools]]></category>
		<category><![CDATA[M/DB]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=752</guid>
		<description><![CDATA[Earlier this week we announced LightSpeed and SimpleDB Management Tools support for M/Gateway&#8217;s M/DB, a free database which is &#8220;plug-compatible&#8221; with Amazon&#8217;s SimpleDB.  At the time I noted a couple of issues and limitations.  I&#8217;m glad to say that M/Gateway have very quickly addressed these, with a new build (build 26) available for [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week we announced <a href="http://www.mindscape.co.nz/products/LightSpeed/default.aspx">LightSpeed</a> and <a href="http://www.mindscape.co.nz/products/simpledbtools/default.aspx">SimpleDB Management Tools</a> support for M/Gateway&#8217;s <a href="http://gradvs1.mgateway.com/main/index.html?path=mdb">M/DB, a free database which is &#8220;plug-compatible&#8221; with Amazon&#8217;s SimpleDB</a>.  At the time I noted a couple of issues and limitations.  I&#8217;m glad to say that M/Gateway have very quickly addressed these, with a new build (build 26) available for download now.  With this new build:</p>
<ul>
<li>You no longer need to use SignatureVersion=1 when accessing M/DB; the default signature version and method will just work.</li>
<li>The issues around single quotes in queries, and around sorting and starts-with, are resolved.</li>
</ul>
<p>At the moment there appears to be an outstanding issue with paging, but because M/DB doesn&#8217;t impose a limit on the size of responses the way Amazon does, you can work around this by paging on the client.  M/Gateway are looking into this to see if it can be resolved.</p>
<p>We&#8217;d like to thank Rob Tweed of M/Gateway for his help and his rapid response on this.  If you&#8217;re using SimpleDB and you want a fast, convenient test-bed, do <a href="http://gradvs1.mgateway.com/main/index.html?path=mdb">check out M/DB</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/21/mdb-support-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unit of work scoping in LightSpeed</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/19/unit-of-work-scoping-in-lightspeed/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/19/unit-of-work-scoping-in-lightspeed/#comments</comments>
		<pubDate>Wed, 20 May 2009 04:03:46 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=738</guid>
		<description><![CDATA[A common pattern for working with persistent storage is the Repository pattern.  This typically takes the form of a class which encapsulates all of the data access code, usually instantiated as a member of a common base Page or (for MVC/MVP architectures) Controller or Presenter class.  In LightSpeed terms, the unit of work [...]]]></description>
			<content:encoded><![CDATA[<p>A common pattern for working with persistent storage is the <a href="http://www.martinfowler.com/eaaCatalog/repository.html">Repository pattern</a>.  This typically takes the form of a class which encapsulates all of the data access code, usually instantiated as a member of a common base Page or (for MVC/MVP architectures) Controller or Presenter class.  In LightSpeed terms, the unit of work is hidden behind the Repository facade, so that your application code deals only with the domain objects.</p>
<p>A consequence of this is that if the unit of work is hidden away in the repository class, so is the unit of work lifecycle and sharing logic.  Your application can&#8217;t control the lifecycle as it would do if it constructed the unit of work directly.</p>
<p>But we couldn&#8217;t build a particular lifecycle into the base LightSpeed repository class: different environments need different lifecycle and sharing logic.  For example, in a Web application, you want each request to get its own unit of work.  You don&#8217;t want units of work hanging around from one request to the next, and you don&#8217;t want simultaneous requests sharing the same unit of work.  In a Windows Forms application, you would need a different and potentially application-dependent strategy.  So it&#8217;s necessary instead to encapsulate this lifecycle and sharing logic in a <a href="http://en.wikipedia.org/wiki/Strategy_pattern">strategy</a> class.  Then the application can just delegate selecting the correct unit of work to the strategy class, and stop worrying about lifecycle concerns.</p>
<p>In LightSpeed, these lifecycle and sharing strategy classes are called <em>unit of work scope classes</em>.  We provide two of them out of the box, a unit-of-work-per-request strategy for Web applications, and a unit-of-work-per-thread strategy for batch tools.</p>
<p>Scope classes inherit from UnitOfWorkScopeBase, an abstract class which basically defines just one interesting property, Current.  The Current property represents the unit of work that should be used in the current situation.  A concrete scope class will override Current to provide creation and partitioning logic appropriate to the particular strategy.</p>
<p>Let&#8217;s look at a common example.  As noted, a Web application wants a unit of work per request.  That is, we want to be able to write page, controller or presenter code that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">var</span> products <span style="color: #000000;">=</span> <span style="color: #0600FF;">this</span>.<span style="color: #000000;">Repository</span>.<span style="color: #000000;">GetAllProducts</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
MakeSomeChanges<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0600FF;">this</span>.<span style="color: #000000;">Repository</span>.<span style="color: #000000;">SaveChanges</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>and know that within any given request all our entities will be part of the same unit of work (so that associations will be wired up correctly, etc.), and that SaveChanges will be applied to that same unit of work; but also that different requests will get different unit of work instances, so that the SaveChanges() call <em>won&#8217;t</em> save changes currently under way in other requests</p>
<p>How can we encapsulate this in a scope class?  The answer is to implement Current something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp">TUnitOfWork current <span style="color: #000000;">=</span> <span style="color: #000000;">&#40;</span>TUnitOfWork<span style="color: #000000;">&#41;</span>HttpContext.<span style="color: #000000;">Current</span>.<span style="color: #000000;">Items</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&quot;UOW&quot;</span><span style="color: #000000;">&#93;</span>;
&nbsp;
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>current <span style="color: #000000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  current <span style="color: #000000;">=</span> LightSpeedContext.<span style="color: #000000;">CreateUnitOfWork</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
  HttpContext.<span style="color: #000000;">Current</span>.<span style="color: #000000;">Items</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&quot;UOW&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> current;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">return</span> current;</pre></div></div>

<p>The strategy checks to see if there is already a unit of work associated with the current request.  If so, it returns that existing unit of work.  If not, it creates a new one and associates it with the current request, so that subsequent calls to Current <em>as part of the same request</em> will return the same unit of work.</p>
<p>Then the repository will internally have an instance of this scope class, and use its Current unit of work to handle requests:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">class</span> StoreRepository <span style="color: #000000;">:</span> RepositoryBase<span style="color: #000000;">&lt;</span>StoreUnitOfWork<span style="color: #000000;">&gt;</span>
<span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> StoreRepository<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">string</span> configName<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">:</span> <span style="color: #0600FF;">base</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> PerRequestUnitOfWorkScope<span style="color: #000000;">&lt;</span>StoreUnitOfWork<span style="color: #000000;">&gt;</span><span style="color: #000000;">&#40;</span>
      <span style="color: #008000;">new</span> LightSpeedContext<span style="color: #000000;">&lt;</span>StoreUnitOfWork<span style="color: #000000;">&gt;</span><span style="color: #000000;">&#40;</span>configName<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0600FF;">public</span> IList<span style="color: #000000;">&lt;</span>Product<span style="color: #000000;">&gt;</span> GetAllProducts<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">return</span> UnitOfWorkScope.<span style="color: #000000;">Current</span>.<span style="color: #000000;">Products</span>.<span style="color: #000000;">ToList</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So not only is the application code uncluttered by details of the persistence mechanism and the unit of work, the repository methods are free of lifecycle and partitioning details as well.  All of that stuff is hidden neatly away in the scope class.  In particular this facilitates testing because the HttpContext-dependent scope class can be swapped out for a simple scope class (see <a href="http://www.mindscape.co.nz/blog/index.php/2008/05/12/using-the-unit-of-work-per-request-pattern-in-aspnet-mvc/">http://www.mindscape.co.nz/blog/index.php/2008/05/12/using-the-unit-of-work-per-request-pattern-in-aspnet-mvc/</a> for more info.</p>
<p>And that&#8217;s all there is to scope classes.  A lot of customers find them a bit confusing but really you only need to know two things: first, they&#8217;re just simple wrappers that do a little housekeeping and a little encapsulation, and second, you only need them if you&#8217;re using the repository pattern, or if you want to save writing the HttpContext wrapper code yourself.  Many LightSpeed applications will never need a scope class at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/19/unit-of-work-scoping-in-lightspeed/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>M/DB support in SimpleDB Management Tools and LightSpeed</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/17/mdb-support-in-simpledb-management-tools-and-lightspeed/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/17/mdb-support-in-simpledb-management-tools-and-lightspeed/#comments</comments>
		<pubDate>Sun, 17 May 2009 21:13:58 +0000</pubDate>
		<dc:creator>Ivan Towlson</dc:creator>
				<category><![CDATA[LightSpeed]]></category>
		<category><![CDATA[SimpleDB Management Tools]]></category>
		<category><![CDATA[SimpleDB]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=725</guid>
		<description><![CDATA[Amazon&#8217;s SimpleDB cloud database is cool, but it&#8217;s not the ideal platform for development and testing &#8212; it can be a pain having to go all the way to Amazon for each test, it&#8217;s not very convenient to set up isolated instances for each developer, and the &#8220;eventual consistency&#8221; behaviour of SimpleDB makes verifying updates [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon&#8217;s SimpleDB cloud database is cool, but it&#8217;s not the ideal platform for development and testing &#8212; it can be a pain having to go all the way to Amazon for each test, it&#8217;s not very convenient to set up isolated instances for each developer, and the &#8220;eventual consistency&#8221; behaviour of SimpleDB makes verifying updates unreliable.</p>
<p>Fortunately, MGateway Developments have a <a href="http://gradvs1.mgateway.com/main/index.html?path=mdb">free, &#8220;plug-compatible&#8221; alternative called M/DB</a>, which not only allows you to have local test versions of SimpleDB but can also be used in production to break through some of SimpleDB&#8217;s limitations.  It&#8217;s provided as a handy virtual appliance, which makes it a snap to set up locally.</p>
<p>We&#8217;ve now updated <a href="http://www.mindscape.co.nz/products/lightspeed/default.aspx">LightSpeed</a> and <a href="http://www.mindscape.co.nz/products/simpledbtools/default.aspx">SimpleDB Management Tools</a> to support M/DB.  In SimpleDB Management Tools, you now can supply a URL to a M/DB instance.    You can then work with that instance in Server Explorer and the Query window just as you now do with the Amazon service.  You can set up connections to multiple M/DB instances and have them alongside your connection to Amazon itself.</p>
<p><a href="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/sdb-mgmt-tools-mdb.png"><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/sdb-mgmt-tools-mdb.png" alt="SimpleDB Management Tools M/DB support" title="SimpleDB Management Tools M/DB support" width="456" height="494" class="alignnone size-full wp-image-734" /></a></p>
<p>In LightSpeed, we&#8217;ve added elements to the connection string to allow you to override the default Amazon URL and point to a M/DB instance instead.  Simply add the following element to your connection string:</p>

<div class="wp_syntax"><div class="code"><pre class="xml">Url=http://xxx.xxx.xxx.xxx/mdb/request.mgwsi</pre></div></div>

<p>and you&#8217;ll be good to go.</p>
<p>If you want to try out LightSpeed against M/DB, <a href="http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx">grab the latest nightly from here</a> or from <a href="http://www.mindscape.co.nz/store/">the store</a>.</p>
<p>To get the updated version of SimpleDB Management Tools, go <a href="http://www.mindscape.co.nz/products/simpledbtools/download.aspx">here for the free edition</a> or to <a href="http://www.mindscape.co.nz/store/default.aspx?p=SimpleDB%20Management%20Tools">the store</a> for the unlimited edition.</p>
<p><strong>UPDATE:</strong> In the M/DB &#8220;virtual appliance&#8221; (build 21) there were some compatibility issues noted in an earlier version of this post.  <a href="http://www.mindscape.co.nz/blog/index.php/2009/05/21/mdb-support-update/">These issues are now fixed</a> but you will need to <a href="http://gradvs1.mgateway.com/main/index.html?path=mdb">download and install M/DB build 26 or above</a> to make it work seamlessly with LightSpeed and SimpleDB Management Tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/17/mdb-support-in-simpledb-management-tools-and-lightspeed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The New Zealand Hi-Tech Awards</title>
		<link>http://www.mindscape.co.nz/blog/index.php/2009/05/14/the-new-zealand-hi-tech-awards/</link>
		<comments>http://www.mindscape.co.nz/blog/index.php/2009/05/14/the-new-zealand-hi-tech-awards/#comments</comments>
		<pubDate>Fri, 15 May 2009 00:15:36 +0000</pubDate>
		<dc:creator>John-Daniel Trask</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[WPF Elements]]></category>
		<category><![CDATA[Awards]]></category>
		<category><![CDATA[Mindscape]]></category>

		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=716</guid>
		<description><![CDATA[
It&#8217;s a bit late but now that we have some photos from the evening it seemed like a good time to make a post about the New Zealand Hi-Tech Awards. Two weeks ago Jeremy and I went to Christchurch to attend the Hi-Tech awards &#8211; we hadn&#8217;t entered Mindscape in the awards this year but [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/awardlogo.gif" alt="NZ Hi-Tech Awards Logo" title="NZ Hi-Tech Awards Logo" width="610" height="106" class="alignnone size-full wp-image-718" /></p>
<p>It&#8217;s a bit late but now that we have some photos from the evening it seemed like a good time to make a post about the New Zealand Hi-Tech Awards. Two weeks ago Jeremy and I went to Christchurch to attend the Hi-Tech awards &#8211; we hadn&#8217;t entered Mindscape in the awards this year but I was put forward for the Young Achiever award. </p>
<p>I was fortunate enough to be a winner of the Young Achiever category along with Andrew Graham. Endace sponsored this award and so the award was given by Neil Hopkins of Endace (on the left):</p>
<p><img src="http://www.mindscape.co.nz/blog/wp-content/uploads/2009/05/award.jpg" alt="John-Daniel Trask receving the Hi-Tech Young Achiever Award" title="John-Daniel Trask receving the Hi-Tech Young Achiever Award" width="605" height="521" class="alignnone size-full wp-image-717" /></p>
<p>Praise needs to go to the organisers and sponsors of the awards &#8211; celebration of business success and highlighting the importance of creating innovative technology companies in New Zealand is important. A memorable quote of the evening was that we need to be creating global businesses &#8211; something that I believe Mindscape truly is &#8211; over 95% of our customers are not in New Zealand. Thanks of course also goes to the rest of the Mindscape team and all those involved in the other ventures that we are part of.</p>
<p>Overall it was a great evening &#8211; we met some very interesting people, connected up with some we hadn&#8217;t seen in a while and stayed up way too late (in typical geek fashion, back at the hotel room afterwards Jeremy and I played some Unreal Tournament 2004 to which it became apparent I am not very good at playing when tired and full of wine!). Good Times!</p>
<p><a href="http://www.hitech.org.nz/">Read more about the New Zealand Hi-Tech Awards here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindscape.co.nz/blog/index.php/2009/05/14/the-new-zealand-hi-tech-awards/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
