<?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; RADE</title>
	<atom:link href="http://www.geospecialling.com/index.php/category/rade/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geospecialling.com</link>
	<description>Being a (G)IS Developer...</description>
	<lastBuildDate>Thu, 26 Jan 2012 04:11:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>OracleCommand and parameterized update statements</title>
		<link>http://www.geospecialling.com/index.php/2011/11/oraclecommand-and-parameterized-update-statements/</link>
		<comments>http://www.geospecialling.com/index.php/2011/11/oraclecommand-and-parameterized-update-statements/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 22:07:53 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[RADE]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ODP.NET]]></category>
		<category><![CDATA[Parameterized Queries]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2011/11/oraclecommand-and-parameterized-update-statements/</guid>
		<description><![CDATA[This week I encountered an irritating situation with Oracle while working on code in the RADE application logic.&#160; In a nutshell I am building dynamically created parameterized insert and update statements based on the RADE metadata and the values entered by the user.&#160; The first call InsertNewRecord works perfectly.&#160; The next call UpdateExistingRecord however was [...]]]></description>
			<content:encoded><![CDATA[<p>This week I encountered an irritating situation with Oracle while working on code in the <a title="RADE" href="http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/" rel="tag" target="_blank">RADE</a> application logic.&#160; In a nutshell I am building dynamically created parameterized insert and update statements based on the RADE metadata and the values entered by the user.&#160; The first call InsertNewRecord works perfectly.&#160; The next call UpdateExistingRecord however was not.&#160; The parameterized SQL was being created.&#160; The parameters were being created and assigned to the <a title="DbCommand" href="http://msdn.microsoft.com/en-us/library/system.data.common.dbcommand.aspx" rel="tag" target="_blank">DbCommand</a>.&#160; The ExecuteNonQuery() call was executing without returning an error.&#160; Oracle just would not update.&#160;&#160; Even more frustrating – this “just worked” in SQL server.</p>
<h2>What were the differences?</h2>
<p>The basic logic for insert was this (parts omitted because you probably just don’t care):</p>
<ol>
<li>Get table metadata </li>
<li>Loop through fields in table </li>
<li>for each field retrieve the value from the UI </li>
<li>Add field to parameterized SQL statement with placeholder </li>
<li>Create new parameter with appropriate name and value.&#160;&#160; Add parameter to collection </li>
<li>Loop through parameters in the collection and add to the DbCommand </li>
<li>Finally execute the parameterized SQL statement </li>
</ol>
<p>As I mentioned this worked great.&#160; Fields were inserted and there was much rejoicing.</p>
<p>The logic for an update was similar but there was one big difference:</p>
<ol>
<li>Get Table </li>
<li>Loop through fields in table </li>
<li>for each field retrieve the value from the UI </li>
<li>If the field is a key add the placeholder to the where condition, otherwise add the field name and value to the update fields part of the SQL </li>
<li>Create new parameter with appropriate name and value.&#160; Add parameter to collection </li>
<li>Loop through parameters in the collection and add to the DbCommand </li>
<li>Finally execute the parameterized SQL statement. </li>
</ol>
<p>The branch in step 4 and the if statement ended up causing the problem.</p>
<h2>The Problem</h2>
<p><a title="OracleCommand" href="http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oraclecommand(v=VS.100).aspx" rel="tag" target="_blank">OracleCommand</a> defaults to “bind by order” – making the order in which the parameters exist in the SQL statement match the order in which the parameters are added to the OracleCommand. This was happening during the insert because of the structure of an insert statement being so linear. However in the update statement I was building the SQL in a more dynamic way. I was maintaining a list field=value conditions and a separate where condition. In the ended up merging them :</p>
<div>
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> String parameterizedSQL = <span style="color: #006080">&quot;UPDATE &quot;</span> + table.Name + <span style="color: #006080">&quot; SET &quot;</span> + updateStatement + <span style="color: #006080">&quot; WHERE &quot;</span> + whereStatement;</pre>
</p></div>
</div>
<p>So unless my key field( s) all lined up at the end of the table metadata definitions,&#160; appending that where condition at the end my parameter order got all out of whack in the DbCommand.&#160; So my where condition was actually being set to the wrong value – which could have resulted in the wrong records being updated. Nasty.&#160;&#160; Fortunately this can be resolved.</p>
<h2>The Fix – BindByName=true</h2>
<p>To correct this I had to set the Oracle specific BindByName property to true.&#160; (btw this being the default behavior is just silly.&#160; All the other big data providers default to bind by name and Oracle should too.&#160; That’s a rant for another day though.)&#160;&#160; My initial solution was to check if the command is an OracleCommand and if found do a little casting to set the BindByName property then recast it back to DbCommand before executing the query.&#160; Constructive feedback is always welcome!</p>
<div>
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> <span style="color: #008000">/// Execute the parameterized query</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> <span style="color: #008000">/// &lt;param name=&quot;conn&quot;&gt;open and active DbConnection&lt;/param&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span> <span style="color: #008000">/// &lt;param name=&quot;trans&quot;&gt;Active DbTransaction&lt;/param&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span> <span style="color: #008000">/// &lt;param name=&quot;parameterizedSQL&quot;&gt;the parameterized SQL&lt;/param&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span> <span style="color: #008000">/// &lt;param name=&quot;paramList&quot;&gt;List of OledDbParameter&lt;/param&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span> <span style="color: #008000">/// &lt;returns&gt;DataTable containing the results&lt;/returns&gt;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> RunParameterizedInsertUpdate(DbConnection conn, DbTransaction trans, String parameterizedSQL, List&lt;DbParameter&gt; paramList)</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span> {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span>     <span style="color: #008000">//create the db command and set the parameterized SQL as a property</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  12:</span>     DbCommand command = conn.CreateCommand();</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  13:</span>     <span style="color: #0000ff">if</span>(trans != <span style="color: #0000ff">null</span>)</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  14:</span>     {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  15:</span>         command.Transaction = trans;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  16:</span>     }</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  17:</span>     <span style="color: #008000">//hack attack!  By default, Oracle requires its parameters to be placed into the command</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  18:</span>     <span style="color: #008000">//in the order the parameters appear in the parameterized SQL.  Little hackery here</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  19:</span>     <span style="color: #008000">//to set the Oracle Command to bind by name</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  20:</span>     <span style="color: #0000ff">if</span> (command <span style="color: #0000ff">is</span> Oracle.DataAccess.Client.OracleCommand)</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  21:</span>     {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  22:</span>         OracleCommand oraCmd = (OracleCommand) command;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  23:</span>         oraCmd.BindByName = <span style="color: #0000ff">true</span>;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  24:</span>         command = oraCmd;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  25:</span>     }</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  26:</span>     command.CommandText = parameterizedSQL;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  27:</span>     command.CommandType = CommandType.Text;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  28:</span>&#160; </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  29:</span>     <span style="color: #008000">//loop through the params and add them to the command</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  30:</span>     <span style="color: #0000ff">foreach</span> (DbParameter parameter <span style="color: #0000ff">in</span> paramList)</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  31:</span>     {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  32:</span>         command.Parameters.Add(parameter);</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  33:</span>     }</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  34:</span>     <span style="color: #0000ff">try</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  35:</span>     {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  36:</span>         command.Prepare();</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  37:</span>         command.ExecuteNonQuery();</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  38:</span>     }</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  39:</span>     <span style="color: #0000ff">catch</span> (Exception ex)</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  40:</span>     {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  41:</span>         command.Dispose();</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  42:</span>         <span style="color: #0000ff">throw</span>;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  43:</span>     }</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060">  44:</span> }</pre>
</p></div>
</div>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:65e08d4f-940e-4b86-baf5-ae193e7dbe34" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Oracle.+ODP.NET" rel="tag">Oracle. ODP.NET</a>,<a href="http://technorati.com/tags/c%23" rel="tag">c#</a>,<a href="http://technorati.com/tags/parameterized+query" rel="tag">parameterized query</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2011/11/oraclecommand-and-parameterized-update-statements/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mapguide Enterprise 2011 &#8211; Fusion and Selection XML</title>
		<link>http://www.geospecialling.com/index.php/2010/09/mapguide-enterprise-2011-fusion-and-selection-xml/</link>
		<comments>http://www.geospecialling.com/index.php/2010/09/mapguide-enterprise-2011-fusion-and-selection-xml/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 21:00:14 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Mapguide]]></category>
		<category><![CDATA[RADE]]></category>
		<category><![CDATA[Fusion]]></category>
		<category><![CDATA[Mapguide Enterprise]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/09/mapguide-enterprise-2011-fusion-and-selection-xml/</guid>
		<description><![CDATA[I’ve been working to migrate the RADE&#160;Mapguide 2010 code to work with 2011.&#160; In 2010, I only implemented support for the DWF and Ajax viewer.&#160; With the release of 2011, the new&#160; ability to include mapping data from Google, Yahoo and Microsoft in Fusion are huge so I opted to migrate everything over.&#160; The DWF [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been working to migrate the <a title="RADE" href="http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/" rel="tag" target="_blank">RADE</a>&#160;<a title="Autodesk Mapguide" href="http://www.mapguide.com" target="_blank">Mapguide</a> 2010 code to work with 2011.&#160; In 2010, I only implemented support for the DWF and Ajax viewer.&#160; With the release of 2011, the new&#160; ability to include mapping data from Google, Yahoo and Microsoft in Fusion are huge so I opted to migrate everything over.&#160; The DWF viewer is already deprecated and I suspect the Ajax viewer will likely go next. </p>
<p>With 2010 and the Ajax viewer we had to get the selection from the MapFrame using the GetSelectionXML() method.&#160; Then we had to encode, and send this value up to the web tier for processing.&#160; I had all kinds of business logic that I was hoping to re-use with a minimal amount of modifications so I was trying to find how to recreate this functionality with Fusion.&#160; I figured out how the selections worked on the client side using the new callback system and was getting the selection object – but I could not find anything definitively saying “There is no selection XML on the client side anymore”.&#160;&#160;&#160; So…</p>
<blockquote><p><strong>There is no selection XML on the client side any more when using Fusion.</strong></p>
</blockquote>
<p>There I said it.&#160; It makes sense too – first getting this large XML string and sending it up was a pain in the ass.&#160; Encoding it, creating a form to submit it, etc.&#160;&#160; I should have clued into this sooner – Fusion is updating the selection on the server side as needed.&#160; </p>
<p>So in order to minimally impact the existing code – I added an additional check to some of the calls that looks a little something like this:</p>
<div>
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #0000ff">if</span> (String.IsNullOrEmpty(selectionXml))</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> {</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span>     MgResourceService resSvc = (MgResourceService)siteConn.CreateService(MgServiceType.ResourceService);</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span>     sel.Open(resSvc, map.GetName());</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>     selectionXml = sel.ToXml();</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span> }</pre>
</p></div>
</div>
<p>Those four lines of code are a lot easier than all the screwing around needed in 2010 to get the selection XML.&#160;&#160; With that small modification my existing code is working perfectly!</p>
<p>hope this helps someone =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/09/mapguide-enterprise-2011-fusion-and-selection-xml/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>RADE Milestone &#8211; Object Relational Mapping with NHibernate</title>
		<link>http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/</link>
		<comments>http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 09:37:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[RADE]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[nHibernate]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/</guid>
		<description><![CDATA[It&#8217;s 1:30AM, I guess it&#8217;s Saturday now. =)&#160; I&#8217;ve been furiously pounding away for the past two weeks building a new data access layer for RADE 4.0.&#160; Gotta love 12 &#8211; 18 hour days for two weeks (Good thing I love software development).&#160; My wife is away for the week, so I can continue working [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s 1:30AM, I guess it&#8217;s Saturday now. =)&#160; I&#8217;ve been furiously pounding away for the past two weeks building a new <a title="ORM data access layer" href="http://en.wikipedia.org/wiki/Data_access_layer" target="_blank" rel="tag">data access layer</a> for RADE 4.0.&#160; Gotta love 12 &#8211; 18 hour days for two weeks (Good thing I love software development).&#160; My wife is away for the week, so I can continue working these stupid hours for another week.&#160; Anyhow I&#8217;ve chosen to proceed with <a title="nHibernate ORM" href="http://www.nhibernate.com" target="_blank" rel="tag">NHibernate</a> for the time being.&#160; <a title="LINQ" href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx" target="_blank" rel="tag">LINQ</a> with the <a title="Entity Framework" href="http://blogs.msdn.com/adonet/archive/2007/04/28/ado-net-entity-framework-update.aspx" target="_blank" rel="tag">Entity Framework</a> looks really cool and I&#8217;ve used it for some small research/test projects recently, but with the lack of support for database other than SQL server &#8211; it&#8217;s not an option at this time.</p>
<p>NHibernate was a tough curve for me.&#160; Initially, I started testing code generators.&#160; After spending a significant amount of time reading, testing, and pulling out hair I came to the conclusion that <a title="nHibernate code generation is still lacking" href="http://www.ayende.com/Blog/archive/2007/03/17/On-the-sad-state-of-NHibernate-code-generation.aspx" target="_blank" rel="tag">NHibernate code generation is still not there</a>.&#160; From my experiences <a title="genwise nHibernate code generator" href="http://www.genwise.com" target="_blank" rel="tag">Genwise</a> is probably the best code generator out there right now &#8211; but its still lacking in some areas.&#160; More importantly however, I learned that code generation is not a good place to start when implementing NHibernate for the first time.&#160; There is so much going on under the hood &#8211; in my opinion you need to start off doing a reasonable size project by hand.&#160; Code generation has significant benefits, because the generated code is so similar with simple replacements it just makes a lot of sense once you wrap your head around what&#8217;s going on with NHibernate.</p>
<p>As per my <a title="ReSharper - painless class creation" href="http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/" target="_blank" rel="tag">previous post on ReSharper</a> when implementing nHibernate by hand, <a title="ReSharper" href="http://www.jetbrains.com/resharper/" target="_blank" rel="tag">ReSharper is a must have</a>.&#160; Just the other day I found a *great* ReSharper <a title="ReSharper NHibernate Plugin" href="http://nhplugin.lieser-online.de/" target="_blank" rel="tag">NHibernate Plugin</a>.&#160; When editing NHibernate HBM XML files, it does a bunch of validation right in the editor.&#160; Saves you a lot of time finding problems without having to actually run a unit test and debug sometimes cryptic error messages.</p>
<p>I bought a copy of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F1932394923%3Fpf%5Frd%5Fm%3DATVPDKIKX0DER%26pf%5Frd%5Fs%3Dcenter-2%26pf%5Frd%5Fr%3D1MWGQH6SNCMY6AMCW734%26pf%5Frd%5Ft%3D101%26pf%5Frd%5Fp%3D278240301%26pf%5Frd%5Fi%3D507846&amp;tag=r0a0-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">NHibernate In Action</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=r0a0-20&amp;l=ur2&amp;o=1" width="1" border="0" />.&#160; I would recommend this book to you only if you have no experience, or understanding of Object Relational Mappers.&#160; As the book stands right now, it&#8217;s not really a good developer reference and only covers really basic examples.&#160; The documents that helped me the most to get everything up and running was <a title="NHibernate FAQ" href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/03/31/prepare-your-system-for-nhibernate.aspx" target="_blank" rel="tag">The NHibernate FAQ</a>.&#160; The NHibernate documentation is pretty cryptic.&#160; Don&#8217;t read this stuff 12 hours into your day.&#160; No amount of RedBull will give you the focus needed to make sense of it.&#160; In the first 8 hours of the day, its quite helpful.</p>
<p>I primarily work in VB.NET.&#160; For this project however, I switched to C#.&#160; Maybe now, the my colleagues at <a title="bear mountain software" href="http://www.bearmountainsoftware.com" target="_blank" rel="tag">Bear Mountain</a> will stop giving me a hard time =).&#160; Seriously though.&#160; Examples are a LOT easier to come by in C#, probably 10:1. </p>
<p>Finally, get NUnit running.&#160; I had a lot of problems using the built in Microsoft Test projects with NHibernate &#8211; so I&#8217;ll be sticking with NUnit. If you&#8217;ve never done unit testing (you know who you are) do it.&#160; Particularly in this case &#8211; its crucial.&#160; You (Again you know who you are =]) used to write simple winform apps, and put a bunch of buttons on them.&#160; Don&#8217;t do that.&#160; </p>
<p>So, if you are one of the RADE non-developer users and you read on this far.&#160; Congrats.&#160; This milestone will not directly help you with your use of RADE.&#160; However, it&#8217;s a large step forward for the underlying architecture &#8211; and you will benefit from that.&#160; </p>
<p>Well back to Visual Studio I go..</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dc01ed48-a1bc-49eb-a8db-414dc5dc3243" 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/.NET" rel="tag">.NET</a>,<a href="http://technorati.com/tags/NHibernate" rel="tag">NHibernate</a>,<a href="http://technorati.com/tags/RADE" rel="tag">RADE</a>,<a href="http://technorati.com/tags/Resharper" rel="tag">Resharper</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RADE &#8211; Build custom web applications, without writing custom code</title>
		<link>http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/</link>
		<comments>http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 13:21:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[RADE]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/</guid>
		<description><![CDATA[In response to numerous queries, I put together this post to help answer the question – what is RADE (formerly known as WebRADE). RADE is a development framework that delivers custom web applications using existing data without having to write a single line of code.&#160; RADE provides a rich set of functions including security, prompting [...]]]></description>
			<content:encoded><![CDATA[<p>In response to numerous queries, I put together this post to help answer the question – what is RADE (formerly known as WebRADE). RADE is a development framework that delivers custom web applications using existing data without having to write a single line of code.&#160; RADE provides a rich set of functions including security, prompting queries, configurable reports and charting using existing database and mapping data, without the need for expensive consultants and programmers. </p>
<p> RADE includes a configurable web mapping interface that incorporates queries, reports, charts and basic editing tools. These “components” work with the data you have stored in one or more databases (Oracle, SQL Server, Access) and can be used by any application made with RADE. Right now RADE supports MapGuide 6.x, we are in the process however of extending the mapping interface to allow RADE applications to use multiple web mapping engines including MapGuide 6.x, MapGuide Enterprise 2009 / Mapguide Open Source 2.0 and Google Maps. Other mapping engines may be implemented in the future.&#160;&#160; </p>
<p>An application made with RADE is a collection of queries, reports, charts, and of course users/groups managed by the integrated RADE security model. They are your custom solutions founded upon the bedrock that RADE provides. </p>
<p> A user with basic knowledge of their underlying database structure can design customized queries, reports, and charts in a matter of hours. Solutions can be as broad or as narrow as needed depending on the requirements of the organization. All of this work is done using RADE’s web-based administration tools.&#160;&#160; </p>
<p>Before RADE, I worked for a provider of customizable desktop GIS, automated map standardization, and facilities management solutions for both government and industry. GIS/Geospatial implementations involved a lot of customized work, specific to particular clients, and could seldom be easily reused. This is when and where I came to realize that there had to be a better way to develop solutions.&#160;&#160; </p>
<p>As RADE developed, we put it to the test and have been developing a series of standalone applications build on its framework. With RADE, we are saving time on projects which results in significant cost savings and rapid delivery for our clients.&#160;&#160; </p>
<p>Out of curiosity one day, I connected RADE to my accounting and bug-tracking databases just to see what would happen. With a little research into the underlying databases — I was able to create both queries and reports on both data sources. No map required.&#160;&#160; </p>
<p>As a developer I have projects that require me to extend RADE with more proprietary code. Take <a title="FloorView" href="http://www.floorview.com" target="_blank" rel="tag">FloorView</a> for example. FloorView is a complete vertical application built on top of RADE. It uses the RADE security/authentication system in addition to the RADE queries and reports — but is in itself a full application. This allowed us to leverage the existing functionality saving time, and money. In addition to this, FloorView appears as a RADE application when authorized users login to the site keeping all of the RADE based applications in one convenient location.&#160;&#160; </p>
<p>In addition to FloorView a number of other vertical applications have been developed on top of, or using RADE. They include solutions for address management, disaster planning and recovery, sexual predator and offender tracking, crime mapping and analysis, oil and gas lease management and service request tracking and management.&#160;&#160; </p>
<p>The best analogy I have for RADE is “Developer in a Box”.&#160; Much of the work is already done for you&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2008/06/rade-build-custom-web-applications-without-writing-custom-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

