<?xml version="1.0" encoding="utf-8"?>
<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/" version="2.0">
  <channel>
    <title>Extemporaneous Mumblings</title>
    <link>http://dunnry.com/blog/</link>
    <description>... a blog by Ryan Dunn</description>
    <language>en-us</language>
    <copyright>Ryan Dunn</copyright>
    <lastBuildDate>Fri, 14 Nov 2008 19:08:33 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>ryan@dunnry.com</managingEditor>
    <webMaster>ryan@dunnry.com</webMaster>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=1bb8c7fc-10cf-4d9a-81be-49c2b585ad29</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,1bb8c7fc-10cf-4d9a-81be-49c2b585ad29.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,1bb8c7fc-10cf-4d9a-81be-49c2b585ad29.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1bb8c7fc-10cf-4d9a-81be-49c2b585ad29</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you downloaded the <a href="http://dunnry.com/blog/AzureServicesTrainingKitNdashPDCPreview.aspx">Azure
Services Training Kit</a> (which you should), you would find a compilation error on
some of the SQL Data Services HOLs.
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/FixingtheSDSHOLfromAzureTrainingKit_9CAD/image_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/FixingtheSDSHOLfromAzureTrainingKit_9CAD/image_thumb.png" width="443" height="227" />
          </a>
        </p>
        <p>
The error is somewhat self-explanatory:  the solution is missing the AjaxControlToolkit. 
The reason that this file is missing is not because we forgot it, but rather our automated
packaging tool was trying to be helpful.  You see, we have a tool that cleans
up the solutions by deleting the 'bin' and 'obj' folders and any .pdb files in the
solution before packaging.  In this case, it killed the bin directory where the
AjaxControlToolkit.dll was deployed.
</p>
        <p>
To fix this error, you just need to visit <a href="http://www.codeplex.com/AjaxControlToolkit">AjaxControlToolkit</a> project
on CodePlex and download it again.  The easiest way is to download the <a href="http://www.codeplex.com/AjaxControlToolkit/Release/ProjectReleases.aspx?ReleaseId=16488">AjaxControlToolkit-Framework3.5Sp1-DllOnly.zip</a>,
extract the 'Bin' directory and copy it in to the root of the solution you are trying
to use.
</p>
        <p>
Sorry about that - we will fix it for our next release.
</p>
        <p>
(updated: added link)
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=1bb8c7fc-10cf-4d9a-81be-49c2b585ad29" />
      </body>
      <title>Fixing the SDS HOL from Azure Training Kit</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,1bb8c7fc-10cf-4d9a-81be-49c2b585ad29.aspx</guid>
      <link>http://dunnry.com/blog/FixingTheSDSHOLFromAzureTrainingKit.aspx</link>
      <pubDate>Fri, 14 Nov 2008 19:08:33 GMT</pubDate>
      <description>&lt;p&gt;
If you downloaded the &lt;a href="http://dunnry.com/blog/AzureServicesTrainingKitNdashPDCPreview.aspx"&gt;Azure
Services Training Kit&lt;/a&gt; (which you should), you would find a compilation error on
some of the SQL Data Services HOLs.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/FixingtheSDSHOLfromAzureTrainingKit_9CAD/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/FixingtheSDSHOLfromAzureTrainingKit_9CAD/image_thumb.png" width="443" height="227" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The error is somewhat self-explanatory:&amp;#160; the solution is missing the AjaxControlToolkit.&amp;#160;
The reason that this file is missing is not because we forgot it, but rather our automated
packaging tool was trying to be helpful.&amp;#160; You see, we have a tool that cleans
up the solutions by deleting the 'bin' and 'obj' folders and any .pdb files in the
solution before packaging.&amp;#160; In this case, it killed the bin directory where the
AjaxControlToolkit.dll was deployed.
&lt;/p&gt;
&lt;p&gt;
To fix this error, you just need to visit &lt;a href="http://www.codeplex.com/AjaxControlToolkit"&gt;AjaxControlToolkit&lt;/a&gt; project
on CodePlex and download it again.&amp;#160; The easiest way is to download the &lt;a href="http://www.codeplex.com/AjaxControlToolkit/Release/ProjectReleases.aspx?ReleaseId=16488"&gt;AjaxControlToolkit-Framework3.5Sp1-DllOnly.zip&lt;/a&gt;,
extract the 'Bin' directory and copy it in to the root of the solution you are trying
to use.
&lt;/p&gt;
&lt;p&gt;
Sorry about that - we will fix it for our next release.
&lt;/p&gt;
&lt;p&gt;
(updated: added link)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=1bb8c7fc-10cf-4d9a-81be-49c2b585ad29" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,1bb8c7fc-10cf-4d9a-81be-49c2b585ad29.aspx</comments>
      <category>Azure</category>
      <category>Cloud Services</category>
      <category>SDS</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=7263bb20-2dbc-45cd-9536-5a6574bf1b08</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,7263bb20-2dbc-45cd-9536-5a6574bf1b08.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,7263bb20-2dbc-45cd-9536-5a6574bf1b08.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7263bb20-2dbc-45cd-9536-5a6574bf1b08</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The <a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=413e88f8-5966-4a83-b309-53b7b77edf78&amp;displayLang=en" target="_blank">Azure
Services Training kit</a> contains the hands on labs used at PDC along with presentations
and demos.  We will continue to update this training kit with more demos, samples,
and labs as they are built out.  This kit is a great way to try out the technologies
in the Azure Services Platform at your own pace through the hands on labs.
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesTrainingKitPDCPreview_EB41/image_2.png">
            <img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="415" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesTrainingKitPDCPreview_EB41/image_thumb.png" width="416" border="0" />
          </a>
        </p>
        <p>
You will need a token in order to run a few of the labs (specifically the .NET Services
labs, the SQL Data Services labs, and one of the Live Services labs).  The Windows
Azure labs use the local dev fabric so no token is necessary.  Once you install
the kit, it will launch the browser with a navigation UI to find all the content within. 
If you need an account, simply click the large blue box labeled 'Try it now' and follow
the links to register at Microsoft Connect.
</p>
        <p>
Happy Cloud Services.
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=7263bb20-2dbc-45cd-9536-5a6574bf1b08" />
      </body>
      <title>Azure Services Training Kit &amp;ndash; PDC Preview</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,7263bb20-2dbc-45cd-9536-5a6574bf1b08.aspx</guid>
      <link>http://dunnry.com/blog/AzureServicesTrainingKitNdashPDCPreview.aspx</link>
      <pubDate>Fri, 14 Nov 2008 00:44:56 GMT</pubDate>
      <description>&lt;p&gt;
The &lt;a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=413e88f8-5966-4a83-b309-53b7b77edf78&amp;amp;displayLang=en" target="_blank"&gt;Azure
Services Training kit&lt;/a&gt; contains the hands on labs used at PDC along with presentations
and demos.&amp;#160; We will continue to update this training kit with more demos, samples,
and labs as they are built out.&amp;#160; This kit is a great way to try out the technologies
in the Azure Services Platform at your own pace through the hands on labs.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesTrainingKitPDCPreview_EB41/image_2.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="415" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesTrainingKitPDCPreview_EB41/image_thumb.png" width="416" border="0" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
You will need a token in order to run a few of the labs (specifically the .NET Services
labs, the SQL Data Services labs, and one of the Live Services labs).&amp;#160; The Windows
Azure labs use the local dev fabric so no token is necessary.&amp;#160; Once you install
the kit, it will launch the browser with a navigation UI to find all the content within.&amp;#160;
If you need an account, simply click the large blue box labeled 'Try it now' and follow
the links to register at Microsoft Connect.
&lt;/p&gt;
&lt;p&gt;
Happy Cloud Services.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=7263bb20-2dbc-45cd-9536-5a6574bf1b08" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,7263bb20-2dbc-45cd-9536-5a6574bf1b08.aspx</comments>
      <category>Azure</category>
      <category>Cloud Services</category>
      <category>SDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=6caf18a6-fc97-483e-b3ca-0a4af4968228</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,6caf18a6-fc97-483e-b3ca-0a4af4968228.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,6caf18a6-fc97-483e-b3ca-0a4af4968228.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6caf18a6-fc97-483e-b3ca-0a4af4968228</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I finally got around to doing a quick refresh on the <a href="http://code.msdn.microsoft.com/ssdsrest">SSDS
REST Library</a>.  It should now be called SDS REST library of course, but I
doubt I will change the name as that would break the URL in Code Gallery.
</p>
        <p>
I am calling this one a 'Refresh' release because I am not adding any features. 
The purpose of this release was to fix the serialization such that it runs in partial
trust.  Partial trust support is desirable because that means you can use this
library in Windows Azure projects.
</p>
        <p>
I found out an interesting fact while working on this about the XmlSerializer. 
First, serializing a generic type, in this case <strong>SsdsEntity&lt;T&gt;</strong> works
just fine in partial trust.  However, deserializing that exact same type will
not work without Full trust.  To fix it, I had to actually remove any and all
code that tried to do it.  Instead, I deserialized the <strong>T</strong> in <strong>SsdsEntity&lt;T&gt;</strong> and
manually created the <strong>SsdsEntity</strong> part.  You can see those updates
in the <strong>SsdsEntitySerializer</strong> class as well as the <strong>SsdsEntity&lt;T&gt;
Attributes </strong>property in the setter if you check.  I don't see any problems
with my solution, and in fact, it may end up being more efficient.
</p>
        <p>
Remaining work to do:  implement the JOIN, OrderBy, and TOP operations (if I
find the time).
</p>
        <p>
Get it here:  <a href="http://code.msdn.microsoft.com/ssdsrest">SDS REST Library</a></p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=6caf18a6-fc97-483e-b3ca-0a4af4968228" />
      </body>
      <title>Refreshed REST library for SQL Data Services</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,6caf18a6-fc97-483e-b3ca-0a4af4968228.aspx</guid>
      <link>http://dunnry.com/blog/RefreshedRESTLibraryForSQLDataServices.aspx</link>
      <pubDate>Wed, 12 Nov 2008 02:46:19 GMT</pubDate>
      <description>&lt;p&gt;
I finally got around to doing a quick refresh on the &lt;a href="http://code.msdn.microsoft.com/ssdsrest"&gt;SSDS
REST Library&lt;/a&gt;.&amp;#160; It should now be called SDS REST library of course, but I
doubt I will change the name as that would break the URL in Code Gallery.
&lt;/p&gt;
&lt;p&gt;
I am calling this one a 'Refresh' release because I am not adding any features.&amp;#160;
The purpose of this release was to fix the serialization such that it runs in partial
trust.&amp;#160; Partial trust support is desirable because that means you can use this
library in Windows Azure projects.
&lt;/p&gt;
&lt;p&gt;
I found out an interesting fact while working on this about the XmlSerializer.&amp;#160;
First, serializing a generic type, in this case &lt;strong&gt;SsdsEntity&amp;lt;T&amp;gt;&lt;/strong&gt; works
just fine in partial trust.&amp;#160; However, deserializing that exact same type will
not work without Full trust.&amp;#160; To fix it, I had to actually remove any and all
code that tried to do it.&amp;#160; Instead, I deserialized the &lt;strong&gt;T&lt;/strong&gt; in &lt;strong&gt;SsdsEntity&amp;lt;T&amp;gt;&lt;/strong&gt; and
manually created the &lt;strong&gt;SsdsEntity&lt;/strong&gt; part.&amp;#160; You can see those updates
in the &lt;strong&gt;SsdsEntitySerializer&lt;/strong&gt; class as well as the &lt;strong&gt;SsdsEntity&amp;lt;T&amp;gt;
Attributes &lt;/strong&gt;property in the setter if you check.&amp;#160; I don't see any problems
with my solution, and in fact, it may end up being more efficient.
&lt;/p&gt;
&lt;p&gt;
Remaining work to do:&amp;#160; implement the JOIN, OrderBy, and TOP operations (if I
find the time).
&lt;/p&gt;
&lt;p&gt;
Get it here:&amp;#160; &lt;a href="http://code.msdn.microsoft.com/ssdsrest"&gt;SDS REST Library&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=6caf18a6-fc97-483e-b3ca-0a4af4968228" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,6caf18a6-fc97-483e-b3ca-0a4af4968228.aspx</comments>
      <category>Cloud Services</category>
      <category>SDS</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=2a0a2f0c-8ab2-4711-9939-cbdf28b236c9</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,2a0a2f0c-8ab2-4711-9939-cbdf28b236c9.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,2a0a2f0c-8ab2-4711-9939-cbdf28b236c9.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2a0a2f0c-8ab2-4711-9939-cbdf28b236c9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
