<?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"
	>

<channel>
	<title>Will's Blog</title>
	<atom:link href="http://will.hughesfamily.net.au/feed/" rel="self" type="application/rss+xml" />
	<link>http://will.hughesfamily.net.au</link>
	<description>Overseas Travel, Photography, and ofcourse - all things technology.</description>
	<pubDate>Wed, 23 Jul 2008 17:25:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Getting Kerberos / SSO to Work in Flex</title>
		<link>http://will.hughesfamily.net.au/20080724/getting-kerberos-sso-to-work-in-flex/</link>
		<comments>http://will.hughesfamily.net.au/20080724/getting-kerberos-sso-to-work-in-flex/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 17:25:19 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080724/getting-kerberos-sso-to-work-in-flex/</guid>
		<description><![CDATA[Because Adobe currently don&#8217;t support Kerberos in Flex, that limits the ability to do cool Single Sign On stuff through Air and on various sites. 
So, how to solve this?&#160; Well, this is just a theory, but it seems to work ok on paper. 
The basic idea is that you have something else do the [...]]]></description>
			<content:encoded><![CDATA[<p>Because Adobe currently <a href="http://bugs.adobe.com/jira/browse/SDK-14554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel">don&#8217;t support Kerberos in Flex</a>, that limits the ability to do cool Single Sign On stuff through Air and on various sites. </p>
<p>So, how to solve this?&nbsp; Well, this is just a theory, but it seems to work ok on paper. </p>
<p>The basic idea is that you have something <em>else</em> do the authentication, and generate a One Time Key. That Key is then passed to your Flex app (eg via the Command Line for Air, or a Flashvar in the browser), which then uses this OTK to authenticate and grab a Session key like you normally would. </p>
<p>The point of using a One Time Key which is then discarded after use,&nbsp; is so that someone malicious can&#8217;t grab (say) your process list and reuse that authentication token. </p>
<p>So, for Windows Air clients - you could build a quick-and-dirty preloader (.NET makes this really easy) which does your Kerberos authentication using (say) your Windows Identity against Active Directory. </p>
<p>For Mac Air clients - You&#8217;d also need to build a preloader (Mono? :D). Whether you can achieve SSO this way would depend on how the OSX Identity stuff works under a domain (or the equivilent analog in OSX world) model, but at the very least you could do your Kerberos authentication here.</p>
<p>And for Server-side components, well, that&#8217;s pretty damn obvious - you generate the OTK on the server and deliver it down (over SSL!) as part of the page. </p>
<p>Anyway, hope this helps someone who&#8217;s pondering the way to solve this. </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080724/getting-kerberos-sso-to-work-in-flex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Recruitment: How NOT to do it</title>
		<link>http://will.hughesfamily.net.au/20080711/recruitment-how-not-to-do-it/</link>
		<comments>http://will.hughesfamily.net.au/20080711/recruitment-how-not-to-do-it/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 13:59:18 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080711/recruitment-how-not-to-do-it/</guid>
		<description><![CDATA[Tonight someone I&#8217;d met once or twice before tried to recruit me into coming to work for their company.&#160; There&#8217;s a number of things that put me off about their approach, and I wanted summarise them here so that any other recruiters or managers who read this knows what not to do. 
First of all, [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight someone I&#8217;d met once or twice before tried to recruit me into coming to work for their company.&nbsp; <br />There&#8217;s a number of things that put me off about their approach, and I wanted summarise them here so that any other recruiters or managers who read this knows what not to do. </p>
<p>First of all, whilst it&#8217;s only something minor - it&#8217;s probably a good idea not to try and corner me whilst I&#8217;m (obviously) chatting with other people, and not you.&nbsp; </p>
<p>When I mention that I happen to be sitting with workmates, and my manager/team-leader, that should be an indication to back off with the pitch and leave it for another opportunity. </p>
<p>If I&#8217;ve also said I&#8217;m enjoying the work, and that I get to work on some cool stuff (even if I can&#8217;t mention the clients/projects) - patronising the company I work for isn&#8217;t really a point in your favour. </p>
<p>However the killer would have to be mentioning how you&#8217;re engaging in (in my opinion) shady business practices, and isn&#8217;t-this-really-cool-that-we&#8217;re-screwing-the-system-for-our-clients.&nbsp; </p>
<p>That&#8217;s all! <img src='http://will.hughesfamily.net.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080711/recruitment-how-not-to-do-it/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing, 1&#8230;. 2&#8230;?</title>
		<link>http://will.hughesfamily.net.au/20080709/testing-1-2/</link>
		<comments>http://will.hughesfamily.net.au/20080709/testing-1-2/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 07:00:15 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[Randomness]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/?p=916</guid>
		<description><![CDATA[These are just paragraphs selected at random and pasted into google.
Just testing something  
(PS: Hi work folks) 
]]></description>
			<content:encoded><![CDATA[<p>These are just paragraphs selected at random and pasted into google.</p>
<p>Just testing something <img src='http://will.hughesfamily.net.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(PS: Hi work folks) </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080709/testing-1-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>World Youth Day, aka Another Excuse for BS Police Powers</title>
		<link>http://will.hughesfamily.net.au/20080701/world-youth-day-aka-another-excuse-for-bs-police-powers/</link>
		<comments>http://will.hughesfamily.net.au/20080701/world-youth-day-aka-another-excuse-for-bs-police-powers/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 11:08:06 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[Randomness]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080701/world-youth-day-aka-another-excuse-for-bs-police-powers/</guid>
		<description><![CDATA[As almost anyone who&#8217;s watched the news in the last year or so - World Youth Day (which is actually FIVE days. Talk about not being able to count.) is in Sydney this year. 
Our fine State Government has decided in all it&#8217;s wisdom to implement Extraordinary Powers to Police. These include the authority to [...]]]></description>
			<content:encoded><![CDATA[<p>As almost anyone who&#8217;s watched the news in the last year or so - <a href="http://en.wikipedia.org/wiki/World_Youth_Day_2008">World Youth Day</a> (which is actually FIVE days. Talk about <a href="http://en.wikipedia.org/wiki/Creation_according_to_Genesis">not being able to count</a>.) is in Sydney this year. </p>
<p>Our fine State Government has decided in all it&#8217;s wisdom to implement Extraordinary Powers to Police. These include the authority to arrest and/or fine people for &#8220;causing annoyance&#8221; to World Youth Day participants. </p>
<blockquote><p><em>EXTRAORDINARY new powers will allow police to arrest and fine people for &#8220;causing annoyance&#8221; to World Youth Day participants and permit partial strip searches at hundreds of Sydney sites, beginning today.</em>
<p><em>The laws, which operate until the end of July, have the potential to make a crime of wearing a T-shirt with a message on it, undertaking a Chaser-style stunt, handing out condoms at protests, riding a skateboard or even playing music, critics say.</em>
<p><em>Police and volunteers from the State Emergency Service and Rural Fire Service will be able to direct people to cease engaging in conduct that &#8220;causes annoyance or inconvenience to participants in a World Youth Day event&#8221;.</em>
<p><em>People who fail to comply will be subject to a $5500 fine.</em>
<p>&#8211; Source: SMH, <a href="http://www.smh.com.au/articles/2008/06/30/1214677946009.html">&#8220;Thou shalt not annoy on Youth Day&#8221;, July 1 2008</a>. Jano Gibson, Linda Morris and Joel Gibson. </p>
</blockquote>
<p>Yep, a $5500 fine for doing anything which might annoy someone (read: Catholic) in various places around Sydney for the whole of July.
<p>I thought we were supposed to have separation of Church and State in this country?
<p>When the <a href="http://en.wikipedia.org/wiki/Dalai_Lama">Dalai Lama</a> visits, I don&#8217;t see any laws banning anything which might cause offence to Bhudists. But, hey, some old guy in long robes, with a pointy hat and a huge amount of money decides to inconvenience a City with throngs of his followers? Hey, lets arrest/fine anyone who says something that might offend them!
<p>I wonder if this extends to also talking about Science in public? I mean, that&#8217;s deeply offensive to most religious people - the idea that many of the core concepts of their religion are based on lies. </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080701/world-youth-day-aka-another-excuse-for-bs-police-powers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Well&#8230; What were you expecting?</title>
		<link>http://will.hughesfamily.net.au/20080629/well-what-were-you-expecting/</link>
		<comments>http://will.hughesfamily.net.au/20080629/well-what-were-you-expecting/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 15:25:35 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[Randomness]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080629/well-what-were-you-expecting/</guid>
		<description><![CDATA[ 
Well?
]]></description>
			<content:encoded><![CDATA[<p><a href="http://will.hughesfamily.net.au/wp-content/uploads/2008/06/image.png" rel="lightbox"><img height="553" alt="image" src="http://will.hughesfamily.net.au/wp-content/uploads/2008/06/image-thumb.png" width="501" border="0"></a> </p>
<p>Well?</p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080629/well-what-were-you-expecting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Distributed Object Caching: Memcached &#38; Velocity</title>
		<link>http://will.hughesfamily.net.au/20080627/distributed-object-caching-memcached-velocity/</link>
		<comments>http://will.hughesfamily.net.au/20080627/distributed-object-caching-memcached-velocity/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 14:35:49 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Velocity]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080627/distributed-object-caching-memcached-velocity/</guid>
		<description><![CDATA[I&#8217;m working on a new project at work where we&#8217;re dealing with data that updates frequently, at unpredictable times, used in across several different front-end services, and needs to scale to pretty decent traffic levels without going nuts on buying more hardware. 
So, given all that, one of the things we&#8217;re looking at is using [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a new project at work where we&#8217;re dealing with data that updates frequently, at unpredictable times, used in across several different front-end services, and needs to scale to pretty decent traffic levels without going nuts on buying more hardware. </p>
<p>So, given all that, one of the things we&#8217;re looking at is using a distributed object caching layer, such as memcached.&nbsp; If you&#8217;re not sure what this technology does, the quick summary is that it is used to store commonly accessed data in memory on your servers. One of the most common uses is to cache results from database queries.&nbsp; </p>
<p><a href="http://www.danga.com/memcached/">memcached</a> started it&#8217;s life at <a href="http://www.danga.com/">Danga Interactive</a> to solve issues scaling <a href="http://www.livejournal.com/">LiveJournal</a> at 20 million+ pageviews per day. It has a proven track record in the Unix world, and a fairly significant base of knowledge on what works and various workarounds and solutions. </p>
<p>Whilst memcached is from Unix, there are also Windows based ports of the server, and also <a href="https://sourceforge.net/projects/memcacheddotnet/">.NET clients</a> so using it in our environment shouldn&#8217;t be an issue from the technical side.&nbsp; </p>
<p>Recently Microsoft also announced their entry into this space with a project code named <a href="http://blogs.msdn.com/velocity/">Velocity</a>. It&#8217;s pretty similar to memcached, but also has some additional functions allowing things like Tagging and Regionalising (Partitioning) data.&nbsp; There&#8217;s also more support at the moment for different cache expiry methods, and the roadmap includes additional redundancy bits too. </p>
<p>For anyone who is considering how their applications will scale up, there&#8217;s plenty more to read on the subject. </p>
<p>Dare Obasanjo has a post from July 2007 about <a href="http://www.25hoursaday.com/weblog/2007/07/05/ASPNETCachingVsMemcachedSeekingEfficientDataPartitioningLookupAndRetrieval.aspx">memcached on Windows</a>, and also more recently about <a href="http://www.25hoursaday.com/weblog/2008/06/06/VelocityADistributedInMemoryCacheFromMicrosoft.aspx">Velocity</a>.&nbsp; Scott Hanselman (Who I&#8217;m happy to say is coming to Tech.Ed Australia 2008!) has a podcast up about <a href="http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCachingWithMicrosoftsVelocity.aspx">Velocity</a>, talking with Anil Nori - one of the smart fellows responsible for Velocity.</p>
<p>I&#8217;ll write some more on this as we progress down the build of this application.</p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080627/distributed-object-caching-memcached-velocity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQ to SQL Caching Gotcha</title>
		<link>http://will.hughesfamily.net.au/20080624/linq-to-sql-caching-gotcha/</link>
		<comments>http://will.hughesfamily.net.au/20080624/linq-to-sql-caching-gotcha/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 07:17:19 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Coding]]></category>

		<category><![CDATA[IT]]></category>

		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/?p=910</guid>
		<description><![CDATA[So, today I discovered an issue which related to me doing two calls something a little like this: 
- Execute dc.sp_Proc1
- If some condition exists, execute dc.sp_Proc2, and then Execute dc.sp_Proc1 again with the same parameters.
- Insert some records into the database. 
The problem is, the first time you execute the sproc, it caches the [...]]]></description>
			<content:encoded><![CDATA[<p>So, today I discovered an issue which related to me doing two calls something a little like this: </p>
<p>- Execute dc.sp_Proc1<br />
- If some condition exists, execute dc.sp_Proc2, and then Execute dc.sp_Proc1 again with the same parameters.<br />
- Insert some records into the database. </p>
<p>The problem is, the first time you execute the sproc, it caches the result. This would be okay for most instances, but in mine - I&#8217;m actually after the updated result. </p>
<p>A quick bit of googling revealed <a href="http://www.rocksthoughts.com/blog/archive/2008/01/14/linq-to-sql-caching-gotcha.aspx">this post by Chris Rock</a>.  This approach of &#8220;turn off object tracking&#8221; works Ok if you don&#8217;t need to insert records on that Data Context.  </p>
<p>My quick, dirty, and (possibly) really wrong approach was just to spin up a new Data Context, and re-execute that sproc. </p>
<p>I promise I&#8217;ll find a more sane way of fixing this <img src='http://will.hughesfamily.net.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080624/linq-to-sql-caching-gotcha/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQ to SQL Learnings: Getting rid of the CRUD</title>
		<link>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-getting-rid-of-the-crud/</link>
		<comments>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-getting-rid-of-the-crud/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 18:39:52 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Coding]]></category>

		<category><![CDATA[LINQ]]></category>

		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-getting-rid-of-the-crud/</guid>
		<description><![CDATA[With many web 2.0 applications there&#8217;s a basic three-tier architecture..&#160;&#160; In our case the client is a Flex 3/Caringorm application, the Services are WCF/ASP.NET Web Services, and the Database SQL 2005. 
One of the typical approaches to creating Web Services for this type of system is to use a CRUD type pattern. That is: all [...]]]></description>
			<content:encoded><![CDATA[<p>With many web 2.0 applications there&#8217;s a basic three-tier architecture..&nbsp;&nbsp; <a href="http://will.hughesfamily.net.au/20080308/linq-to-sql-wcf-json-and-flex-oh-my/">In our case</a> the client is a Flex 3/Caringorm application, the Services are WCF/ASP.NET Web Services, and the Database SQL 2005. </p>
<p>One of the typical approaches to creating Web Services for this type of system is to use a CRUD type pattern. That is: all methods are based around either Creating, Retrieving, Updating, or Deleting records.&nbsp; In most usually done on a per-table basis, and means that you&#8217;re effectively making the Web Services a HTTP enabled SQL client. </p>
<p>For our situation, this wasn&#8217;t really appropriate for a number of reasons, including complex relationships between tables, and a need to reduce the amount of network traffic. </p>
<p>Another concern, although relatively minor, is to reduce the amount of work needed by the Flex team to implement the Web Services.&nbsp; </p>
<p>Ideally, we wanted to be able to share business objects as widely as possible, to reduce the amount of rework needed by everyone involved in implementing the interfaces. </p>
<p>Therefore we chose to go with task, or semantic based methods, and using the objects as needed by the Flex front-end.&nbsp; The work of validation, and mapping to appropriate tables would be done by the Web services. </p>
<p>An example of this might be that a Document had many properties, such as Media Items (pictures, video, etc), Tags, Authors, etc.&nbsp; However, within the database there might be a necessity to track Document Versions, What versions are Live, the relationships between Documents, Document Versions and Media Items.&nbsp; </p>
<p>Because the objects that I needed to send/receive didn&#8217;t match the objects that needed to be saved in the database, I needed to write a lot of &#8220;left hand/right hand code&#8221;: ServiceDocument.Property =&nbsp;&nbsp; SQLDocument.Property.&nbsp; Most of this was fairly simple code to write, but tracking the places where this takes place can be grow to become quite a challenge when the solution grows to dozens of tables. </p>
<p>This is an approximate list of what I need to do to add a property to one table:</p>
<ul>
<li>Add the Property to the Service Types</li>
<li>Add conversion pieces to transpose the Service Type to/from the LINQ to SQL Object equivalents. </li>
<li>Add the column to the Table in the Database Model for LINQ to SQL</li>
<li>Add the column to all Stored Procedures in the Database Model which reference this, removing and re-adding them if this means new properties too.&nbsp; Don&#8217;t forget to ensure the return types on the re-added Stored Procedures are set correctly. </li>
<li>Add the columns to the actual Stored Procedures, update parameters, etc</li>
<li>Add the column to the actual Table </li>
</ul>
<p>I can only imagine the Version Control conflict chaos that would ensue if you had several people making these changes concurrently. </p>
<p>I highly recommend grouping changes into a per-table basis, because it can take a while to go through all the additional pieces you have referencing the LINQ to SQL and Service Type object equivilents. </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-getting-rid-of-the-crud/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQ to SQL Learnings: SPROC or not SPROC?</title>
		<link>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sproc-or-not-sproc/</link>
		<comments>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sproc-or-not-sproc/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 17:49:46 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[Randomness]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sproc-or-not-sproc/</guid>
		<description><![CDATA[With databases in many organisations, there&#8217;s a rule that&#8217;s carved in stone: 
Thou shalt use Stored Procedures for all table access. 

Regardless of your position on this, some clients just don&#8217;t give us any other option. The application is never given direct table access, and anything that doesn&#8217;t go through a stored procedure just generates [...]]]></description>
			<content:encoded><![CDATA[<p>With databases in many organisations, there&#8217;s a rule that&#8217;s carved in stone: </p>
<blockquote><p><font size="5"><em>Thou shalt use Stored Procedures for <u>all</u> table access. </em></font></p>
</blockquote>
<p>Regardless of your position on this, some clients just don&#8217;t give us any other option. The application is never given direct table access, and anything that doesn&#8217;t go through a stored procedure just generates errors.&nbsp; This could be because they&#8217;re enforcing access control on the data to a finer level than just table level, or because they need to ensure records are kept of all confidential information. </p>
<p>The picture for LINQ to SQL with this situation appears at first to be rather rosy, through two things: </p>
<ol>
<li>You can assign sprocs that handle <a href="http://weblogs.asp.net/scottgu/archive/2007/08/23/linq-to-sql-part-7-updating-our-database-using-stored-procedures.aspx">inserts, updates, and deletes against your tables</a>.
<li>You can <a href="http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx">directly execute sprocs as methods in your application</a>. So, you can select data out of tables via this method. </li>
</ol>
<p>Both of these things, are true. However, what doesn&#8217;t get mentioned is that LINQ to SQL will still perform reads (using dynamic SQL) from your database if you (for example) try to access children of a relationship, or insert/update rows**. That is: You can&#8217;t stop additional queries against the database. </p>
<p>So, as far as I can tell - <strong>this means LINQ to SQL, as it stands, cannot be used for these situations</strong>. Ofcourse, this doesn&#8217;t prevent me from using LINQ to XML, LINQ to Entities, etc - it just means that our ways of executing SQL still have not advanced. </p>
<p>There&#8217;s a possible way I think this could be fixed, but it really requires a bit of a rethink as to how LINQ to SQL works - perhaps this could be done as a third party LINQ provider, but really it should be done by Microsoft in LINQ to SQL <em>v.Next</em>. </p>
<p>The way I&#8217;d like to see it fixed, would be for someone to create an analysis tool that runs at publish time, that generates Stored Procedures for all the LINQ statements in your code, and then forces the compiled LINQ commands to map through these sprocs. </p>
<p>This would have the benefit of rapid prototyping/development, and being able to still enforce access through sprocs.&nbsp; </p>
<p>* = Well, there might be a way, but I&#8217;ve not yet found it. <br />** = It does select&#8217;s to get the updated column values from, for example, computed columns. </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sproc-or-not-sproc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQ to SQL Learnings: SqlDateTime Overflow on Autogenerated Column</title>
		<link>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sqldatetime-overflow-on-autogenerated-column/</link>
		<comments>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sqldatetime-overflow-on-autogenerated-column/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 17:10:11 +0000</pubDate>
		<dc:creator>Will</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Coding]]></category>

		<category><![CDATA[IT]]></category>

		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sqldatetime-overflow-on-autogenerated-column/</guid>
		<description><![CDATA[This is the first in (hopefully) a series of quick things I&#8217;ve picked up whilst tackling the previously mentioned project.&#160; 
So, I have a table something like this: 
CREATE TABLE [dbo].[Product](&#160; [ProductID] [int] IDENTITY(1,1) NOT NULL, &#160; [Name] [nvarchar](100) NOT NULL,&#160;&#160; [Price] [int] NOT NULL,&#160;&#160;&#160; [LastSaveTimestamp] [datetime] NOT NULL CONSTRAINT [DF_Product_SaveTimestamp]&#160; DEFAULT (getutcdate())) ON [PRIMARY]
The [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first in (hopefully) a series of quick things I&#8217;ve picked up whilst tackling the <a href="http://will.hughesfamily.net.au/20080308/linq-to-sql-wcf-json-and-flex-oh-my/">previously mentioned project</a>.&nbsp; </p>
<p>So, I have a table something like this: </p>
<p><span style="font-size: 10pt; color: blue">CREATE</span><span style="font-size: 10pt"> <span style="color: blue">TABLE</span> [dbo]<span style="color: gray">.</span>[Product]<span style="color: gray">(<br />&nbsp; </span></span><span style="font-size: 10pt">[ProductID] [int] <span style="color: blue">IDENTITY</span><span style="color: gray">(</span>1<span style="color: gray">,</span>1<span style="color: gray">)</span> <span style="color: gray">NOT</span> <span style="color: gray">NULL, <br />&nbsp; </span></span><span style="font-size: 10pt">[Name] [nvarchar]<span style="color: gray">(</span>100<span style="color: gray">)</span> <span style="color: gray">NOT</span> <span style="color: gray">NULL,</span></span><br />&nbsp;&nbsp; <span style="font-size: 10pt">[Price] [int] <span style="color: gray">NOT</span> <span style="color: gray">NULL,</span></span><br />&nbsp;&nbsp;&nbsp; <span style="font-size: 10pt">[LastSaveTimestamp] [datetime] <span style="color: gray">NOT</span> <span style="color: gray">NULL</span> <span style="color: blue">CONSTRAINT</span> [DF_Product_SaveTimestamp<wbr>]&nbsp; <span style="color: blue">DEFAULT</span> <span style="color: gray">(</span><span style="color: fuchsia">getutcdate</span><span style="color: gray">())<br /></span></span><span style="font-size: 10pt; color: gray">)</span><span style="font-size: 10pt"> <span style="color: blue">ON</span> [PRIMARY]</span></p>
<p><span style="font-size: 10pt">The key here is the default value on the column: LastSaveTimestamp. </span></p>
<p><span style="font-size: 10pt">If I then try to, say insert a new column into this table, for example using this code: </span></p>
<p><span style="font-size: 10pt"><span style="color: rgb(43,145,175)">&nbsp; DatabaseContext</span> dc = <span style="color: blue">new</span> <span style="color: rgb(43,145,175)">DatabaseContext</span>(); <br /></span><span style="font-size: 10pt">&nbsp; <span style="color: rgb(43,145,175)">Product</span> product = <span style="color: blue">new</span> <span style="color: rgb(43,145,175)">Product</span>();<br /></span><span style="font-size: 10pt">&nbsp; product.Name = <span style="color: rgb(163,21,21)">&#8220;test product&#8221;</span>;<br /></span><span style="font-size: 10pt">&nbsp; product.Price = 50;<br /></span><span style="font-size: 10pt">&nbsp; dc.Products.InsertOnSubmit<wbr>(product);<br /></span><span style="font-size: 10pt">&nbsp; dc.SubmitChanges(System<wbr>.Data.Linq.<span style="color: rgb(43,145,175)">ConflictMode</span>.FailOnFirstConflict);</span></p>
<p><span style="font-size: 10pt">Then I&#8217;d get an exception like: </span></p>
<blockquote><p><span style="font-size: 10pt"></span>System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM..</p>
</blockquote>
<p>The fix is actually really simple - In the table designer / DBML, you need to tell it that the column is auto-generated. Unfortunately this doesn&#8217;t seem to be automatically detected. It&#8217;s one of a few &#8216;just plain weird&#8217; situations.&nbsp; </p>
<p>AzamSharp has the <a href="http://geekswithblogs.net/AzamSharp/archive/2008/01/10/118446.aspx">fix details</a>, with a handy-dandy screenshot over on his blog. </p>
]]></content:encoded>
			<wfw:commentRss>http://will.hughesfamily.net.au/20080609/linq-to-sql-learnings-sqldatetime-overflow-on-autogenerated-column/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.491 seconds -->
