<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Dan Miser</title>
    <link>http://www.distribucon.com/blog/</link>
    <description>Thoughts from Dan Miser</description>
    <language>en-us</language>
    <copyright>Dan Miser</copyright>
    <lastBuildDate>Sun, 31 May 2009 16:38:24 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>dmiser@distribucon.com</managingEditor>
    <webMaster>dmiser@distribucon.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/distribucon/danmiser" type="application/rss+xml" /><item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Given a set up like this (where ExpenseSummaryData
returns some arbitrary HTML fragment) : <pre><code> &lt;%using (Ajax.BeginForm("ExpenseSummaryData",
new AjaxOptions { UpdateTargetId = "result" })) { %&gt; &lt;label for="startDate"&gt;Start
Date:&lt;/label&gt; &lt;%= Html.TextBox("startDate") %&gt; &lt;br /&gt; &lt;label
for="endDate"&gt;End Date:&lt;/label&gt; &lt;%= Html.TextBox("endDate")%&gt; &lt;br
/&gt; &lt;input type="submit"/&gt; &lt;br /&gt; &lt;span id="result"/&gt; &lt;% }
%&gt; </code></pre><p />
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
<p />
The reason for this is that I forgot to add the following lines to the &lt;head&gt;
section in the original page: <pre><code> &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; </code></pre><p />
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /></body>
      <title>Why AJAX posts go to a new page instead of updating UpdateTargetId</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/vTF_0J384Zw/WhyAJAXPostsGoToANewPageInsteadOfUpdatingUpdateTargetId.aspx</link>
      <pubDate>Sun, 31 May 2009 16:38:24 GMT</pubDate>
      <description>Given a set up like this (where ExpenseSummaryData returns some arbitrary HTML fragment) :
&lt;pre&gt;&lt;code&gt; &amp;lt;%using
(Ajax.BeginForm("ExpenseSummaryData", new AjaxOptions { UpdateTargetId = "result"
})) { %&amp;gt; &amp;lt;label for="startDate"&amp;gt;Start Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("startDate")
%&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;label for="endDate"&amp;gt;End Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("endDate")%&amp;gt;
&amp;lt;br /&amp;gt; &amp;lt;input type="submit"/&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;span id="result"/&amp;gt; &amp;lt;%
} %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
&lt;p /&gt;
The reason for this is that I forgot to add the following lines to the &amp;lt;head&amp;gt;
section in the original page: &lt;pre&gt;&lt;code&gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/WhyAJAXPostsGoToANewPageInsteadOfUpdatingUpdateTargetId.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=60411c85-da2d-4907-8d0a-d0949d16ffee</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=60411c85-da2d-4907-8d0a-d0949d16ffee</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been on Facebook for a while, and
I just added Twitter to the mix. I'm trying to keep communications on those sites
much more informal and fairly non-technical. If you want to follow me, search for
dmiser@wi.rr.com on Facebook or danmiser on Twitter. Hope to see you over there.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60411c85-da2d-4907-8d0a-d0949d16ffee" /></body>
      <title>Social networking</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/lkqvjXjL7m0/SocialNetworking.aspx</link>
      <pubDate>Sat, 25 Apr 2009 17:08:10 GMT</pubDate>
      <description>I've been on Facebook for a while, and I just added Twitter to the mix. I'm trying to keep communications on those sites much more informal and fairly non-technical. If you want to follow me, search for dmiser@wi.rr.com on Facebook or danmiser on Twitter. Hope to see you over there.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60411c85-da2d-4907-8d0a-d0949d16ffee" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</comments>
      <category>.NET</category>
    <feedburner:origLink>http://www.distribucon.com/blog/SocialNetworking.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c8755312-f231-4981-8332-07422a11622a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c8755312-f231-4981-8332-07422a11622a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c8755312-f231-4981-8332-07422a11622a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c8755312-f231-4981-8332-07422a11622a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Are you looking for a strong developer/architect