During PDC, I was lucky enough to <a href="http://channel9.msdn.com/posts/dunnry/NeoGeo-on-building-with-SQL-Data-Services/">film
a short video</a> with <a href="http://www.theregion.com/profile.aspx?rd=1339">Marc
Hoeppner</a>, one of the Regional Directors from Germany and the Managing Director
of <a href="http://www.neogeo.com/en/">NeoGeo New Media GmbH</a>.  Marc was involved
very early with SQL Data Services and has provided some valuable feedback to us on
features and direction.
</p>
        <p>
I managed to get Marc to show me his company's media asset management product, <a href="http://www.neogeo.com/en/neomediacenter/index.aspx?nav=0&amp;tab=0">neoMediaCenter.NET</a>. 
What struck me during this interview was how his team did a hybrid approach to cloud
services.  That is, their original product uses SQL Server on the backend for
storage and querying.  Instead of forcing customers to make an either/or decision,
they took the approach of offering both.  You can move your data seamlessly between
the cloud or the on-premises database.  
</p>
        <p>
There are some real advantages to using SQL Data Services for this product: namely,
with a click, you can move the data to the cloud where it can essentially be archived
forever, but still available for consumption.  We like to term this 'cold storage'. 
Imagine the model where you have thousands and thousands of digital assets. 
For the assets that are temporally relevant, you can store them in the local on-premises
database for the least latency.  However, as the data ages, it tends to be used
less and less frequently.  Today, companies either invest in a bunch of new storage,
archive it off to tape, or just delete the content once it gets to a certain age. 
Instead of forcing customers to make one of these choices, Marc has added the capability
to move this data out of the on-premises store and out to the cloud seamlessly. 
It still appears in the application, but is served from the cloud.  This makes
accessing this data simple (unlike tape or deleting it) as well as relatively inexpensive
(unlike buying more disk space yourself).
</p>
        <p>
Once we have multiple datacenters up and operational, you also get the geo-location
aspect of this for free.  It may be the case that for certain sets of distributed
customers, using the geo-located data is in fact faster than accessing the data on-premises
as well.
</p>
        <p>
This is a very cool demo.  If you watch towards the end, Marc shows a CIFS provider
for SDS that allows you to mount SDS just like a mapped network drive.  Marc
mentions it in the video, but he managed to build all this functionality in just a
week!  It is interesting to note that Marc's team also made use of the <a href="http://code.msdn.microsoft.com/ssdsrest">SSDS
REST library</a> that provided the LINQ and strongly typed abstraction for querying
and working with SDS (it was named before SDS, hence SSDS still).  I am happy
to see that of course since I had a bit to do with that library. :)
</p>
        <p>
          <a href="http://channel9.msdn.com/posts/dunnry/NeoGeo-on-building-with-SQL-Data-Services/">Watch
it here</a>
        </p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=2a0a2f0c-8ab2-4711-9939-cbdf28b236c9" />
      </body>
      <title>NeoGeo on Building with SDS</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,2a0a2f0c-8ab2-4711-9939-cbdf28b236c9.aspx</guid>
      <link>http://dunnry.com/blog/NeoGeoOnBuildingWithSDS.aspx</link>
      <pubDate>Tue, 04 Nov 2008 21:53:08 GMT</pubDate>
      <description>&lt;p&gt;
During PDC, I was lucky enough to &lt;a href="http://channel9.msdn.com/posts/dunnry/NeoGeo-on-building-with-SQL-Data-Services/"&gt;film
a short video&lt;/a&gt; with &lt;a href="http://www.theregion.com/profile.aspx?rd=1339"&gt;Marc
Hoeppner&lt;/a&gt;, one of the Regional Directors from Germany and the Managing Director
of &lt;a href="http://www.neogeo.com/en/"&gt;NeoGeo New Media GmbH&lt;/a&gt;.&amp;#160; Marc was involved
very early with SQL Data Services and has provided some valuable feedback to us on
features and direction.
&lt;/p&gt;
&lt;p&gt;
I managed to get Marc to show me his company's media asset management product, &lt;a href="http://www.neogeo.com/en/neomediacenter/index.aspx?nav=0&amp;amp;tab=0"&gt;neoMediaCenter.NET&lt;/a&gt;.&amp;#160;
What struck me during this interview was how his team did a hybrid approach to cloud
services.&amp;#160; That is, their original product uses SQL Server on the backend for
storage and querying.&amp;#160; Instead of forcing customers to make an either/or decision,
they took the approach of offering both.&amp;#160; You can move your data seamlessly between
the cloud or the on-premises database.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
There are some real advantages to using SQL Data Services for this product: namely,
with a click, you can move the data to the cloud where it can essentially be archived
forever, but still available for consumption.&amp;#160; We like to term this 'cold storage'.&amp;#160;
Imagine the model where you have thousands and thousands of digital assets.&amp;#160;
For the assets that are temporally relevant, you can store them in the local on-premises
database for the least latency.&amp;#160; However, as the data ages, it tends to be used
less and less frequently.&amp;#160; Today, companies either invest in a bunch of new storage,
archive it off to tape, or just delete the content once it gets to a certain age.&amp;#160;
Instead of forcing customers to make one of these choices, Marc has added the capability
to move this data out of the on-premises store and out to the cloud seamlessly.&amp;#160;
It still appears in the application, but is served from the cloud.&amp;#160; This makes
accessing this data simple (unlike tape or deleting it) as well as relatively inexpensive
(unlike buying more disk space yourself).
&lt;/p&gt;
&lt;p&gt;
Once we have multiple datacenters up and operational, you also get the geo-location
aspect of this for free.&amp;#160; It may be the case that for certain sets of distributed
customers, using the geo-located data is in fact faster than accessing the data on-premises
as well.
&lt;/p&gt;
&lt;p&gt;
This is a very cool demo.&amp;#160; If you watch towards the end, Marc shows a CIFS provider
for SDS that allows you to mount SDS just like a mapped network drive.&amp;#160; Marc
mentions it in the video, but he managed to build all this functionality in just a
week!&amp;#160; It is interesting to note that Marc's team also made use of the &lt;a href="http://code.msdn.microsoft.com/ssdsrest"&gt;SSDS
REST library&lt;/a&gt; that provided the LINQ and strongly typed abstraction for querying
and working with SDS (it was named before SDS, hence SSDS still).&amp;#160; I am happy
to see that of course since I had a bit to do with that library. :)
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://channel9.msdn.com/posts/dunnry/NeoGeo-on-building-with-SQL-Data-Services/"&gt;Watch
it here&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=2a0a2f0c-8ab2-4711-9939-cbdf28b236c9" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,2a0a2f0c-8ab2-4711-9939-cbdf28b236c9.aspx</comments>
      <category>Cloud Services</category>
      <category>SDS</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=b955bd31-f862-4ea4-bce8-5454d158bdea</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,b955bd31-f862-4ea4-bce8-5454d158bdea.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,b955bd31-f862-4ea4-bce8-5454d158bdea.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b955bd31-f862-4ea4-bce8-5454d158bdea</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It might not be entirely obvious to some folks how the integration with SQL Data Services
and Azure Access Control Service works.  I thought I would walk you through a
simple example.
</p>
        <p>
First, let me set the stage that at this point the integration between the services
is a bit nascent.  We are working towards a more fully featured authorization
model with SDS and Access Control, but it is not there today.
</p>
        <h2>Authentication
</h2>
        <p>
I will group the authentication today into two forms:  the basic authentication
used by SDS directly and the authentication used by Access Control.  While the
two may look similar in the case of username and password, they are, in fact, not. 
The idea is that eventually, the direct authentication to SDS using basic authentication
(username/pwd) will eventually go away.  Only authentication via Access Control
will survive going forward.  For most folks, this is not a super big change in
the application.  While we don't have the REST story baked yet in the current
CTP, we have support today in SOAP to show you how this looks.
</p>
        <h2>Preparing your Azure .NET Services Solution
</h2>
        <p>
In order to use any of these methods, you must of course have provisioned an account
for the CTP of Azure Services Platform and .NET Services in particular.  To do
this, you must register at <a href="http://www.azure.com">http://www.azure.com</a> and
work through Microsoft Connect to get an invitation code.  PDC attendees likely
already have this code if they registered on Connect (using the LiveID they registered
for PDC with).  Other folks should still register, but won't get the code as
fast as PDC attendees.  Once you have the invitation code and have created and
provisioned a solution, you need to click the Solution Credentials link and associate
a personal card for CardSpace or a certificate for certificate authentication.
</p>
        <p>
 
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_8.png">
            <img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_3.png" width="235" border="0" />
          </a>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_10.png">
            <img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="166" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_4.png" width="244" border="0" />
          </a>
        </p>
        <p>
Once you have credentials associated with your Azure Service Platform solution, you
can prepare your code to use them.
</p>
        <h2>Adding the Service Reference
</h2>
        <p>
Here is how you add a service reference to your project to get the SOAP proxy and
endpoints necessary to use Access Control.  First, right click your project and
choose Add Service Reference.
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_2.png">
            <img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="325" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb.png" width="404" border="0" />
          </a>
        </p>
        <p>
In the address, use <a href="https://database.windows.net/soap/v1/">https://database.windows.net/soap/v1/</a>. 
Note the trailing '/' in the URL.  Also, notice it is not using 'data.database.windows.net',
but just 'database.windows.net'.  Next, name the proxy - I called mine 'SdsProxy'.
</p>
        <p>
Click the <strong>Advanced</strong> button and choose <strong>System.Collections.Generic.List</strong> from
the collection type dropdown list.
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_4.png">
            <img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="373" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_1.png" width="403" border="0" />
          </a>  
</p>
        <p>
Once you have clicked OK a few times, you will get an app.config in your project that
contains a number of bindings and endpoints.  Take a moment to see the new endpoints:
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_6.png">
            <img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="255" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_2.png" width="440" border="0" />
          </a> 
</p>
        <p>
There are 3 bindings right now: basicHttpBinding (used for basic authentication directly
against SDS), as well as customBinding and wsHttpBinding, which are used with the
Access Control service .  There are also 4 endpoints added for the client:
</p>
        <ol>
          <li>
BasicAuthEndpoint used for basic authentication with SDS directly. 
</li>
          <li>
