<?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>Roybott.com &#187; Azure Tables</title>
	<atom:link href="http://roybott.com/index.php/tag/azure-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://roybott.com</link>
	<description>The Home of Roy Herrod</description>
	<lastBuildDate>Sat, 03 Apr 2010 12:01:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rename PartitionKey and RowKey in Azure Tables</title>
		<link>http://roybott.com/index.php/2009/07/01/rename-partitionkey-and-rowkey-in-azure-tables/</link>
		<comments>http://roybott.com/index.php/2009/07/01/rename-partitionkey-and-rowkey-in-azure-tables/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 23:21:13 +0000</pubDate>
		<dc:creator>Roybott</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure Tables]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://roybott.com/?p=201</guid>
		<description><![CDATA[I'm currently having a play around with some Windows Azure bits and whilst doing so have been looking into using the Azure table storage.

One requirement of Azure table storage is the use of a PartitionKey and a RowKey, both of which when combined uniquely identify an entity in the Azure table. As the use of a good PartitionKey can lead to many benefits in terms of scaling it is a good idea to use a useful property of an object as the partition key, however the partition key must be called 'PartitionKey' which leads to a situation where an important property within a class is simply called 'PartitionKey' and to know what that property represents you have to either remember it or keep checking your comments.

At first I attempted to simply create a property to wrap the partition key like so:]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently having a play around with some <a href="http://www.microsoft.com/azure/default.mspx">Windows Azure</a> bits and whilst doing so have been looking into using the Azure table storage.</p>
<p>One requirement of Azure table storage is the use of a PartitionKey and a RowKey, both of which when combined uniquely identify an entity in the Azure table. As the use of a good PartitionKey can lead to <a href="http://go.microsoft.com/fwlink/?LinkId=153401">many benefits in terms of scaling</a> it is a good idea to use a useful property of an object as the partition key, however the partition key must be called &#8216;PartitionKey&#8217; which leads to a situation where an important property within a class is simply called &#8216;PartitionKey&#8217; and to know what that property represents you have to either remember it or keep checking your comments.</p>
<p>At first I attempted to simply create a property to wrap the partition key like so:<br />
<span id="more-201"></span></p>
<pre name="code" class="C-Sharp">public string Name
{
    get
    {
        return this.PartitionKey;
    }
    set
    {
        this.PartitionKey = value.ToString();
    }
}</pre>
<p>but unfortunately due to the way that the Azure table builder works this means that the created tables actually have duplicated data stored, the same data under the column &#8216;Name&#8217; and &#8216;PartitionKey&#8217;.</p>
<p>After what was actually a surprisingly quick <a href="http://www.bing.com/search?q=Azure+Tables+rename+partitionkey&amp;form=QBRE&amp;filt=all&amp;qs=n">search around on Bing</a> I found out that while there is not really a proper way to achieve what I wanted, there is a <a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/4b25d357-b8ec-4c87-bc14-1e1fc29c98fe/">simple work around</a> which is to set the created property to be internal.</p>
<pre name="code" class="C-Sharp">internal string Name
{
    get
    {
        return this.PartitionKey;
    }
    set
    {
        this.PartitionKey = value.ToString();
    }
}</pre>
<p>This prevents it being seen from by the Azure table builder and so does not duplicate the properties when creating the table. However as you may have guessed by specifying these as internal they are not accessible from a different project and so must be in the same project as the code using them.</p>
<p>Alternatively if you need to share them across projects then you could create a wrapper for the class&#8230; I&#8217;m going to give this approach a try unless anyone can think of a better way?</p>
]]></content:encoded>
			<wfw:commentRss>http://roybott.com/index.php/2009/07/01/rename-partitionkey-and-rowkey-in-azure-tables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