with a serious passion for all things technical and a unique blend of experience?
If so, feel free to <a href="mailto:dmiser@distribucon.com">email me</a>. My main
focus over the past couple of years has been on things ALT.NET-ish (e.g. ASP.NET MVC,
NHibernate, Spring.NET, etc.) while I have delved into a variety of other technologies
as well (e.g. Mindscape LightSpeed, LINQ, Dynamic Data, Delphi, etc.). If you know
of an opening - contract or full-time - please keep me in mind. I'd prefer to remain
in the Milwaukee area, but occasional travel wouldn't be the end of the world. 
<p />
Until the next technical post here, take care and thanks in advance.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c8755312-f231-4981-8332-07422a11622a" /></body>
      <title>Looking for work</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c8755312-f231-4981-8332-07422a11622a.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/tRlBqMMsczE/LookingForWork.aspx</link>
      <pubDate>Wed, 22 Apr 2009 18:29:54 GMT</pubDate>
      <description>Are you looking for a strong developer/architect with a serious passion for all things technical and a unique blend of experience? If so, feel free to &lt;a href="mailto:dmiser@distribucon.com"&gt;email
me&lt;/a&gt;. My main focus over the past couple of years has been on things ALT.NET-ish
(e.g. ASP.NET MVC, NHibernate, Spring.NET, etc.) while I have delved into a variety
of other technologies as well (e.g. Mindscape LightSpeed, LINQ, Dynamic Data, Delphi,
etc.). If you know of an opening - contract or full-time - please keep me in mind.
I'd prefer to remain in the Milwaukee area, but occasional travel wouldn't be the
end of the world. 
&lt;p /&gt;
Until the next technical post here, take care and thanks in advance.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c8755312-f231-4981-8332-07422a11622a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c8755312-f231-4981-8332-07422a11622a.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>Delphi</category>
    <feedburner:origLink>http://www.distribucon.com/blog/LookingForWork.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=3d25c648-2331-493f-b9ed-7af6b84fa40c</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,3d25c648-2331-493f-b9ed-7af6b84fa40c.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,3d25c648-2331-493f-b9ed-7af6b84fa40c.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3d25c648-2331-493f-b9ed-7af6b84fa40c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We ran into a problem using <a href="http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate/support/OpenSessionInViewFilter.html">OpenSessionInView</a> on
an IIS7 server. It turns out that when running in IIS7's new Integrated Managed Pipeline
mode, we would get this error when trying to access lazy loaded objects:
</p>
        <pre>
          <code> Could not initialize proxy - the owning Session was closed. </code>
        </pre>
        <p>
For now, we just set the Managed Pipeline mode to Classic and things work fine again.
When we get time, we'll be looking to try <a href="http://forum.springframework.net/showthread.php?t=1885">this
configuration</a>.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3d25c648-2331-493f-b9ed-7af6b84fa40c" />
      </body>
      <title>OpenSessionInView with IIS7</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,3d25c648-2331-493f-b9ed-7af6b84fa40c.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/_hZbj22FjNE/OpenSessionInViewWithIIS7.aspx</link>
      <pubDate>Wed, 18 Mar 2009 00:47:45 GMT</pubDate>
      <description>&lt;p&gt;
We ran into a problem using &lt;a href="http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/orm/hibernate/support/OpenSessionInViewFilter.html"&gt;OpenSessionInView&lt;/a&gt; on
an IIS7 server. It turns out that when running in IIS7's new Integrated Managed Pipeline
mode, we would get this error when trying to access lazy loaded objects:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Could not initialize proxy - the owning Session was closed. &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
For now, we just set the Managed Pipeline mode to Classic and things work fine again.
When we get time, we'll be looking to try &lt;a href="http://forum.springframework.net/showthread.php?t=1885"&gt;this
configuration&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3d25c648-2331-493f-b9ed-7af6b84fa40c" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,3d25c648-2331-493f-b9ed-7af6b84fa40c.aspx</comments>
      <category>ALT.NET</category>
    <feedburner:origLink>http://www.distribucon.com/blog/OpenSessionInViewWithIIS7.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=099da178-0788-42dd-9954-b7764639db99</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,099da178-0788-42dd-9954-b7764639db99.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,099da178-0788-42dd-9954-b7764639db99.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=099da178-0788-42dd-9954-b7764639db99</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've listened to podcasts from <a href="http://www.twit.tv" target="_blank">http://www.twit.tv</a> for
a while now, and have always found the shows entertaining and informative. Scott Bourne
just launched <a title="http://mydl.me/" href="http://mydl.me/">Managing Your Daily
Life</a>, a blog about backups, storage, and how to manage the volume of data we all
have. Hopefully we get to podcasts soon. :)
</p>
        <p>