UsernameTokenEndpoint used for authentication against Access Control (happens to be
same username and password as #1 however). 
</li>
          <li>
CertificateTokenEndpoint used for authentication against Access Control via certificate
and finally 
</li>
          <li>
CardSpaceTokenEndpoint used for authentication against Access Control via Cardspace. 
</li>
        </ol>
        <h2>Use the Access Control Service
</h2>
        <p>
At this point, you just need to actually use the service in code.  Here is a
simple example on how to do it.  I am going to create a simple service that does
nothing but queries my authority and I will do it in all three supported Access Control
authentication methods (2-4 above).
</p>
        <h3>Solution and Password
</h3>
        <p>
To use the username/password combination you simply do it exactly like the basic authentication
you are used to, but use the 'UsernameTokenEndpoint' for the SOAP proxy.  It
looks like this:
</p>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var authority = <span style="color: #006080">"yourauthority"</span>; <span style="color: #008000">//Username/Pwd</span> var
proxy = <span style="color: #0000ff">new</span> SitkaSoapServiceClient(<span style="color: #006080">"UsernameTokenEndpoint"</span>);
proxy.ClientCredentials.UserName.UserName = <span style="color: #006080">"solutionname"</span>;
proxy.ClientCredentials.UserName.Password = <span style="color: #006080">"solutionapassword"</span>;
var scope = <span style="color: #0000ff">new</span> Scope() { AuthorityId = authority
}; <span style="color: #008000">//return first 500 containers</span> var results =
proxy.Query(scope, <span style="color: #006080">"from e in entities select e"</span>);
Console.WriteLine(<span style="color: #006080">"Containers via Username/Password:"</span>);
Console.WriteLine(<span style="color: #006080">"================"</span>); <span style="color: #0000ff">foreach</span> (var
item <span style="color: #0000ff">in</span> results) { Console.WriteLine(item.Id);
} Console.WriteLine(<span style="color: #006080">"================"</span>);
proxy.Close();</pre>
        </div>
        <p>
 
</p>
        <p>
        </p>
        <h3>CardSpace
</h3>
        <p>
CardSpace has two tricks to get it working once you set the proxy to 'CardspaceTokenEndpoint'. 
First, you must use the <strong>DisplayInitializeUI</strong> method on the proxy to
trigger the CardSpace prompt.  Next, you must explicitly open the proxy by calling <strong>Open</strong>. 
It looks like this:
</p>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: #008000">//CardSpace</span>
            <span style="color: #008000">//create
a new one for CardSpace</span> proxy = <span style="color: #0000ff">new</span> SitkaSoapServiceClient(<span style="color: #006080">"CardSpaceTokenEndpoint"</span>);
proxy.DisplayInitializationUI(); <span style="color: #008000">//trigger the cardspace
login</span><span style="color: #008000">//need to explicitly open for CardSpace</span> proxy.Open(); <span style="color: #008000">//return
first 500 containers</span> results = proxy.Query(scope, <span style="color: #006080">"from
e in entities select e"</span>); Console.WriteLine(<span style="color: #006080">"Containers
via CardSpace:"</span>); Console.WriteLine(<span style="color: #006080">"================"</span>); <span style="color: #0000ff">foreach</span> (var
item <span style="color: #0000ff">in</span> results) { Console.WriteLine(item.Id);
} Console.WriteLine(<span style="color: #006080">"================"</span>);
proxy.Close();</pre>
        </div>
        <h3> 
</h3>
        <h3>Certificates
</h3>
        <p>
Once you have created a certificate (with private key) and installed it somewhere
on your machine (I used the local machine store in the Personal container (or 'My'
container).  I have also set the self-generated certificate's public key in the
trusted people store on the local machine so it validates.  
</p>
        <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: #008000">//Certificates</span>
            <span style="color: #008000">//create
a new one for Certificates</span> proxy = <span style="color: #0000ff">new</span> SitkaSoapServiceClient(<span style="color: #006080">"CertificateTokenEndpoint"</span>); <span style="color: #008000">//can
also set in config</span> proxy.ClientCredentials.ClientCertificate.SetCertificate( <span style="color: #006080">"CN=localhost"</span>,
StoreLocation.LocalMachine, StoreName.My ); <span style="color: #008000">//return
first 500 containers</span> results = proxy.Query(scope, <span style="color: #006080">"from
e in entities select e"</span>); Console.WriteLine(<span style="color: #006080">"Containers
via Certificates:"</span>); Console.WriteLine(<span style="color: #006080">"================"</span>); <span style="color: #0000ff">foreach</span> (var
item <span style="color: #0000ff">in</span> results) { Console.WriteLine(item.Id);
} Console.WriteLine(<span style="color: #006080">"================"</span>);
proxy.Close();</pre>
        </div>
        <p>
 
</p>
        <p>
The code is very similar, but I am explicitly setting the certificate here in the
proxy credentials.  You can also configure the certificate through config.
</p>
        <p>
And there you have it. using the Azure Access Control service with SQL Data Services. 
As I mentioned earlier, while this is nascent integration today, you can expect going
forward that the Access Control Service will be used to expose a very rich authorization
model in conjunction with SDS.
</p>
        <p>
          <a href="http://cid-4225352e17899c6d.skydrive.live.com/self.aspx/Public/SdsAccessControl.zip">Download
the VS2008 Sample Project</a>
        </p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=b955bd31-f862-4ea4-bce8-5454d158bdea" />
      </body>
      <title>Using SDS with Azure Access Control Service</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,b955bd31-f862-4ea4-bce8-5454d158bdea.aspx</guid>
      <link>http://dunnry.com/blog/UsingSDSWithAzureAccessControlService.aspx</link>
      <pubDate>Sun, 02 Nov 2008 05:15:02 GMT</pubDate>
      <description>&lt;p&gt;
It might not be entirely obvious to some folks how the integration with SQL Data Services
and Azure Access Control Service works.&amp;#160; I thought I would walk you through a
simple example.
&lt;/p&gt;
&lt;p&gt;
First, let me set the stage that at this point the integration between the services
is a bit nascent.&amp;#160; We are working towards a more fully featured authorization
model with SDS and Access Control, but it is not there today.
&lt;/p&gt;
&lt;h2&gt;Authentication
&lt;/h2&gt;
&lt;p&gt;
I will group the authentication today into two forms:&amp;#160; the basic authentication
used by SDS directly and the authentication used by Access Control.&amp;#160; While the
two may look similar in the case of username and password, they are, in fact, not.&amp;#160;
The idea is that eventually, the direct authentication to SDS using basic authentication
(username/pwd) will eventually go away.&amp;#160; Only authentication via Access Control
will survive going forward.&amp;#160; For most folks, this is not a super big change in
the application.&amp;#160; While we don't have the REST story baked yet in the current
CTP, we have support today in SOAP to show you how this looks.
&lt;/p&gt;
&lt;h2&gt;Preparing your Azure .NET Services Solution
&lt;/h2&gt;
&lt;p&gt;
In order to use any of these methods, you must of course have provisioned an account
for the CTP of Azure Services Platform and .NET Services in particular.&amp;#160; To do
this, you must register at &lt;a href="http://www.azure.com"&gt;http://www.azure.com&lt;/a&gt; and
work through Microsoft Connect to get an invitation code.&amp;#160; PDC attendees likely
already have this code if they registered on Connect (using the LiveID they registered
for PDC with).&amp;#160; Other folks should still register, but won't get the code as
fast as PDC attendees.&amp;#160; Once you have the invitation code and have created and
provisioned a solution, you need to click the Solution Credentials link and associate
a personal card for CardSpace or a certificate for certificate authentication.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_8.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_3.png" width="235" border="0" /&gt;&lt;/a&gt; &lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_10.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="166" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_4.png" width="244" border="0" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Once you have credentials associated with your Azure Service Platform solution, you
can prepare your code to use them.
&lt;/p&gt;
&lt;h2&gt;Adding the Service Reference
&lt;/h2&gt;
&lt;p&gt;
Here is how you add a service reference to your project to get the SOAP proxy and
endpoints necessary to use Access Control.&amp;#160; First, right click your project and
choose Add Service Reference.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_2.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="325" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb.png" width="404" border="0" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
In the address, use &lt;a href="https://database.windows.net/soap/v1/"&gt;https://database.windows.net/soap/v1/&lt;/a&gt;.&amp;#160;
Note the trailing '/' in the URL.&amp;#160; Also, notice it is not using 'data.database.windows.net',
but just 'database.windows.net'.&amp;#160; Next, name the proxy - I called mine 'SdsProxy'.
&lt;/p&gt;
&lt;p&gt;
Click the &lt;strong&gt;Advanced&lt;/strong&gt; button and choose &lt;strong&gt;System.Collections.Generic.List&lt;/strong&gt; from
the collection type dropdown list.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_4.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="373" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_1.png" width="403" border="0" /&gt;&lt;/a&gt;&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
Once you have clicked OK a few times, you will get an app.config in your project that
contains a number of bindings and endpoints.&amp;#160; Take a moment to see the new endpoints:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_6.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="255" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/UsingSDSwithAzureAccessControlService_EFDB/image_thumb_2.png" width="440" border="0" /&gt;&lt;/a&gt;&amp;#160;
&lt;/p&gt;
&lt;p&gt;
There are 3 bindings right now: basicHttpBinding (used for basic authentication directly
against SDS), as well as customBinding and wsHttpBinding, which are used with the
Access Control service .&amp;#160; There are also 4 endpoints added for the client:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
BasicAuthEndpoint used for basic authentication with SDS directly. 
&lt;/li&gt;
&lt;li&gt;
UsernameTokenEndpoint used for authentication against Access Control (happens to be
same username and password as #1 however). 
&lt;/li&gt;
&lt;li&gt;
CertificateTokenEndpoint used for authentication against Access Control via certificate
and finally 
&lt;/li&gt;
&lt;li&gt;
CardSpaceTokenEndpoint used for authentication against Access Control via Cardspace. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Use the Access Control Service
&lt;/h2&gt;
&lt;p&gt;
At this point, you just need to actually use the service in code.&amp;#160; Here is a
simple example on how to do it.&amp;#160; I am going to create a simple service that does
nothing but queries my authority and I will do it in all three supported Access Control
authentication methods (2-4 above).
&lt;/p&gt;
&lt;h3&gt;Solution and Password
&lt;/h3&gt;
&lt;p&gt;
To use the username/password combination you simply do it exactly like the basic authentication
you are used to, but use the 'UsernameTokenEndpoint' for the SOAP proxy.&amp;#160; It
looks like this:
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
&lt;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, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;var authority = &lt;span style="color: #006080"&gt;&amp;quot;yourauthority&amp;quot;&lt;/span&gt;; &lt;span style="color: #008000"&gt;//Username/Pwd&lt;/span&gt; var
proxy = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SitkaSoapServiceClient(&lt;span style="color: #006080"&gt;&amp;quot;UsernameTokenEndpoint&amp;quot;&lt;/span&gt;);
proxy.ClientCredentials.UserName.UserName = &lt;span style="color: #006080"&gt;&amp;quot;solutionname&amp;quot;&lt;/span&gt;;
proxy.ClientCredentials.UserName.Password = &lt;span style="color: #006080"&gt;&amp;quot;solutionapassword&amp;quot;&lt;/span&gt;;
var scope = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Scope() { AuthorityId = authority
}; &lt;span style="color: #008000"&gt;//return first 500 containers&lt;/span&gt; var results =
proxy.Query(scope, &lt;span style="color: #006080"&gt;&amp;quot;from e in entities select e&amp;quot;&lt;/span&gt;);
Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Containers via Username/Password:&amp;quot;&lt;/span&gt;);
Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;================&amp;quot;&lt;/span&gt;); &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var
item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; results) { Console.WriteLine(item.Id);
} Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;================&amp;quot;&lt;/span&gt;);
proxy.Close();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;h3&gt;CardSpace
&lt;/h3&gt;
&lt;p&gt;
CardSpace has two tricks to get it working once you set the proxy to 'CardspaceTokenEndpoint'.&amp;#160;
First, you must use the &lt;strong&gt;DisplayInitializeUI&lt;/strong&gt; method on the proxy to
trigger the CardSpace prompt.&amp;#160; Next, you must explicitly open the proxy by calling &lt;strong&gt;Open&lt;/strong&gt;.&amp;#160;
It looks like this:
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
&lt;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, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #008000"&gt;//CardSpace&lt;/span&gt; &lt;span style="color: #008000"&gt;//create
a new one for CardSpace&lt;/span&gt; proxy = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SitkaSoapServiceClient(&lt;span style="color: #006080"&gt;&amp;quot;CardSpaceTokenEndpoint&amp;quot;&lt;/span&gt;);
proxy.DisplayInitializationUI(); &lt;span style="color: #008000"&gt;//trigger the cardspace
login&lt;/span&gt; &lt;span style="color: #008000"&gt;//need to explicitly open for CardSpace&lt;/span&gt; proxy.Open(); &lt;span style="color: #008000"&gt;//return
first 500 containers&lt;/span&gt; results = proxy.Query(scope, &lt;span style="color: #006080"&gt;&amp;quot;from
e in entities select e&amp;quot;&lt;/span&gt;); Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Containers
via CardSpace:&amp;quot;&lt;/span&gt;); Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;================&amp;quot;&lt;/span&gt;); &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var
item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; results) { Console.WriteLine(item.Id);
} Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;================&amp;quot;&lt;/span&gt;);
proxy.Close();&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;&amp;#160;
&lt;/h3&gt;
&lt;h3&gt;Certificates
&lt;/h3&gt;
&lt;p&gt;
Once you have created a certificate (with private key) and installed it somewhere
on your machine (I used the local machine store in the Personal container (or 'My'
container).&amp;#160; I have also set the self-generated certificate's public key in the
trusted people store on the local machine so it validates.&amp;#160; 
&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
&lt;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, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #008000"&gt;//Certificates&lt;/span&gt; &lt;span style="color: #008000"&gt;//create
a new one for Certificates&lt;/span&gt; proxy = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SitkaSoapServiceClient(&lt;span style="color: #006080"&gt;&amp;quot;CertificateTokenEndpoint&amp;quot;&lt;/span&gt;); &lt;span style="color: #008000"&gt;//can
also set in config&lt;/span&gt; proxy.ClientCredentials.ClientCertificate.SetCertificate( &lt;span style="color: #006080"&gt;&amp;quot;CN=localhost&amp;quot;&lt;/span&gt;,
StoreLocation.LocalMachine, StoreName.My ); &lt;span style="color: #008000"&gt;//return
first 500 containers&lt;/span&gt; results = proxy.Query(scope, &lt;span style="color: #006080"&gt;&amp;quot;from
e in entities select e&amp;quot;&lt;/span&gt;); Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Containers
via Certificates:&amp;quot;&lt;/span&gt;); Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;================&amp;quot;&lt;/span&gt;); &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var
item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; results) { Console.WriteLine(item.Id);
} Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;================&amp;quot;&lt;/span&gt;);
proxy.Close();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
The code is very similar, but I am explicitly setting the certificate here in the
proxy credentials.&amp;#160; You can also configure the certificate through config.
&lt;/p&gt;
&lt;p&gt;
And there you have it. using the Azure Access Control service with SQL Data Services.&amp;#160;
As I mentioned earlier, while this is nascent integration today, you can expect going
forward that the Access Control Service will be used to expose a very rich authorization
model in conjunction with SDS.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://cid-4225352e17899c6d.skydrive.live.com/self.aspx/Public/SdsAccessControl.zip"&gt;Download
the VS2008 Sample Project&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=b955bd31-f862-4ea4-bce8-5454d158bdea" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,b955bd31-f862-4ea4-bce8-5454d158bdea.aspx</comments>
      <category>Azure</category>
      <category>Cloud Services</category>
      <category>SDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=64575ccf-85d6-4477-a07e-8a74a8d46c02</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,64575ccf-85d6-4477-a07e-8a74a8d46c02.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,64575ccf-85d6-4477-a07e-8a74a8d46c02.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=64575ccf-85d6-4477-a07e-8a74a8d46c02</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In case anyone was looking for a feature rich management tool for their Azure Services
(.NET Services and SQL Services), we have posted a version of a managed console out
to Code Gallery.  It is amazingly cool stuff which I am proud to say I had a
little input into for the SDS stuff.  It manages your cloud based workflows,
identity and access control rules, and SQL Data Services data.
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesPlatformManagementConsole_E51C/image_2.png">
            <img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesPlatformManagementConsole_E51C/image_thumb.png" width="516" height="403" />
          </a>
        </p>
        <p>
In later iterations, I can imagine we will beef up the editors and keep the tools
in sync with the live services as they evolve.  However, for pure utility - this
thing is better than the Azure portal today.
</p>
        <p>
          <a href="http://code.msdn.microsoft.com/AzureManagementTools">Download it here</a>
        </p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=64575ccf-85d6-4477-a07e-8a74a8d46c02" />
      </body>
      <title>Azure Services Platform Management Console</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,64575ccf-85d6-4477-a07e-8a74a8d46c02.aspx</guid>
      <link>http://dunnry.com/blog/AzureServicesPlatformManagementConsole.aspx</link>
      <pubDate>Wed, 29 Oct 2008 23:17:56 GMT</pubDate>
      <description>&lt;p&gt;
In case anyone was looking for a feature rich management tool for their Azure Services
(.NET Services and SQL Services), we have posted a version of a managed console out
to Code Gallery.&amp;nbsp; It is amazingly cool stuff which I am proud to say I had a
little input into for the SDS stuff.&amp;nbsp; It manages your cloud based workflows,
identity and access control rules, and SQL Data Services data.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesPlatformManagementConsole_E51C/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/AzureServicesPlatformManagementConsole_E51C/image_thumb.png" width="516" height="403"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
In later iterations, I can imagine we will beef up the editors and keep the tools
in sync with the live services as they evolve.&amp;nbsp; However, for pure utility - this
thing is better than the Azure portal today.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://code.msdn.microsoft.com/AzureManagementTools"&gt;Download it here&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=64575ccf-85d6-4477-a07e-8a74a8d46c02" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,64575ccf-85d6-4477-a07e-8a74a8d46c02.aspx</comments>
      <category>Cloud Services</category>
      <category>SDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=8f4e9989-c3ea-4749-86f9-fbdbb21a0806</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,8f4e9989-c3ea-4749-86f9-fbdbb21a0806.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,8f4e9989-c3ea-4749-86f9-fbdbb21a0806.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8f4e9989-c3ea-4749-86f9-fbdbb21a0806</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A few months back, I embarked on a mission to get these Ruby samples produced as I
felt it was important to show the flexibility and open nature of SDS.  The problem
was that I have no practical experience with Ruby.  With this in mind, I looked
to my friend, former co-worker, and Ruby pro, <a href="http://infozerk.com/averyBlog/">James
Avery</a> to get this done.  He did a terrific job as the developer and I am
happy to present this today.
</p>
        <p>
With the announcement today at PDC of the Azure Services Platform, we are releasing
a set of Ruby samples for SQL Data Services (SDS), formerly called SSDS.  We
are putting the source on <a href="http://github.com/sdsteam">GitHub</a>, and the
samples will be available as gems from RubyForge.
</p>
        <p>
The samples really consist of a number of moving parts:
</p>
        <p>
          <a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/RubyonSQLDataServices_95D6/image_2.png">
            <img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/RubyonSQLDataServices_95D6/image_thumb.png" width="359" height="293" />
          </a>
        </p>
        <p>
At the core of the samples is a Ruby REST library for SDS.  It performs the main
plumbing to using the service.  Next, we have two providers for building applications:
an <a href="http://ar.rubyonrails.org/">ActiveRecord</a> provider and an <a href="http://api.rubyonrails.org/classes/ActiveResource.html">ActiveResourc</a>e
provider.  These providers make use of the Ruby REST library for SDS.
</p>
        <p>
Finally, we have two samples that make use of the providers.  We have built a
version of RadiantCMS that uses the ActiveRecord provider and a simple task list sample
that shows how to use the ActiveResource provider.
</p>
        <p>
To get started:
</p>
        <ol>
          <li>
Visit <a href="http://github.com/sdsteam">GitHub</a> and download sds-tasks or sds-radiant. 
</li>
          <li>
View the Readme file in the sample as it will direct you to download Rails and some
of other pre-requisites. 
</li>
          <li>
Use the gem installers to download the sds-rest library. 
</li>
          <li>
Set some configuration with your SDS username/password (now called Azure Solution
name and password when you provision). 
</li>
          <li>
That's it!  Just run the ruby script server and see how REST and Ruby works with
SDS.</li>
        </ol>
        <p>
          <strong>NOTE</strong>:  PDC folks can get provisioned for SQL Services and .NET
Services by visiting the labs and getting a provisioning code.  This is exclusive
to PDC attendees until the beta.
</p>
        <p>
I will look to James to provide a few posts and details on how he built it. 
Thanks again James!
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=8f4e9989-c3ea-4749-86f9-fbdbb21a0806" />
      </body>
      <title>Ruby on SQL Data Services SDK</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,8f4e9989-c3ea-4749-86f9-fbdbb21a0806.aspx</guid>
      <link>http://dunnry.com/blog/RubyOnSQLDataServicesSDK.aspx</link>
      <pubDate>Mon, 27 Oct 2008 21:10:10 GMT</pubDate>
      <description>&lt;p&gt;
A few months back, I embarked on a mission to get these Ruby samples produced as I
felt it was important to show the flexibility and open nature of SDS.&amp;nbsp; The problem
was that I have no practical experience with Ruby.&amp;nbsp; With this in mind, I looked
to my friend, former co-worker, and Ruby pro, &lt;a href="http://infozerk.com/averyBlog/"&gt;James
Avery&lt;/a&gt; to get this done.&amp;nbsp; He did a terrific job as the developer and I am
happy to present this today.
&lt;/p&gt;
&lt;p&gt;
With the announcement today at PDC of the Azure Services Platform, we are releasing
a set of Ruby samples for SQL Data Services (SDS), formerly called SSDS.&amp;nbsp; We
are putting the source on &lt;a href="http://github.com/sdsteam"&gt;GitHub&lt;/a&gt;, and the
samples will be available as gems from RubyForge.
&lt;/p&gt;
&lt;p&gt;
The samples really consist of a number of moving parts:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/content/binary/WindowsLiveWriter/RubyonSQLDataServices_95D6/image_2.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://dunnry.com/blog/content/binary/WindowsLiveWriter/RubyonSQLDataServices_95D6/image_thumb.png" width="359" height="293"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
At the core of the samples is a Ruby REST library for SDS.&amp;nbsp; It performs the main
plumbing to using the service.&amp;nbsp; Next, we have two providers for building applications:
an &lt;a href="http://ar.rubyonrails.org/"&gt;ActiveRecord&lt;/a&gt; provider and an &lt;a href="http://api.rubyonrails.org/classes/ActiveResource.html"&gt;ActiveResourc&lt;/a&gt;e
provider.&amp;nbsp; These providers make use of the Ruby REST library for SDS.
&lt;/p&gt;
&lt;p&gt;
Finally, we have two samples that make use of the providers.&amp;nbsp; We have built a
version of RadiantCMS that uses the ActiveRecord provider and a simple task list sample
that shows how to use the ActiveResource provider.
&lt;/p&gt;
&lt;p&gt;
To get started:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Visit &lt;a href="http://github.com/sdsteam"&gt;GitHub&lt;/a&gt; and download sds-tasks or sds-radiant. 
&lt;li&gt;
View the Readme file in the sample as it will direct you to download Rails and some
of other pre-requisites. 
&lt;li&gt;
Use the gem installers to download the sds-rest library. 
&lt;li&gt;
Set some configuration with your SDS username/password (now called Azure Solution
name and password when you provision). 
&lt;li&gt;
That's it!&amp;nbsp; Just run the ruby script server and see how REST and Ruby works with
SDS.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;strong&gt;NOTE&lt;/strong&gt;:&amp;nbsp; PDC folks can get provisioned for SQL Services and .NET
Services by visiting the labs and getting a provisioning code.&amp;nbsp; This is exclusive
to PDC attendees until the beta.
&lt;/p&gt;
&lt;p&gt;
I will look to James to provide a few posts and details on how he built it.&amp;nbsp;
Thanks again James!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=8f4e9989-c3ea-4749-86f9-fbdbb21a0806" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,8f4e9989-c3ea-4749-86f9-fbdbb21a0806.aspx</comments>
      <category>Cloud Services</category>
      <category>Ruby</category>
      <category>SDS</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=6b4123a6-70e2-4ffb-80fe-07db8134bc6b</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,6b4123a6-70e2-4ffb-80fe-07db8134bc6b.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,6b4123a6-70e2-4ffb-80fe-07db8134bc6b.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6b4123a6-70e2-4ffb-80fe-07db8134bc6b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I dropped in on a couple of the developers in the SQL Data Services team (formerly
SSDS) to chat and film a video about some of the new features being released with
the PDC build of the service.  Jason Hunter and Jeff Currier are two of the senior
developers on the SDS team and with a few days warning that I would be stopping by,
they managed to put together a couple cool demos for us.
</p>
        <p>
This is a longer video, with lots of code and deep content - so set aside some time
and watch Jason and Jeff walk us through the new relational features as well as blob
support.
</p>
        <p>
          <a href="http://channel9.msdn.com/posts/dunnry/Whats-new-in-SQL-Data-Services-for-Developers/">What's
new in SQL Data Services for Developers?</a>
        </p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=6b4123a6-70e2-4ffb-80fe-07db8134bc6b" />
      </body>
      <title>What's new in SQL Data Services for Developers?</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,6b4123a6-70e2-4ffb-80fe-07db8134bc6b.aspx</guid>
      <link>http://dunnry.com/blog/WhatsNewInSQLDataServicesForDevelopers.aspx</link>
      <pubDate>Mon, 27 Oct 2008 20:55:33 GMT</pubDate>
      <description>&lt;p&gt;
I dropped in on a couple of the developers in the SQL Data Services team (formerly
SSDS) to chat and film a video about some of the new features being released with
the PDC build of the service.&amp;nbsp; Jason Hunter and Jeff Currier are two of the senior
developers on the SDS team and with a few days warning that I would be stopping by,
they managed to put together a couple cool demos for us.
&lt;/p&gt;
&lt;p&gt;
This is a longer video, with lots of code and deep content - so set aside some time
and watch Jason and Jeff walk us through the new relational features as well as blob
support.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://channel9.msdn.com/posts/dunnry/Whats-new-in-SQL-Data-Services-for-Developers/"&gt;What's
new in SQL Data Services for Developers?&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=6b4123a6-70e2-4ffb-80fe-07db8134bc6b" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,6b4123a6-70e2-4ffb-80fe-07db8134bc6b.aspx</comments>
      <category>Cloud Services</category>
      <category>SDS</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=235f429b-cc1c-438e-80d6-49f8884e0336</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,235f429b-cc1c-438e-80d6-49f8884e0336.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,235f429b-cc1c-438e-80d6-49f8884e0336.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=235f429b-cc1c-438e-80d6-49f8884e0336</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We have just released an updated version of the SSDS sample application called 'PhluffyFotos'. 