Yes, this post enters me in a contest to win a Drobo, but I like the content, too!
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=099da178-0788-42dd-9954-b7764639db99" />
      </body>
      <title>Managing Your Daily Life</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,099da178-0788-42dd-9954-b7764639db99.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/0fjGVHElFBE/ManagingYourDailyLife.aspx</link>
      <pubDate>Mon, 16 Mar 2009 17:21:33 GMT</pubDate>
      <description>&lt;p&gt;
I've listened to podcasts from &lt;a href="http://www.twit.tv" target="_blank"&gt;http://www.twit.tv&lt;/a&gt; for
a while now, and have always found the shows entertaining and informative. Scott Bourne
just launched &lt;a title="http://mydl.me/" href="http://mydl.me/"&gt;Managing Your Daily
Life&lt;/a&gt;, a blog about backups, storage, and how to manage the volume of data we all
have. Hopefully we get to podcasts soon. :)
&lt;/p&gt;
&lt;p&gt;
Yes, this post enters me in a contest to win a Drobo, but I like the content, too!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=099da178-0788-42dd-9954-b7764639db99" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,099da178-0788-42dd-9954-b7764639db99.aspx</comments>
    <feedburner:origLink>http://www.distribucon.com/blog/ManagingYourDailyLife.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=da104123-1fd4-4541-a102-2d93529154ca</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=da104123-1fd4-4541-a102-2d93529154ca</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The first time you load an assembly of <a href="http://quartznet.sourceforge.net/" target="_blank">Quartz.NET</a> jobs,
it populates the database with the current trigger information (cron vs. simple, timings,
etc.) that it finds in the configuration file. It appears that this information does
not get updated once it's in the database. So if you want to make a change to set
the trigger time to be every minute instead of the original version of "run every
day at 2am", you will be waiting for a loooong time to see that trigger fire (unless
you start at 1:59am :)).
</p>
        <p>
Since I'm using <a href="http://code.google.com/p/migratordotnet/" target="_blank">Migrator.NET</a> to
control my database schema, I can easily drop the tables and recreate them. This isn't
a big deal because once I have things tested, I won't need to change the trigger information,
but it did trip me up for a bit so I thought I'd share.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=da104123-1fd4-4541-a102-2d93529154ca" />
      </body>
      <title>Quartz.NET trigger updates</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/xmoVVOQwXTU/QuartzNETTriggerUpdates.aspx</link>
      <pubDate>Fri, 13 Mar 2009 04:47:18 GMT</pubDate>
      <description>&lt;p&gt;
The first time you load an assembly of &lt;a href="http://quartznet.sourceforge.net/" target="_blank"&gt;Quartz.NET&lt;/a&gt; jobs,
it populates the database with the current trigger information (cron vs. simple, timings,
etc.) that it finds in the configuration file. It appears that this information does
not get updated once it's in the database. So if you want to make a change to set
the trigger time to be every minute instead of the original version of "run every
day at 2am", you will be waiting for a loooong time to see that trigger fire (unless
you start at 1:59am :)).
&lt;/p&gt;
&lt;p&gt;
Since I'm using &lt;a href="http://code.google.com/p/migratordotnet/" target="_blank"&gt;Migrator.NET&lt;/a&gt; to
control my database schema, I can easily drop the tables and recreate them. This isn't
a big deal because once I have things tested, I won't need to change the trigger information,
but it did trip me up for a bit so I thought I'd share.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=da104123-1fd4-4541-a102-2d93529154ca" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,da104123-1fd4-4541-a102-2d93529154ca.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    <feedburner:origLink>http://www.distribucon.com/blog/QuartzNETTriggerUpdates.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=b6eb635e-95be-4f1e-a5c6-3b7fa18db772</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b6eb635e-95be-4f1e-a5c6-3b7fa18db772</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I came across this exception today when
inserting multiple objects through an NHibernate SessionScope:<br /><pre><code> NHibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session: 0, of class: Foo.Entity.Bar
at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IEntityPersister persister,
Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything) at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object
obj, CascadingAction action, Object anything) at NHibernate.Impl.SessionImpl.Save(Object
obj) </code></pre><p>
I didn't see much out there on this, but <a href="http://www.zorched.net" target="_blank">Geoff
Lane</a> picked up on it pretty quickly. It turns out that my Bar.hbm.xml mapping
file had set the id generator incorrectly to "generated", which was a problem because
it was actually a MSSQL IDENTITY field. The mapping should have looked like this: 
</p><p /><pre><code> &lt;id name="Id"&gt;<br />
  &lt;generator class="native" /&gt;<br />