Clouds are fluffy and this is a cloud services application - get it?  This sample
application is a ASP.NET MVC and Windows Mobile application showing how to build a
photo tagging and sharing site using our cloud data service, SSDS.  For this
update:
</p>
        <ul>
          <li>
Updated to MVC Preview 4.  We have removed hardcoded links and used the new filtering
capability for authorization.  Of course, Preview 5 was just (and just) released
as we were putting this out the door.  I might update this to Preview 5 later,
but it will not be a big deal to do so.  
</li>
          <li>
Updated to add thumbnail support.  Originally, we just downloaded the entire
image and resized to thumbnail size.  This drags down performance in larger data
sizes, so we fixed it for this release. 
</li>
          <li>
Updated to use the SSDS blob support.  Blob support was recently added with the
latest sprint.  Previously, we were using the 'base64Binary' attributes to store
the picture data.  With the new blob support, you supply a content type and content
disposition, which will be streamed back to you on request.  
</li>
          <li>
Updated to use the latest <a href="http://code.msdn.com/ssdsrest">SSDS REST library</a>. 
This library gives us the ability to use and persist CLR objects to the service and
use a LINQ-like query syntax.  This library saved us a ton of time and effort
in building the actual application.  All the blob work, querying, and data access
was done using this library.</li>
        </ul>
        <p>
The sample is available for download at <a href="http://www.codeplex.com/phluffyfotos">CodePlex</a>,
and a live version is available to play with at <a href="http://www.phluffyfotos.com">PhluffyFotos.com</a>. 
I am opening this one up to the public to upload photos.  Maybe I am playing
with fire here, so we will see how well it goes.  Keep in mind that this is a
sample site and I will periodically blow away the data.  The live version has
an added feature of integrating a source code viewer directly into the application.
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=235f429b-cc1c-438e-80d6-49f8884e0336" />
      </body>
      <title>PhluffyFotos v2 Released</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,235f429b-cc1c-438e-80d6-49f8884e0336.aspx</guid>
      <link>http://dunnry.com/blog/PhluffyFotosV2Released.aspx</link>
      <pubDate>Thu, 04 Sep 2008 21:32:11 GMT</pubDate>
      <description>&lt;p&gt;
We have just released an updated version of the SSDS sample application called 'PhluffyFotos'.&amp;nbsp;
Clouds are fluffy and this is a cloud services application - get it?&amp;nbsp; This sample
application is a ASP.NET MVC and Windows Mobile application showing how to build a
photo tagging and sharing site using our cloud data service, SSDS.&amp;nbsp; For this
update:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Updated to MVC Preview 4.&amp;nbsp; We have removed hardcoded links and used the new filtering
capability for authorization.&amp;nbsp; Of course, Preview 5 was just (and just) released
as we were putting this out the door.&amp;nbsp; I might update this to Preview 5 later,
but it will not be a big deal to do so.&amp;nbsp; 
&lt;li&gt;
Updated to add thumbnail support.&amp;nbsp; Originally, we just downloaded the entire
image and resized to thumbnail size.&amp;nbsp; This drags down performance in larger data
sizes, so we fixed it for this release. 
&lt;li&gt;
Updated to use the SSDS blob support.&amp;nbsp; Blob support was recently added with the
latest sprint.&amp;nbsp; Previously, we were using the 'base64Binary' attributes to store
the picture data.&amp;nbsp; With the new blob support, you supply a content type and content
disposition, which will be streamed back to you on request.&amp;nbsp; 
&lt;li&gt;
Updated to use the latest &lt;a href="http://code.msdn.com/ssdsrest"&gt;SSDS REST library&lt;/a&gt;.&amp;nbsp;
This library gives us the ability to use and persist CLR objects to the service and
use a LINQ-like query syntax.&amp;nbsp; This library saved us a ton of time and effort
in building the actual application.&amp;nbsp; All the blob work, querying, and data access
was done using this library.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The sample is available for download at &lt;a href="http://www.codeplex.com/phluffyfotos"&gt;CodePlex&lt;/a&gt;,
and a live version is available to play with at &lt;a href="http://www.phluffyfotos.com"&gt;PhluffyFotos.com&lt;/a&gt;.&amp;nbsp;
I am opening this one up to the public to upload photos.&amp;nbsp; Maybe I am playing
with fire here, so we will see how well it goes.&amp;nbsp; Keep in mind that this is a
sample site and I will periodically blow away the data.&amp;nbsp; The live version has
an added feature of integrating a source code viewer directly into the application.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=235f429b-cc1c-438e-80d6-49f8884e0336" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,235f429b-cc1c-438e-80d6-49f8884e0336.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>Cloud Services</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=3164369c-5fe5-475f-af56-70e82301c91a</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,3164369c-5fe5-475f-af56-70e82301c91a.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,3164369c-5fe5-475f-af56-70e82301c91a.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3164369c-5fe5-475f-af56-70e82301c91a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have just updated the <a href="http://code.msdn.microsoft.com/ssdsrest">Code Gallery
page</a> to reflect the new version of the REST-based library for SSDS.  This
is a fairly major update to library and adds a ton of new features to make working
with SSDS even easier than it already is for the .NET developer.  Added in this
release:
</p>
        <ul>
          <li>
Concurrency support via Etags and If-Match, If-None-Match headers.  To get a
basic understanding of how this works, <a href="http://dunnry.com/blog/ConcurrencyWithSSDSViaREST.aspx">refer
here</a>. 
</li>
          <li>
Blob support.  The library introduces a new type called <strong>SsdsBlobEntity</strong> that
encapsulates working with blobs in SSDS.  Overloads are available for both synchronous
as well as async support. 
</li>
          <li>
Parallelization support via extension methods.  The jury is still out on this
one and I would like to hear some feedback on it (both the technique as well as the
methods).  Instead of using an interface, factory methods, etc., we are using
extension methods supplied in a separate assembly to support parallel operations. 
Since there are many different techniques to parallelize your code, this allows us
to offer more than one option.  Each additional assembly can also take dependencies
that the entire library might not want to take as well.  Imagine that we get
providers for Parallel Extensions, CCR, or perhaps other home-baked remedies. 
A very simple provider using Parallel Extensions is included. 
</li>
          <li>
Bug fixes.  Hard to believe, but yes, I did have a few bugs in my code. 
This release cleans up a few of the ones found in the LINQ expression syntax parser
as well as a few oversights in handling date/times. 
</li>
          <li>
Better test coverage.  Lots more tests included to not only prove out that stuff
works, but also to show how to use it.</li>
        </ul>
        <p>
If you just want to see this library in action, refer to the photo sharing and tagging
application called <a href="http://www.phluffyfotos.com/">'PhluffyFotos'</a> that
pulls it all together (sans parallelization, I suppose).  You can use the integrated
source viewer to see how the library works on a 'real' application (or a real sample
application at least).
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=3164369c-5fe5-475f-af56-70e82301c91a" />
      </body>
      <title>SSDS REST Library v2 Released</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,3164369c-5fe5-475f-af56-70e82301c91a.aspx</guid>
      <link>http://dunnry.com/blog/SSDSRESTLibraryV2Released.aspx</link>
      <pubDate>Thu, 04 Sep 2008 20:25:41 GMT</pubDate>
      <description>&lt;p&gt;
I have just updated the &lt;a href="http://code.msdn.microsoft.com/ssdsrest"&gt;Code Gallery
page&lt;/a&gt; to reflect the new version of the REST-based library for SSDS.&amp;nbsp; This
is a fairly major update to library and adds a ton of new features to make working
with SSDS even easier than it already is for the .NET developer.&amp;nbsp; Added in this
release:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Concurrency support via Etags and If-Match, If-None-Match headers.&amp;nbsp; To get a
basic understanding of how this works, &lt;a href="http://dunnry.com/blog/ConcurrencyWithSSDSViaREST.aspx"&gt;refer
here&lt;/a&gt;. 
&lt;li&gt;
Blob support.&amp;nbsp; The library introduces a new type called &lt;strong&gt;SsdsBlobEntity&lt;/strong&gt; that
encapsulates working with blobs in SSDS.&amp;nbsp; Overloads are available for both synchronous
as well as async support. 
&lt;li&gt;
Parallelization support via extension methods.&amp;nbsp; The jury is still out on this
one and I would like to hear some feedback on it (both the technique as well as the
methods).&amp;nbsp; Instead of using an interface, factory methods, etc., we are using
extension methods supplied in a separate assembly to support parallel operations.&amp;nbsp;
Since there are many different techniques to parallelize your code, this allows us
to offer more than one option.&amp;nbsp; Each additional assembly can also take dependencies
that the entire library might not want to take as well.&amp;nbsp; Imagine that we get
providers for Parallel Extensions, CCR, or perhaps other home-baked remedies.&amp;nbsp;
A very simple provider using Parallel Extensions is included. 
&lt;li&gt;
Bug fixes.&amp;nbsp; Hard to believe, but yes, I did have a few bugs in my code.&amp;nbsp;
This release cleans up a few of the ones found in the LINQ expression syntax parser
as well as a few oversights in handling date/times. 
&lt;li&gt;
Better test coverage.&amp;nbsp; Lots more tests included to not only prove out that stuff
works, but also to show how to use it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
If you just want to see this library in action, refer to the photo sharing and tagging
application called &lt;a href="http://www.phluffyfotos.com/"&gt;'PhluffyFotos'&lt;/a&gt; that
pulls it all together (sans parallelization, I suppose).&amp;nbsp; You can use the integrated
source viewer to see how the library works on a 'real' application (or a real sample
application at least).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=3164369c-5fe5-475f-af56-70e82301c91a" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,3164369c-5fe5-475f-af56-70e82301c91a.aspx</comments>
      <category>.NET</category>
      <category>Cloud Services</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=327be3af-bb56-4aec-ad53-149dad9082c2</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,327be3af-bb56-4aec-ad53-149dad9082c2.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,327be3af-bb56-4aec-ad53-149dad9082c2.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=327be3af-bb56-4aec-ad53-149dad9082c2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Eugenio already covered concurrency via the SOAP interface with with <a href="http://blogs.msdn.com/eugeniop/archive/2008/08/01/concurrency-in-ssds.aspx">latest
post</a>.  The idea is exactly the same in REST, but the mechanics are slightly
different.  For REST, you specify a "Etag" value and either the If-Match or If-None-Match
headers.
</p>
        <p>
Here is a simplified client that does a PUT/POST operation on SSDS:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: #0000ff">internal</span>
            <span style="color: #0000ff">void</span> Send(Uri
scope, <span style="color: #0000ff">string</span> etag, <span style="color: #0000ff">string</span> method, <span style="color: #0000ff">string</span> data,
Action&lt;<span style="color: #0000ff">string</span>, WebHeaderCollection&gt; action,
Action&lt;WebException&gt; exception) { <span style="color: #0000ff">using</span> (var
client = <span style="color: #0000ff">new</span> WebClient { Credentials = _credentials
}) { client.Headers.Add(HttpRequestHeader.ContentType, <span style="color: #006080">"application/x-ssds+xml"</span>); <span style="color: #0000ff">if</span> (etag
!= <span style="color: #0000ff">null</span>) client.Headers.Add(HttpRequestHeader.IfMatch,
etag); client.UploadStringCompleted += (sender, e) =&gt; { <span style="color: #0000ff">if</span> (e.Error
!= <span style="color: #0000ff">null</span> &amp;&amp; exception != <span style="color: #0000ff">null</span>)
{ exception((WebException)e.Error); } <span style="color: #0000ff">else</span> { <span style="color: #0000ff">if</span> (action
!= <span style="color: #0000ff">null</span>) { action(e.Result, client.ResponseHeaders);
} } }; client.UploadStringAsync(scope, method, data); } }</pre>
        </div>
        <p>
 
</p>
        <p>
All this does is add the If-Match header and the Etag (which corresponds to the Flexible
Entity Version system attribute).  This instructs the system to only update if
the version held in SSDS matches the version specified in the Etag with the If-Match
header.
</p>
        <p>
Failure of this condition will result in a <strong>412</strong> error "<em>A precondition,
such as Version, could not be met</em>".  You simply need to handle this exception
and move on.
</p>
        <p>
Next, there are times when you have a large blob or a largish flexible entity. 
You only want to perform the GET if you don't have the latest version.  In this
case, you specify the Etag again with the If-None-Match header.
</p>
        <p>
Here is a simplified client that shows how the GET would work:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: #0000ff">public</span>
            <span style="color: #0000ff">void</span> Get(Uri
scope, <span style="color: #0000ff">string</span> etag, Action&lt;<span style="color: #0000ff">string</span>,
WebHeaderCollection&gt; action, Action&lt;WebException&gt; exception) { <span style="color: #0000ff">using</span> (var
client = <span style="color: #0000ff">new</span> WebClient { Credentials = _credentials
}) { client.Headers.Add(HttpRequestHeader.ContentType, <span style="color: #006080">"application/x-ssds+xml"</span>); <span style="color: #0000ff">if</span> (etag
!= <span style="color: #0000ff">null</span>) client.Headers.Add(HttpRequestHeader.IfNoneMatch,
etag); client.DownloadStringCompleted += (sender, e) =&gt; { <span style="color: #0000ff">if</span> (e.Error
!= <span style="color: #0000ff">null</span> &amp;&amp; exception != <span style="color: #0000ff">null</span>)
{ exception((WebException)e.Error); } <span style="color: #0000ff">else</span> { <span style="color: #0000ff">if</span> (action
!= <span style="color: #0000ff">null</span>) action(e.Result, client.ResponseHeaders);
} }; client.DownloadStringAsync(scope); } </pre>
        </div>
        <p>
When you add the Etag and this header, you will receive a <strong>304</strong> error
"<em>Not Modified</em>" if the content has NOT changed since the Etag value you sent.
</p>
        <p>
I am attaching a small <a href="http://cid-4225352e17899c6d.skydrive.live.com/self.aspx/Public/Concurrency.zip">Visual
Studio sample</a> that includes this code and demonstrates these techniques.
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=327be3af-bb56-4aec-ad53-149dad9082c2" />
      </body>
      <title>Concurrency with SSDS via REST</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,327be3af-bb56-4aec-ad53-149dad9082c2.aspx</guid>
      <link>http://dunnry.com/blog/ConcurrencyWithSSDSViaREST.aspx</link>
      <pubDate>Tue, 26 Aug 2008 17:30:11 GMT</pubDate>
      <description>&lt;p&gt;
Eugenio already covered concurrency via the SOAP interface with with &lt;a href="http://blogs.msdn.com/eugeniop/archive/2008/08/01/concurrency-in-ssds.aspx"&gt;latest
post&lt;/a&gt;.&amp;nbsp; The idea is exactly the same in REST, but the mechanics are slightly
different.&amp;nbsp; For REST, you specify a "Etag" value and either the If-Match or If-None-Match
headers.
&lt;/p&gt;
&lt;p&gt;
Here is a simplified client that does a PUT/POST operation on SSDS:
&lt;/p&gt;
&lt;div&gt;&lt;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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;internal&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Send(Uri
scope, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; etag, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; method, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; data,
Action&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, WebHeaderCollection&amp;gt; action,
Action&amp;lt;WebException&amp;gt; exception) { &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (var
client = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebClient { Credentials = _credentials
}) { client.Headers.Add(HttpRequestHeader.ContentType, &lt;span style="color: #006080"&gt;"application/x-ssds+xml"&lt;/span&gt;); &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (etag
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) client.Headers.Add(HttpRequestHeader.IfMatch,
etag); client.UploadStringCompleted += (sender, e) =&amp;gt; { &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.Error
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; exception != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
{ exception((WebException)e.Error); } &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (action
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) { action(e.Result, client.ResponseHeaders);
} } }; client.UploadStringAsync(scope, method, data); } }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
All this does is add the If-Match header and the Etag (which corresponds to the Flexible
Entity Version system attribute).&amp;nbsp; This instructs the system to only update if
the version held in SSDS matches the version specified in the Etag with the If-Match
header.
&lt;/p&gt;
&lt;p&gt;
Failure of this condition will result in a &lt;strong&gt;412&lt;/strong&gt; error "&lt;em&gt;A precondition,
such as Version, could not be met&lt;/em&gt;".&amp;nbsp; You simply need to handle this exception
and move on.
&lt;/p&gt;
&lt;p&gt;
Next, there are times when you have a large blob or a largish flexible entity.&amp;nbsp;
You only want to perform the GET if you don't have the latest version.&amp;nbsp; In this
case, you specify the Etag again with the If-None-Match header.
&lt;/p&gt;
&lt;p&gt;
Here is a simplified client that shows how the GET would work:
&lt;/p&gt;
&lt;div&gt;&lt;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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Get(Uri
scope, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; etag, Action&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,
WebHeaderCollection&amp;gt; action, Action&amp;lt;WebException&amp;gt; exception) { &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (var
client = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebClient { Credentials = _credentials
}) { client.Headers.Add(HttpRequestHeader.ContentType, &lt;span style="color: #006080"&gt;"application/x-ssds+xml"&lt;/span&gt;); &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (etag
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) client.Headers.Add(HttpRequestHeader.IfNoneMatch,
etag); client.DownloadStringCompleted += (sender, e) =&amp;gt; { &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.Error
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; exception != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
{ exception((WebException)e.Error); } &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (action
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) action(e.Result, client.ResponseHeaders);
} }; client.DownloadStringAsync(scope); } &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
When you add the Etag and this header, you will receive a &lt;strong&gt;304&lt;/strong&gt; error
"&lt;em&gt;Not Modified&lt;/em&gt;" if the content has NOT changed since the Etag value you sent.
&lt;/p&gt;
&lt;p&gt;
I am attaching a small &lt;a href="http://cid-4225352e17899c6d.skydrive.live.com/self.aspx/Public/Concurrency.zip"&gt;Visual
Studio sample&lt;/a&gt; that includes this code and demonstrates these techniques.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=327be3af-bb56-4aec-ad53-149dad9082c2" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,327be3af-bb56-4aec-ad53-149dad9082c2.aspx</comments>
      <category>.NET</category>
      <category>Cloud Services</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=6b7458e6-b6c1-4c13-a9b4-454339db5bc9</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,6b7458e6-b6c1-4c13-a9b4-454339db5bc9.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,6b7458e6-b6c1-4c13-a9b4-454339db5bc9.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6b7458e6-b6c1-4c13-a9b4-454339db5bc9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
My buddy <a href="http://blogs.msdn.com/vbertocci">Vittorio</a> tagged me for this
meme that has been making the rounds.  It is interesting to see what some people
have answered.  Mine probably is pretty tame in comparison I am sure.
</p>
        <h3>How old were you when you started programming?
</h3>
        <p>
My first computer was the Commodore 64 in the early 80's.  I think it was around
1982 or early 83, so that would have made me around 7.  My first exposure to
programming was typing programs out of magazines and books.  I remember computing
the checksum as a way of catching errors.  We initially had a tape drive for
storage and eventually had the 5.25 disk drive to save files.  I learned quickly
the BASIC language and programmed trivial things there.
</p>
        <p>
It would be a few years later when we got a 286 10mhz (it was a JET!) computer with
640K RAM and some obscenely small harddrive size that I forget now (maybe 20MB?). 
It had a Hercules graphics card that drove the monochrome monitor (amber no less). 
I became very proficient with word processing and using DOS at that time.  I
tried using QBASIC I think around that time.
</p>
        <h3>How did you get started in programming?
</h3>
        <p>
I was only interested in computers as a hobby until I started working after college. 
My degree was for operations management and statistics.  I happened to be working
when the internet boom started (and busted).  Since operations management was
often about manufacturing and manufacturing jobs were often located in small towns,
I watched my colleagues with envy as they got better projects in better locations
just by learning Java.  I will never forget Shelbyville, TN or Shenandoah, IA
- if they weren't such horrible places to work I would probably never have jumped
at an opportunity to learn ASP and get out of manufacturing consulting.  It was
simple to learn ASP and by extension VBScript and I never looked back again.
</p>
        <h3>What was your first real language?
</h3>
        <p>
I didn't program again after my brief stint with BASIC until college.  I had
my intro computer science course taught in Turbo Pascal.  It wasn't terribly
hard and I enjoyed learning the algorithms.  I knew BASIC from the C64 and TRS-80
days, but I would say that I learned Turbo Pascal probably better than that and it
was my first real language.  Of course, I don't remember it at all now, but I
was good in the day.
</p>
        <h3>What was the first 'real' program you wrote?
</h3>
        <p>
I had to write a final project for my CS course in college.  I ended up writing
a poker program that emulated the kind of poker you would play on a slot machine. 
It actually worked pretty well and I wish I still had it.  
</p>
        <h3>What languages have you used since you started programming?
</h3>
        <p>
BASIC, Turbo Pascal, VBScript, Javascript, VBA (for Access), VB6, TSQL and now mostly
C# these days.  I don't know if XSLT, XPath, DHTML, etc. count or not. 
</p>
        <h3>What was your first professional programming gig?
</h3>
        <p>
I think my first program I got paid for was writing some VBA code for a Lotus Notes
application (what a gawdawful programming model, btw) at a client.  Before I
finished it, I was sent to a small startup called Point.com (now defunct) and wrote
a whole ton of Javascript and XML code.  This was using the XmlHttpRequest object
well before people called that 'AJAX'.  Unfortunately, the bust came around that
time and that code never saw the light of day...
</p>
        <h3>If you knew what you knew now, would have have started programming?
</h3>
        <p>
Hard to say.  Part of me wishes that I would have gotten a masters in CS or taken
a number of other programming courses in college.  Part of me however wishes
I would have just gone to medical school and kept this as a hobby.  It just depends
on the day of the week and what I am working on.
</p>
        <h3>If there was one thing you learned along the way that you would tell new developers,
what would it be?
</h3>
        <p>
Find a better developer, read their code, understand their code, and then emulate
them.  This is also called "saddle yourself to a better developer and learn". 
I became a better developer when I watched my friend help me with an Access database
that I was attempting (badly) to write for a internship one summer.  He was (and
probably still is) a much better developer.  I learned a ton just by seeing how
he was doing things.  Later, I would see code from senior developers and I would
study their style to learn what they were doing.  I always tried to emulate what
I saw and make it a part of my style.  If I had never read anyone else's code
or never tried to incorporate it, I would still be a second rate programmer (I might
still be... who knows).
</p>
        <h3>What's the most fun you have ever had... programming?
</h3>
        <p>
I actually enjoyed learning Javascript and XML back in the day.  I remember being
excited about optimizing the rendering speed in IE 5 for a particularly large XML
payload.  I was learning a lot, and becoming a better developer.  I didn't
mind working crazy hours and I read constantly on how to be better at ASP, Javascript,
and XML.  The projects I hated were the ones where you produced code, but never
got to see it get implemented and never saw anyone use it.
</p>
        <p>
Now... on to two other suckers:  <a href="http://nino.net/blog/default.aspx">Nino</a> and <a href="http://infozerk.com/averyBlog/">James</a> -
you've been 'tagged'.
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=6b7458e6-b6c1-4c13-a9b4-454339db5bc9" />
      </body>
      <title>The Programming Meme</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,6b7458e6-b6c1-4c13-a9b4-454339db5bc9.aspx</guid>
      <link>http://dunnry.com/blog/TheProgrammingMeme.aspx</link>
      <pubDate>Tue, 29 Jul 2008 05:49:32 GMT</pubDate>
      <description>&lt;p&gt;