&lt;/id&gt;</code></pre><p>
Luckily for me, I had run my tests by trying to insert 2 entities inside the session
so the error bubbled up right away. 
</p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=b6eb635e-95be-4f1e-a5c6-3b7fa18db772" /></body>
      <title>NHibernate NonUniqueException</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/gEWFqbOTPtI/NHibernateNonUniqueException.aspx</link>
      <pubDate>Thu, 12 Mar 2009 02:06:02 GMT</pubDate>
      <description>I came across this exception today when inserting multiple objects through an NHibernate SessionScope:&lt;br&gt;
&lt;pre&gt;&lt;code&gt; NHibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session: 0, of class: Foo.Entity.Bar
at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IEntityPersister persister,
Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything) at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object
obj, CascadingAction action, Object anything) at NHibernate.Impl.SessionImpl.Save(Object
obj) &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
I didn't see much out there on this, but &lt;a href="http://www.zorched.net" target="_blank"&gt;Geoff
Lane&lt;/a&gt; picked up on it pretty quickly. It turns out that my Bar.hbm.xml mapping
file had set the id generator incorrectly to "generated", which was a problem because
it was actually a MSSQL IDENTITY field. The mapping should have looked like this: 
&lt;p&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;id name="Id"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;generator class="native" /&amp;gt;&lt;br&gt;
&amp;lt;/id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Luckily for me, I had run my tests by trying to insert 2 entities inside the session
so the error bubbled up right away. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=b6eb635e-95be-4f1e-a5c6-3b7fa18db772" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,b6eb635e-95be-4f1e-a5c6-3b7fa18db772.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    <feedburner:origLink>http://www.distribucon.com/blog/NHibernateNonUniqueException.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=52754cfb-f1c7-4264-bd08-905039f15b62</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=52754cfb-f1c7-4264-bd08-905039f15b62</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yesterday, I had to upgrade from Spring.NET 1.1 to <a href="http://www.springframework.net/download.html" target="_blank">Spring.NET
1.2</a> in order to <a href="http://www.zorched.net/2009/03/07/using-quartznet-springnet-and-nhibernate-to-run-scheduled-tasks-in-aspnet/" target="_blank">use
Quartz.NET</a>. After doing that, I started to get InvalidCastException errors in
my unit tests that told me I couldn't convert an int to a Nullable&lt;int&gt;. Things
like this were broken:
</p>
        <pre>
          <code> void TestMe(int? id) { // do testing here } // and elsewhere, we call
it like this TestMe(42); </code>
        </pre>
        <p>
Very strange. It turns out that this is a <a href="http://jira.springframework.org/browse/SPRNET-1131" target="_blank">known
(and fixed) issue</a> due to using Nullable types through AOP. I grabbed the latest
nightly build and all of the tests passed again. 
</p>
        <p>
However, when running, I found a breaking change in the post-1.2.0 code that I needed
to correct, namely: 
</p>
        <p>
Overriding the SessionFactoryObjectName in web.config no longer uses Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName
as the key. Now, you need to use Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName.
e.g.
</p>
        <pre>
          <code>&lt;add key="Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName"
value="NHibernateSessionFactory" /&gt; </code>
        </pre>
        <p>
Now everything is upgraded and working again.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=52754cfb-f1c7-4264-bd08-905039f15b62" />
      </body>
      <title>Spring.NET 1.2.1 breaking change</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/zrQtfZdwhCU/SpringNET121BreakingChange.aspx</link>
      <pubDate>Tue, 10 Mar 2009 19:02:30 GMT</pubDate>
      <description>&lt;p&gt;
Yesterday, I had to upgrade from Spring.NET 1.1 to &lt;a href="http://www.springframework.net/download.html" target="_blank"&gt;Spring.NET
1.2&lt;/a&gt; in order to &lt;a href="http://www.zorched.net/2009/03/07/using-quartznet-springnet-and-nhibernate-to-run-scheduled-tasks-in-aspnet/" target="_blank"&gt;use
Quartz.NET&lt;/a&gt;. After doing that, I started to get InvalidCastException errors in
my unit tests that told me I couldn't convert an int to a Nullable&amp;lt;int&amp;gt;. Things
like this were broken:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; void TestMe(int? id) { // do testing here } // and elsewhere, we call
it like this TestMe(42); &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Very strange. It turns out that this is a &lt;a href="http://jira.springframework.org/browse/SPRNET-1131" target="_blank"&gt;known
(and fixed) issue&lt;/a&gt; due to using Nullable types through AOP. I grabbed the latest
nightly build and all of the tests passed again. 
&lt;p&gt;
However, when running, I found a breaking change in the post-1.2.0 code that I needed
to correct, namely: 
&lt;p&gt;
Overriding the SessionFactoryObjectName in web.config no longer uses Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName
as the key. Now, you need to use Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName.
e.g.&lt;pre&gt;&lt;code&gt;&amp;lt;add key="Spring.Data.NHibernate.Support.SessionScope.SessionFactoryObjectName"
value="NHibernateSessionFactory" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Now everything is upgraded and working again.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=52754cfb-f1c7-4264-bd08-905039f15b62" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,52754cfb-f1c7-4264-bd08-905039f15b62.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
    <feedburner:origLink>http://www.distribucon.com/blog/SpringNET121BreakingChange.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=ac208445-ed41-40cb-98ac-af77d227ef51</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ac208445-ed41-40cb-98ac-af77d227ef51</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've been playing with ways to write a solid (and even <a href="http://www.hanselminutes.com/default.aspx?showID=163" target="_blank">SOLID</a> :))
architecture with ASP.NET MVC. I started with a plain LINQ to SQL approach, and then
migrated to <a href="http://www.mindscape.co.nz/products/LightSpeed/default.aspx" target="_blank">LightSpeed</a>,
and finally ended up checking out <a href="http://groups.google.com/group/sharp-architecture" target="_blank">S#arp</a> last
week. Here are my notes of pros/cons on each approach. Yes, I could (and most likely
will) address some concerns by writing code for it. This is more of a laundry list
of the state of things as I see them at this point in time.
</p>
        <h3>LINQ to SQL
</h3>
        <h4>Pros
</h4>
        <ul>
          <li>
Visual designer 
</li>
        </ul>
        <h4>Cons
</h4>
        <ul>
          <li>
MS is talking about <a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" target="_blank">phasing
LINQ to SQL out</a> and forcing people towards Entity Framework. I'm pretty sick of
chasing MS's data-access strategies around every year. 
</li>
          <li>
LINQ to SQL mostly defaults you to a 1:1 mapping between your database and your model. 
</li>
          <li>
Support for modifications to the schema sucks, to be generous. 
</li>
          <li>
No UnitOfWork concept. Of course, as I prepared this blog entry, I found <a href="http://www.geekvue.com/2009/02/26/implementing-unitofwork-pattern-in-linq-to-sql-application/" target="_blank">this
article</a> published just today, so maybe that would address this point. 
</li>
        </ul>
        <h3>LightSpeed
</h3>
        <h4>Pros
</h4>
        <ul>
          <li>
Support is outstanding. 
</li>
          <li>
Nightly builds are available. 
</li>
          <li>
Visual designer. 
</li>
          <li>
Proven patterns bundled in their core libraries (UnitOfWork, Repository, Entity, etc.). 
</li>
          <li>
Picks up changes from the schema flawlessly. 
</li>
        </ul>
        <h4>Cons
</h4>
        <ul>
          <li>
Commercial and propietary. 
</li>
          <li>
Lacks quite a bit of LINQ support. For example, <a href="http://www.mindscape.co.nz/forums/Thread.aspx?PostID=3377" target="_blank">groupby
and join</a> are not supported. This meant that I use LINQ to SQL when I need these
features. Fortunately, that's all isolated to my report module, so it's not as horrible
as it could be. 
</li>
        </ul>
        <h3>S#arp
</h3>
        <h4>Pros
</h4>
        <ul>
          <li>
Open Source 
</li>
          <li>
Uses standard, widely adopted open source libraries: NHibernate, Windsor, etc. 
</li>
          <li>
Convention over Configuration 
</li>
          <li>
Scaffolding</li>
        </ul>
        <h4>Cons
</h4>
        <ul>
          <li>
I'm not digging the T4 templating mechanism. They conflict with VisualSVN and Developer
Express tools, and having to write a template for each and every entity is cumbersome. 
</li>
          <li>
No visual designer 
</li>
          <li>
No ability to import entities from an existing database. Yes, they like DDD, but in
almost every project I've been a part of, the database is the thing that already exists. 
</li>
          <li>
No UnitOfWork pattern (I might be able to fit code out there that does this in with
S#arp). The [Transaction] attribute approach feels a bit dirty. 
</li>
          <li>
The scaffolding is a bit too simple. It doesn't build up object graphs with links
(for display) or SelectLists (for editing). Yes, I can add that. It probably will
get that functionality at some point, too. But it doesn't do it right now.</li>
        </ul>
        <p>
For now, I think I'll be staying with LightSpeed, but I'll be watching S#arp very
carefully.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ac208445-ed41-40cb-98ac-af77d227ef51" />
      </body>
      <title>ASP.NET MVC Architecture Round-up</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/kV7FzcwE4H4/ASPNETMVCArchitectureRoundup.aspx</link>
      <pubDate>Thu, 26 Feb 2009 21:17:53 GMT</pubDate>
      <description>&lt;p&gt;
I've been playing with ways to write a solid (and even &lt;a href="http://www.hanselminutes.com/default.aspx?showID=163" target="_blank"&gt;SOLID&lt;/a&gt; :))
architecture with ASP.NET MVC. I started with a plain LINQ to SQL approach, and then
migrated to &lt;a href="http://www.mindscape.co.nz/products/LightSpeed/default.aspx" target="_blank"&gt;LightSpeed&lt;/a&gt;,
and finally ended up checking out &lt;a href="http://groups.google.com/group/sharp-architecture" target="_blank"&gt;S#arp&lt;/a&gt; last
week. Here are my notes of pros/cons on each approach. Yes, I could (and most likely
will) address some concerns by writing code for it. This is more of a laundry list
of the state of things as I see them at this point in time.
&lt;/p&gt;
&lt;h3&gt;LINQ to SQL
&lt;/h3&gt;
&lt;h4&gt;Pros
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Visual designer 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Cons
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
MS is talking about &lt;a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" target="_blank"&gt;phasing
LINQ to SQL out&lt;/a&gt; and forcing people towards Entity Framework. I'm pretty sick of
chasing MS's data-access strategies around every year. 
&lt;li&gt;
LINQ to SQL mostly defaults you to a 1:1 mapping between your database and your model. 
&lt;li&gt;
Support for modifications to the schema sucks, to be generous. 
&lt;li&gt;
No UnitOfWork concept. Of course, as I prepared this blog entry, I found &lt;a href="http://www.geekvue.com/2009/02/26/implementing-unitofwork-pattern-in-linq-to-sql-application/" target="_blank"&gt;this
article&lt;/a&gt; published just today, so maybe that would address this point. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;LightSpeed
&lt;/h3&gt;
&lt;h4&gt;Pros
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Support is outstanding. 
&lt;li&gt;
Nightly builds are available. 
&lt;li&gt;
Visual designer. 
&lt;li&gt;
Proven patterns bundled in their core libraries (UnitOfWork, Repository, Entity, etc.). 
&lt;li&gt;
Picks up changes from the schema flawlessly. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Cons
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Commercial and propietary. 
&lt;li&gt;
Lacks quite a bit of LINQ support. For example, &lt;a href="http://www.mindscape.co.nz/forums/Thread.aspx?PostID=3377" target="_blank"&gt;groupby
and join&lt;/a&gt; are not supported. This meant that I use LINQ to SQL when I need these
features. Fortunately, that's all isolated to my report module, so it's not as horrible
as it could be. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;S#arp
&lt;/h3&gt;
&lt;h4&gt;Pros
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Open Source 
&lt;li&gt;
Uses standard, widely adopted open source libraries: NHibernate, Windsor, etc. 
&lt;li&gt;
Convention over Configuration 
&lt;li&gt;
Scaffolding&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Cons
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
I'm not digging the T4 templating mechanism. They conflict with VisualSVN and Developer
Express tools, and having to write a template for each and every entity is cumbersome. 
&lt;li&gt;
No visual designer 
&lt;li&gt;
No ability to import entities from an existing database. Yes, they like DDD, but in
almost every project I've been a part of, the database is the thing that already exists. 
&lt;li&gt;
No UnitOfWork pattern (I might be able to fit code out there that does this in with
S#arp). The [Transaction] attribute approach feels a bit dirty. 
&lt;li&gt;
The scaffolding is a bit too simple. It doesn't build up object graphs with links
(for display) or SelectLists (for editing). Yes, I can add that. It probably will
get that functionality at some point, too. But it doesn't do it right now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For now, I think I'll be staying with LightSpeed, but I'll be watching S#arp very
carefully.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ac208445-ed41-40cb-98ac-af77d227ef51" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</comments>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/ASPNETMVCArchitectureRoundup.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=9edd16d1-a8b5-4359-8984-bf34ec2383e4</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,9edd16d1-a8b5-4359-8984-bf34ec2383e4.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,9edd16d1-a8b5-4359-8984-bf34ec2383e4.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9edd16d1-a8b5-4359-8984-bf34ec2383e4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Ages ago, I wrote about my <a href="http://www.distribucon.com/blog/FileSharingApplication.aspx" target="_blank">search
for a file sharing application</a>. I eventually went with BeInSync, and used it quite
a bit over the past 18 months or so. However, they haven't updated it recently, and
there are problems when editing Excel spreadsheets inside the shared folder (I told
BeInSync about this problem, they fixed it, and then broke it in the last release).
All in all, it was just showing it's age.
</p>
        <p>
Armed with a new set of fairly light requirements (Mac/Windows support, permissions,
auto-sync that doesn't fail), I evaluated the space again and came out with a very
positive experience of <a href="http://www.getdropbox.com" target="_blank">DropBox</a>.
It works very well between Mac and Windows, has an awesome web interface, and hasn't
exhibited any lags or slowness. In addition, it has the ability to revert to previous
versions of documents, which is a nice feature that all developers have come to appreciate.
</p>
        <p>
I'd like to see a couple features in the near future (native iPhone app with support
for iWork documents, ability to set your own private key), but this thing was dead
simple to install and use, and has worked brilliantly for the past month with a small
group of people.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=9edd16d1-a8b5-4359-8984-bf34ec2383e4" />
      </body>
      <title>DropBox file sharing application</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,9edd16d1-a8b5-4359-8984-bf34ec2383e4.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/gbu8vbDk5Us/DropBoxFileSharingApplication.aspx</link>
      <pubDate>Tue, 17 Feb 2009 19:45:12 GMT</pubDate>
      <description>&lt;p&gt;
Ages ago, I wrote about my &lt;a href="http://www.distribucon.com/blog/FileSharingApplication.aspx" target="_blank"&gt;search
for a file sharing application&lt;/a&gt;. I eventually went with BeInSync, and used it quite
a bit over the past 18 months or so. However, they haven't updated it recently, and
there are problems when editing Excel spreadsheets inside the shared folder (I told
BeInSync about this problem, they fixed it, and then broke it in the last release).
All in all, it was just showing it's age.
&lt;/p&gt;
&lt;p&gt;
Armed with a new set of fairly light requirements (Mac/Windows support, permissions,
auto-sync that doesn't fail), I evaluated the space again and came out with a very
positive experience of &lt;a href="http://www.getdropbox.com" target="_blank"&gt;DropBox&lt;/a&gt;.
It works very well between Mac and Windows, has an awesome web interface, and hasn't
exhibited any lags or slowness. In addition, it has the ability to revert to previous
versions of documents, which is a nice feature that all developers have come to appreciate.
&lt;/p&gt;
&lt;p&gt;
I'd like to see a couple features in the near future (native iPhone app with support
for iWork documents, ability to set your own private key), but this thing was dead
simple to install and use, and has worked brilliantly for the past month with a small
group of people.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=9edd16d1-a8b5-4359-8984-bf34ec2383e4" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,9edd16d1-a8b5-4359-8984-bf34ec2383e4.aspx</comments>
      <category>Macintosh</category>
    <feedburner:origLink>http://www.distribucon.com/blog/DropBoxFileSharingApplication.aspx</feedburner:origLink></item>
  </channel>
</rss>