My buddy &lt;a href="http://blogs.msdn.com/vbertocci"&gt;Vittorio&lt;/a&gt; tagged me for this
meme that has been making the rounds.&amp;nbsp; It is interesting to see what some people
have answered.&amp;nbsp; Mine probably is pretty tame in comparison I am sure.
&lt;/p&gt;
&lt;h3&gt;How old were you when you started programming?
&lt;/h3&gt;
&lt;p&gt;
My first computer was the Commodore 64 in the early 80's.&amp;nbsp; I think it was around
1982 or early 83, so that would have made me around 7.&amp;nbsp; My first exposure to
programming was typing programs out of magazines and books.&amp;nbsp; I remember computing
the checksum as a way of catching errors.&amp;nbsp; We initially had a tape drive for
storage and eventually had the 5.25 disk drive to save files.&amp;nbsp; I learned quickly
the BASIC language and programmed trivial things there.
&lt;/p&gt;
&lt;p&gt;
It would be a few years later when we got a 286 10mhz (it was a JET!) computer with
640K RAM and some obscenely small harddrive size that I forget now (maybe 20MB?).&amp;nbsp;
It had a Hercules graphics card that drove the monochrome monitor (amber no less).&amp;nbsp;
I became very proficient with word processing and using DOS at that time.&amp;nbsp; I
tried using QBASIC I think around that time.
&lt;/p&gt;
&lt;h3&gt;How did you get started in programming?
&lt;/h3&gt;
&lt;p&gt;
I was only interested in computers as a hobby until I started working after college.&amp;nbsp;
My degree was for operations management and statistics.&amp;nbsp; I happened to be working
when the internet boom started (and busted).&amp;nbsp; Since operations management was
often about manufacturing and manufacturing jobs were often located in small towns,
I watched my colleagues with envy as they got better projects in better locations
just by learning Java.&amp;nbsp; I will never forget Shelbyville, TN or Shenandoah, IA
- if they weren't such horrible places to work I would probably never have jumped
at an opportunity to learn ASP and get out of manufacturing consulting.&amp;nbsp; It was
simple to learn ASP and by extension VBScript and I never looked back again.
&lt;/p&gt;
&lt;h3&gt;What was your first real language?
&lt;/h3&gt;
&lt;p&gt;
I didn't program again after my brief stint with BASIC until college.&amp;nbsp; I had
my intro computer science course taught in Turbo Pascal.&amp;nbsp; It wasn't terribly
hard and I enjoyed learning the algorithms.&amp;nbsp; I knew BASIC from the C64 and TRS-80
days, but I would say that I learned Turbo Pascal probably better than that and it
was my first real language.&amp;nbsp; Of course, I don't remember it at all now, but I
was good in the day.
&lt;/p&gt;
&lt;h3&gt;What was the first 'real' program you wrote?
&lt;/h3&gt;
&lt;p&gt;
I had to write a final project for my CS course in college.&amp;nbsp; I ended up writing
a poker program that emulated the kind of poker you would play on a slot machine.&amp;nbsp;
It actually worked pretty well and I wish I still had it.&amp;nbsp; 
&lt;/p&gt;
&lt;h3&gt;What languages have you used since you started programming?
&lt;/h3&gt;
&lt;p&gt;
BASIC, Turbo Pascal, VBScript, Javascript, VBA (for Access), VB6, TSQL and now mostly
C# these days.&amp;nbsp; I don't know if XSLT, XPath, DHTML, etc. count or not. 
&lt;/p&gt;
&lt;h3&gt;What was your first professional programming gig?
&lt;/h3&gt;
&lt;p&gt;
I think my first program I got paid for was writing some VBA code for a Lotus Notes
application (what a gawdawful programming model, btw) at a client.&amp;nbsp; Before I
finished it, I was sent to a small startup called Point.com (now defunct) and wrote
a whole ton of Javascript and XML code.&amp;nbsp; This was using the XmlHttpRequest object
well before people called that 'AJAX'.&amp;nbsp; Unfortunately, the bust came around that
time and that code never saw the light of day...
&lt;/p&gt;
&lt;h3&gt;If you knew what you knew now, would have have started programming?
&lt;/h3&gt;
&lt;p&gt;
Hard to say.&amp;nbsp; Part of me wishes that I would have gotten a masters in CS or taken
a number of other programming courses in college.&amp;nbsp; Part of me however wishes
I would have just gone to medical school and kept this as a hobby.&amp;nbsp; It just depends
on the day of the week and what I am working on.
&lt;/p&gt;
&lt;h3&gt;If there was one thing you learned along the way that you would tell new developers,
what would it be?
&lt;/h3&gt;
&lt;p&gt;
Find a better developer, read their code, understand their code, and then emulate
them.&amp;nbsp; This is also called "saddle yourself to a better developer and learn".&amp;nbsp;
I became a better developer when I watched my friend help me with an Access database
that I was attempting (badly) to write for a internship one summer.&amp;nbsp; He was (and
probably still is) a much better developer.&amp;nbsp; I learned a ton just by seeing how
he was doing things.&amp;nbsp; Later, I would see code from senior developers and I would
study their style to learn what they were doing.&amp;nbsp; I always tried to emulate what
I saw and make it a part of my style.&amp;nbsp; If I had never read anyone else's code
or never tried to incorporate it, I would still be a second rate programmer (I might
still be... who knows).
&lt;/p&gt;
&lt;h3&gt;What's the most fun you have ever had... programming?
&lt;/h3&gt;
&lt;p&gt;
I actually enjoyed learning Javascript and XML back in the day.&amp;nbsp; I remember being
excited about optimizing the rendering speed in IE 5 for a particularly large XML
payload.&amp;nbsp; I was learning a lot, and becoming a better developer.&amp;nbsp; I didn't
mind working crazy hours and I read constantly on how to be better at ASP, Javascript,
and XML.&amp;nbsp; The projects I hated were the ones where you produced code, but never
got to see it get implemented and never saw anyone use it.
&lt;/p&gt;
&lt;p&gt;
Now... on to two other suckers:&amp;nbsp; &lt;a href="http://nino.net/blog/default.aspx"&gt;Nino&lt;/a&gt; and &lt;a href="http://infozerk.com/averyBlog/"&gt;James&lt;/a&gt; -
you've been 'tagged'.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=6b7458e6-b6c1-4c13-a9b4-454339db5bc9" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,6b7458e6-b6c1-4c13-a9b4-454339db5bc9.aspx</comments>
      <category>Offbeat</category>
      <category>Personal</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=b80e5b15-d2f6-44df-84f0-9a1ac511c4d7</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,b80e5b15-d2f6-44df-84f0-9a1ac511c4d7.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,b80e5b15-d2f6-44df-84f0-9a1ac511c4d7.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b80e5b15-d2f6-44df-84f0-9a1ac511c4d7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
With the release of Sprint 3 bits, you might have noticed that you are prompted to
download now when you hit the service directly from IE.  Because the content
type changed from 'application/xml' to 'application/x-ssds+xml', IE just doesn't know
how to render the resulting response.
</p>
        <p>
This is simple to fix.  Copy the following to a .reg file and merge into your
registry.
</p>
        <blockquote>
          <p>
Windows Registry Editor Version 5.00 
</p>
          <p>
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/x-ssds+xml]<br />
"CLSID"="{48123BC4-99D9-11D1-A6B3-00C04FD91555}"<br />
"Extension"=".xml"<br />
"Encoding"=hex:08,00,00,00
</p>
        </blockquote>
        <p>
Now, you should be back to the behavior you are used to.
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=b80e5b15-d2f6-44df-84f0-9a1ac511c4d7" />
      </body>
      <title>Rendering POX for SSDS in Internet Explorer</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,b80e5b15-d2f6-44df-84f0-9a1ac511c4d7.aspx</guid>
      <link>http://dunnry.com/blog/RenderingPOXForSSDSInInternetExplorer.aspx</link>
      <pubDate>Fri, 25 Jul 2008 22:38:03 GMT</pubDate>
      <description>&lt;p&gt;
With the release of Sprint 3 bits, you might have noticed that you are prompted to
download now when you hit the service directly from IE.&amp;nbsp; Because the content
type changed from 'application/xml' to 'application/x-ssds+xml', IE just doesn't know
how to render the resulting response.
&lt;/p&gt;
&lt;p&gt;
This is simple to fix.&amp;nbsp; Copy the following to a .reg file and merge into your
registry.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Windows Registry Editor Version 5.00 
&lt;/p&gt;
&lt;p&gt;
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/x-ssds+xml]&lt;br&gt;
"CLSID"="{48123BC4-99D9-11D1-A6B3-00C04FD91555}"&lt;br&gt;
"Extension"=".xml"&lt;br&gt;
"Encoding"=hex:08,00,00,00
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Now, you should be back to the behavior you are used to.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=b80e5b15-d2f6-44df-84f0-9a1ac511c4d7" /&gt;</description>
      <comments>http://dunnry.com/blog/CommentView,guid,b80e5b15-d2f6-44df-84f0-9a1ac511c4d7.aspx</comments>
      <category>Cloud Services</category>
      <category>SSDS</category>
    </item>
    <item>
      <trackback:ping>http://dunnry.com/blog/Trackback.aspx?guid=b37072b9-1fe8-4785-9df3-00861ab346f7</trackback:ping>
      <pingback:server>http://dunnry.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://dunnry.com/blog/PermaLink,guid,b37072b9-1fe8-4785-9df3-00861ab346f7.aspx</pingback:target>
      <dc:creator>Ryan Dunn</dc:creator>
      <wfw:comment>http://dunnry.com/blog/CommentView,guid,b37072b9-1fe8-4785-9df3-00861ab346f7.aspx</wfw:comment>
      <wfw:commentRss>http://dunnry.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b37072b9-1fe8-4785-9df3-00861ab346f7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Here is my last installment in this series of working with objects in SQL Server Data
Services.  For background, readers should read the following:
</p>
        <p>
          <a href="http://dunnry.com/blog/SerializationInSSDS.aspx">Serialization in SSDS</a>
        </p>
        <p>
          <a href="http://dunnry.com/blog/WorkingWithObjectsInSSDSPart1.aspx">Working with Objects
in SSDS Part 1</a>
        </p>
        <p>
          <a href="http://dunnry.com/blog/WorkingWithObjectsInSSDSPart2.aspx">Working with Objects
in SSDS Part 2</a>
        </p>
        <p>
Last time, we concluded with a class called <strong>SsdsEntity&lt;T&gt;</strong> that
became an all-purpose wrapper or veneer around our CLR objects.  This made it
simple to take our existing classes and serialize them as entities in SSDS.
</p>
        <p>
In this post, I want to discuss how the querying in the REST library works. 
First a simple example:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var ctx = <span style="color: #0000ff">new</span> SsdsContext( <span style="color: #006080">"authority=http://dunnry.data.beta.mssds.com/v1/;username=dunnry;password=secret"</span> );
var container = ctx.OpenContainer(<span style="color: #006080">"foo"</span>); var
foo = <span style="color: #0000ff">new</span> Foo { IsPublic = <span style="color: #0000ff">false</span>,
Name = <span style="color: #006080">"MyFoo"</span>, Size = 12 }; <span style="color: #008000">//insert
it with unique id guid string</span> container.Insert(foo, Guid.NewGuid().ToString()); <span style="color: #008000">//now
query for it</span> var results = container.Query&lt;Foo&gt;(e =&gt; e.Entity.IsPublic
== <span style="color: #0000ff">false</span> &amp;&amp; e.Entity.Size &gt; 2); <span style="color: #008000">//Query&lt;T&gt;
returns IEnumerable&lt;SsdsEntity&lt;T&gt;&gt;, so foreach over it</span><span style="color: #0000ff">foreach</span> (var
item <span style="color: #0000ff">in</span> results) { Console.WriteLine(item.Entity.Name);
}</pre>
        </div>
        <p>
I glossed over it in my previous posts with this library, but I have a class called <strong>SsdsContext</strong> that
acts as my credential store and factory to create <strong>SsdsContainer</strong> objects
where I perform my operations.  Here, I have opened a container called 'foo',
which would relate to the URI (<a href="http://dunnry.data.beta.mssds.com/v1/foo">http://dunnry.data.beta.mssds.com/v1/foo</a>)
according to the authority name I passed on the <strong>SsdsContext</strong> constructor
arguments.
</p>
        <p>
I created an instance of my <strong>Foo</strong> class (see <a href="http://dunnry.com/blog/WorkingWithObjectsInSSDSPart1.aspx">this
post</a> if you want to see what a <strong>Foo</strong> looks like) and inserted it. 
We know that under the covers we have an <strong>XmlSerializer</strong> doing the
work to serialize that to the proper POX wire format.  So far, so good. 
Now, I want to retrieve that same entity back from SSDS. The key line here is the
table.Query&lt;T&gt;() call.  It accepts a <strong>Expression&lt;Func&lt;SsdsEntity&lt;T&gt;,
bool&gt;&gt;</strong> argument that represents a strongly typed query.
</p>
        <p>
For the uninitiated, the <strong>Expression&lt;TDelegate&gt;</strong> is a way to
represent lambda expressions in an abstract syntax tree.  We can think of them
as a way to model what the expression does without generating the bits of code necessary
to actually do it.  We can inspect the <strong>Expression</strong> and create
new ones based on it until finally we can call Compile and actually convert the representation
of the lambda into something that can execute.
</p>
        <p>
The <strong>Func&lt;SsdsEntity&lt;T&gt;, bool&gt;</strong> represents a delegate that
accepts a <strong>SsdsEntity&lt;T&gt;</strong> as an argument and returns a boolean. 
This effectively represents the WHERE clause in the SSDS LINQ query syntax. 
Since <strong>SsdsEntity&lt;T&gt;</strong> contains an actual type T in the <strong>Entity</strong> property,
you can query directly against it in a strongly typed fashion!
</p>
        <p>
What about those flexible properties that I added to support flexible attributes outside
of our T?  I mentioned that I wanted to keep the <strong>PropertyBucket</strong> (a <strong>Dictionary&lt;string,
object&gt;</strong>) property public for querying.  In order to use the flexible
properties that you add, you simply use it in a weakly typed manner:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var results = container.Query&lt;Foo&gt;(e =&gt; e.PropertyBucket[<span style="color: #006080">"MyFlexProp"</span>]
&gt; 10);</pre>
        </div>
        <p>
As you can see, any boolean expression that you can think of in the string-based SSDS
LINQ query syntax can now be expressed in a strongly-typed manner using the <strong>Func&lt;SsdsEntity&lt;T&gt;,
bool&gt;</strong> lambda syntax.
</p>
        <h3>How it works
</h3>
        <p>
Since I have the expression tree of what your query looks like in strongly-typed terms,
it is a simple matter to take that and convert it to the SSDS LINQ query syntax that
looks like "from e in entities where [....] select e" that is appended to the query
string in the REST interface.  I should say it is a simple matter because <a href="http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx">Matt
Warren</a> did a lot of the heavy lifting for us and provided the abstract expression
visitor (<strong>ExpressionVisitor</strong>) as well as the expression visitor that
partially evaluates the tree to evaluate constants (<strong>SubTreeEvaluator</strong>). 
This last part is important because it allows us to write this:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
            <span style="color: #0000ff">int</span> i
= 10; <span style="color: #0000ff">string</span> name = <span style="color: #006080">"MyFoo"</span>;
var results = container.Query&lt;Foo&gt;(e =&gt; e.Entity.Name == name &amp;&amp;
e.Entity.Size &gt; i);</pre>
        </div>
        <p>
Without the partial tree evaluation, you would not be able to express the right hand
side of the equation.  All I had to do was implement an expression visitor that
correctly evaluated the lambda expression and converted it to the LINQ syntax that
SSDS expects (<strong>SsdsExpressionVisitor</strong>).  It would be a trivial
matter to actually implement the <strong>IQueryProvider</strong> and <strong>IQueryable</strong> interfaces
to make the whole thing work inside LINQ to Objects.
</p>
        <p>
Originally, I did supply the <strong>IQueryProvider</strong> for this implementation
but after consideration I have decided that using methods from the <strong>SsdsContainer</strong> class
instead of the standard LINQ syntax is the best way to proceed.  Mainly, this
has to do with the fact that I want to make it more explicit to the developer what
will happen under the covers rather than using the standard <strong>Where()</strong> extension
method.
</p>
        <h3>Querying data
</h3>
        <p>
The main interaction to return data is via the <strong>Query&lt;T&gt;</strong> method. 
This method is smart enough to add the Kind into the query for you based on the T
supplied.  So, if you write something like:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var results = container.Query&lt;Foo&gt;(e =&gt; e.Entity.Size &gt; 2);</pre>
        </div>
        <p>
This is actually translated to "<em>from e in entities where e["Size"] &gt; 2 &amp;&amp;
e.Kind == "Foo" select e</em>".  The addition of the kind is important because
we want to limit the results as much as possible.  If there happened to be many
kinds in the container that had the flexible property "Size", it would actually return
those as well in the wire response.
</p>
        <p>
Of course, what about if you want that to happen?  What if you want to return
other kinds that have the "Size" property?  To do this, I have introduced a class
called <strong>SsdsEntityBucket</strong>.  It is exactly what it sounds like. 
To use it, you simply specify a query that uses additional types with either the <strong>Query&lt;T,U,V&gt;</strong> or <strong>Query&lt;T,U&gt;</strong> methods. 
Here is an example:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var foo = <span style="color: #0000ff">new</span> Foo
{ IsPublic = <span style="color: #0000ff">true</span>, MyCheese = <span style="color: #0000ff">new</span> Cheese
{ LastModified = DateTime.Now, Name = <span style="color: #006080">"MyCheese"</span> },
Name = <span style="color: #006080">"FooMaster"</span>, Size = 10 }; container.Insert(foo,
foo.Name); container.Insert(foo.MyCheese, foo.MyCheese.Name); <span style="color: #008000">//query
for bucket...</span> var bucket = container.Query&lt;Foo, Cheese&gt;( (f, c) =&gt;
f.Entity.Name == <span style="color: #006080">"FooMaster"</span> || c.Entity.Name
== <span style="color: #006080">"MyCheese"</span> ); var f1 = bucket.GetEntities&lt;Foo&gt;().Single();
var c1 = bucket.GetEntities&lt;Cheese&gt;().Single();</pre>
        </div>
        <p>
The calls to <strong>GetEntities&lt;T&gt;</strong> returns <strong>IEnumerable&lt;SsdsEntity&lt;T&gt;&gt;</strong> again. 
However, this was done in a single call to SSDS instead of multiple calls per T.
</p>
        <h3>Paging
</h3>
        <p>
As I mentioned earlier, I wanted the developer to understand what they were doing
when they called each method, so I decided to make paging explicit.  If I had
potentially millions of entities in SSDS, it would be a bad mistake to allow a developer
to issue a simple query that seamlessly paged the items back - especially if the query
was something like <em>e =&gt; e.Id != ""</em>.  Here is how I handled paging:
</p>
        <div>
          <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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var container = ctx.OpenContainer(<span style="color: #006080">"paging"</span>);
List&lt;Foo&gt; items = <span style="color: #0000ff">new</span> List&lt;Foo&gt;(); <span style="color: #0000ff">int</span> i
= 1; container.PagedQuery&lt;Foo&gt;( e =&gt; e.Entity.Size != 0, c =&gt; { Console.WriteLine(<span style="color: #006080">"Got
Page {0}"</span>, i++); items.AddRange(c.Select(s =&gt; s.Entity)); } ); Console.WriteLine(items.Count);</pre>
        </div>
        <p>
The <strong>PagedQuery&lt;T&gt;</strong> method takes two arguments.  One is
the standard <strong>Expression&lt;Func&lt;SsdsEntity&lt;T&gt;, bool&gt;&gt;</strong> that
you use to specify the WHERE clause for SSDS, and the other is <strong>Action&lt;IEnumerable&lt;SsdsEntity&lt;T&gt;&gt;&gt;</strong> which
represents a delegate that takes an <strong>IEnumerable&lt;SsdsEntity&lt;T&gt;&gt;</strong> and
has a void return.  This is a delegate you provide that does something with the
500 entities returned per page (it gets called once per page).  Here, I am just
adding them into a <strong>List&lt;T&gt;</strong>, but I could easily be doing anything
else here.  Under the covers, this is adding the paging term dynamically into
the expression tree that is evaluated.
</p>
        <h3>What's next
</h3>
        <p>
This is a good head start on using the REST API with SSDS today.  However, there
are a number of optimizations that could be made to the model: additional overloads,
perhaps some extension methods for common operations, etc. 
</p>
        <p>
As new features are added, I will endeavor to update this as well (blob support comes
to mind here).  Additionally, I have a few optimizations planned around concurrency
for CRUD operations.  
</p>
        <p>
I have published this out to Code Gallery and I welcome feedback and bug fixes.  <a href="http://code.msdn.microsoft.com/ssdsrest">Linked
here</a>.
</p>
        <img width="0" height="0" src="http://dunnry.com/blog/aggbug.ashx?id=b37072b9-1fe8-4785-9df3-00861ab346f7" />
      </body>
      <title>Working with Objects in SSDS Part 3</title>
      <guid isPermaLink="false">http://dunnry.com/blog/PermaLink,guid,b37072b9-1fe8-4785-9df3-00861ab346f7.aspx</guid>
      <link>http://dunnry.com/blog/WorkingWithObjectsInSSDSPart3.aspx</link>
      <pubDate>Wed, 02 Jul 2008 23:43:26 GMT</pubDate>
      <description>&lt;p&gt;
Here is my last installment in this series of working with objects in SQL Server Data
Services.&amp;nbsp; For background, readers should read the following:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/SerializationInSSDS.aspx"&gt;Serialization in SSDS&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/WorkingWithObjectsInSSDSPart1.aspx"&gt;Working with Objects
in SSDS Part 1&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dunnry.com/blog/WorkingWithObjectsInSSDSPart2.aspx"&gt;Working with Objects
in SSDS Part 2&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Last time, we concluded with a class called &lt;strong&gt;SsdsEntity&amp;lt;T&amp;gt;&lt;/strong&gt; that
became an all-purpose wrapper or veneer around our CLR objects.&amp;nbsp; This made it
simple to take our existing classes and serialize them as entities in SSDS.
&lt;/p&gt;
&lt;p&gt;
In this post, I want to discuss how the querying in the REST library works.&amp;nbsp;
First a simple example:
&lt;/p&gt;
&lt;div&gt;&lt;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, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;var ctx = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SsdsContext( &lt;span style="color: #006080"&gt;"authority=http://dunnry.data.beta.mssds.com/v1/;username=dunnry;password=secret"&lt;/span&gt; );
var container = ctx.OpenContainer(&lt;span style="color: #006080"&gt;"foo"&lt;/span&gt;); var
foo = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Foo { IsPublic = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;,
Name = &lt;span style="color: #006080"&gt;"MyFoo"&lt;/span&gt;, Size = 12 }; &lt;span style="color: #008000"&gt;//insert
it with unique id guid string&lt;/span&gt; container.Insert(foo, Guid.NewGuid().ToString()); &lt;span style="color: #008000"&gt;//now
query for it&lt;/span&gt; var results = container.Query&amp;lt;Foo&amp;gt;(e =&amp;gt; e.Entity.IsPublic
== &lt;span style="color: #0000ff"&gt;false&lt;/span&gt; &amp;amp;&amp;amp; e.Entity.Size &amp;gt; 2); &lt;span style="color: #008000"&gt;//Query&amp;lt;T&amp;gt;
returns IEnumerable&amp;lt;SsdsEntity&amp;lt;T&amp;gt;&amp;gt;, so foreach over it&lt;/span&gt; &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var
item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; results) { Console.WriteLine(item.Entity.Name);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
I glossed over it in my previous posts with this library, but I have a class called &lt;strong&gt;SsdsContext&lt;/strong&gt; that
acts as my credential store and factory to create &lt;strong&gt;SsdsContainer&lt;/strong&gt; objects
where I perform my operations.&amp;nbsp; Here, I have opened a container called 'foo',
which would relate to the URI (&lt;a href="http://dunnry.data.beta.mssds.com/v1/foo"&gt;http://dunnry.data.beta.mssds.com/v1/foo&lt;/a&gt;)
according to the authority name I passed on the &lt;strong&gt;SsdsContext&lt;/strong&gt; constructor
arguments.
&lt;/p&gt;
&lt;p&gt;
I created an instance of my &lt;strong&gt;Foo&lt;/strong&gt; class (see &lt;a href="http://dunnry.com/blog/WorkingWithObjectsInSSDSPart1.aspx"&gt;this
post&lt;/a&gt; if you want to see what a &lt;strong&gt;Foo&lt;/strong&gt; looks like) and inserted it.&amp;nbsp;
We know that under the covers we have an &lt;strong&gt;XmlSerializer&lt;/strong&gt; doing the
work to serialize that to the proper POX wire format.&amp;nbsp; So far, so good.&amp;nbsp;
Now, I want to retrieve that same entity back from SSDS. The key line here is the
table.Query&amp;lt;T&amp;gt;() call.&amp;nbsp; It accepts a &lt;strong&gt;Expression&amp;lt;Func&amp;lt;SsdsEntity&amp;lt;T&amp;gt;,
bool&amp;gt;&amp;gt;&lt;/strong&gt; argument that represents a strongly typed query.
&lt;/p&gt;
&lt;p&gt;
For the uninitiated, the &lt;strong&gt;Expression&amp;lt;TDelegate&amp;gt;&lt;/strong&gt; is a way to
represent lambda expressions in an abstract syntax tree.&amp;nbsp; We can think of them
as a way to model what the expression does without generating the bits of code necessary
to actually do it.&amp;nbsp; We can inspect the &lt;strong&gt;Expression&lt;/strong&gt; and create
new ones based on it until finally we can call Compile and actually convert the representation
of the lambda into something that can execute.
&lt;/p&gt;
&lt;p&gt;
The &lt;strong&gt;Func&amp;lt;SsdsEntity&amp;lt;T&amp;gt;, bool&amp;gt;&lt;/strong&gt; represents a delegate that
accepts a &lt;strong&gt;SsdsEntity&amp;lt;T&amp;gt;&lt;/strong&gt; as an argument and re