<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>UK Premier Support for Developers</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/ukadc/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/ukadc/feed.xml</link>
    <description>Your dev. Our passion.</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:27:30 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SoundBytes 2013</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/soundbytes-2013</link>
      <pubDate>Fri, 14 Dec 2012 07:30:39 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/12/14/soundbytes-2013/</guid>
      <description><![CDATA[Attached is a list of our SoundBytes scheduled for 2013.
SoundBytes 2013.pdf]]></description>
      <content:encoded><![CDATA[<p>Attached is a list of our SoundBytes scheduled for 2013.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/37/81/28/SoundBytes%202013.pdf" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-37-81-28/SoundBytes-2013.pdf">SoundBytes 2013.pdf</a></p>]]></content:encoded>
    </item>
    <item>
      <title>October Newsletter - Forthcoming Microsoft UK Workshops</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/october-newsletter-forthcoming-microsoft-uk-workshops</link>
      <pubDate>Tue, 09 Oct 2012 02:37:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/10/09/october-newsletter-forthcoming-microsoft-uk-workshops/</guid>
      <description><![CDATA[Please see the link below for information on upcoming Microsoft UK workshops.
Workshop_Update.pdf]]></description>
      <content:encoded><![CDATA[<p>Please see the link below for information on upcoming Microsoft UK workshops.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/35/76/92/Workshop_Update.pdf" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-35-76-92/Workshop_5F00_Update.pdf">Workshop_Update.pdf</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio 2012 &amp; .NET 4.5 Tech|Briefing</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/visual-studio-2012-net-4-5-techbriefing</link>
      <pubDate>Tue, 09 Oct 2012 02:35:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/10/09/visual-studio-2012-net-4-5-techbriefing/</guid>
      <description><![CDATA[Visual Studio 2012 &amp; .NET 4.5 Tech|Briefing
Multiple dates in 2012 | 1 day Presentation | 32...]]></description>
      <content:encoded><![CDATA[<p><strong>Visual Studio 2012 &amp; .NET 4.5 Tech|Briefing</strong></p>
<p>Multiple dates in 2012 | 1 day Presentation | 32 PSfD hours</p>
<p>We are now able to bring the Visual Studio 2012 &amp; .NET<br />4.5 Tech|Briefing &ldquo;on the road&rdquo; to you. We will run the event at your offices<br />to anything from a small group of developers to your entire team. This is the<br />same event that received fantastic feedback when we ran it for over 150<br />delegates in Reading &ndash; but we&rsquo;ve also spent time analysing the feedback to<br />perfect the sessions even further. The day covers all the major features to<br />about Level 200 in the following areas;</p>
<ul>
<li>Visual Studio 2012</li>
<li>Team Foundation Server 2012</li>
<li>C# and .NET 4.5 Core</li>
<li>ASP.NET 4.5 and Entity Framework</li>
<li>WCF, WPF and WF 4.5</li>
<li>Windows 8 Application Development &amp; Windows<br />Store</li>
</ul>
<p>See the attached data sheet for more information. To book, contact<br />your ADM; they will provide options from the pre-reserved dates we have<br />available.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/35/76/90/Tech%20Briefing%20Datasheet.pdf" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-35-76-90/Tech-Briefing-Datasheet.pdf">Tech Briefing Datasheet.pdf</a></p>]]></content:encoded>
    </item>
    <item>
      <title>October Newsletter - Coming Up</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/october-newsletter-coming-up</link>
      <pubDate>Mon, 01 Oct 2012 03:50:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/10/01/october-newsletter-coming-up/</guid>
      <description><![CDATA[Windows 8: New User Interface Style App Development
20th &ndash; 22nd November 2012 | Microsoft...]]></description>
      <content:encoded><![CDATA[<h2>Windows 8: New User Interface Style App Development</h2>
<p><b>20<sup>th</sup> &ndash; 22<sup>nd </sup>November 2012 | Microsoft Campus, Reading | 3 day workshop | 14 PSfD&nbsp;hours per<br />delegate</b></p>
<p>This workshop is a three day deep dive into the key developer concepts of Metro style development. The workshop takes you through the most important features and architectural concepts that you will find in the next release of Windows. Examples of these are the new UI, Process Lifecycle Manager, Tiles and Notifications and the different contracts to name but a few. After this workshop, you will have written a fully functional working application. This is a hands-on workshop that exposes students to the new programming model for Windows 8.</p>
<h2>ASP.NET MVC 4 Ramp Up</h2>
<p><b>13<sup>th</sup> &amp;14<sup>th</sup> November 2012 | Microsoft Campus, Reading | 2 day workshop | 8 PSfD<br />hours per delegate</b></p>
<p>ASP.NET MVC has matured since release and is proving to be very popular with our customers; many have deployed or are currently developing new applications with it. The ASP.NET MVC Ramp Up is a two day workshop targeted at getting your developers and architects up to speed fast, whilst retaining a strong focus on &ldquo;doing it the right way&rdquo;. It was created early in the life of MVC, so has become a proven format over the years and has been updated with each major revision of the framework.</p>
<h2>SoundByte: Service Bus Server, the next generation<br />messaging middleware, Zulfiqar Ahmed</h2>
<p><strong>10:00am, 9<sup>th</sup> November 2012 | 1 hour webcast | 1</strong><br /><strong>PSfD hour for 2 connection</strong></p>
<p>Azure Service Bus is the core messaging middleware for Microsoft&rsquo;s next generation on-premises and cloud workloads. Service Bus Server brings the same reliable &amp; scalable middleware to on-premises workloads that has been available in the cloud for some time now. With 100% Azure compatibility, customers can easily move their workloads between on-premises and Azure. This session will be a preview of the recent Beta release of Service Bus Server; we will discuss server architecture, its messaging capabilities and the supported programming models.</p>
<p>&nbsp;</p>
<h2>SoundByte: Programming Visual Studio with Nuget and<br />Powershell, Rob Garfoot</h2>
<p><strong>3:00pm, 9<sup>th</sup> November 2012 | 1&nbsp;hour webcast | 1</strong><br /><strong>PSfD hour for 2 connection</strong></p>
<p>This SoundByte will cover how to use the PowerShell console that ships with NuGet to add new cmdlets to Visual Studio to automate common tasks. By the end of the session you will be familiar with:</p>
<ul>
<li>How to build a NuGet package that can be<br />deployed to Visual Studio to deliver a PowerShell module</li>
<li>How to build a PowerShell module that exports<br />commands capable of controlling Visual Studio</li>
<li>Providing IntelliSense to the cmdlets for easier<br />use and pipelining capabilities</li>
<li>See examples of building a couple of simple<br />cmdlets to demonstrate the process</li>
</ul>
<p>Knowledge of NuGet, Visual Studio automation and PowerShell<br />is not a pre-requisite.</p>]]></content:encoded>
    </item>
    <item>
      <title>October Newsletter - Developing Mobile Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/october-newsletter-developing-mobile-applications</link>
      <pubDate>Mon, 01 Oct 2012 03:44:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/10/01/october-newsletter-developing-mobile-applications/</guid>
      <description><![CDATA[Focus &ndash; Developing Mobile Applications &ndash; and why you should care
&nbsp;By Aidan Caffrey...]]></description>
      <content:encoded><![CDATA[<h1>Focus &ndash; Developing Mobile Applications &ndash; and why you should care</h1>
<h2>&nbsp;By Aidan Caffrey - Application Development Manager</h2>
<p>All around the world more users have a smart-phone and/or a tablet every day <sub>1.</sub> This change has caused the application marketplace to change drastically over a short space of time. In this <i>new world</i>, it is now easier (and maybe faster) to connect with and generate revenue from a large audience. It&rsquo;s also easy to be left behind with the high pace of change, or build an app that nobody wants&hellip;</p>
<p>More statistics are continually produced comparing web-traffic from mobile browsers to that from desktops, and revenue figures from apps/advertising <sub>2.</sub> The world is full of predictions of &ldquo;mobile browser traffic surpass[ing] desktop in 2014&rdquo; <sub>3</sub>. This means discussions have moved away from <i>whether to be considering the mobile space</i> to <i>we need to go mobile &ndash; but which way is best in our exact scenario</i>.</p>
<p>So let&rsquo;s consider and evaluate the different options:</p>
<p><strong>Do Nothing</strong>&nbsp;</p>
<p>It&rsquo;s entirely your prerogative to ignore the mobile<br />space. In some rare domains mobile doesn&rsquo;t make sense. It might actually cost<br />you more to solve this problem that you&rsquo;d generate in revenue.</p>
<p><strong>Make your app look good on a mobile browser</strong></p>
<p>&nbsp;You need to answer this key question &ndash; are<br />you updating your app purely to look good on mobile browsers, or are you<br />building different functionality for the mobile version of your app?</p>
<p>If your vision goes beyond look and feel, you<br />are actually building a different app. At this point your thoughts should turn<br />to code re-use, maintenance of the dual code bases, and how they evolve in the<br />future.</p>
<p>If it is just a User Experience issue, there<br />are two major options; &ndash; firstly, can you manage the differences purely with styling<br />changes? If so, CSS3 Media Queries could be the answer &ndash; provided your target browsers<br />support HTML5! If you cannot the alternative is for the server to respond with different<br />HTML based on the browser. In ASP.NET MVC 4 this is implemented with &ldquo;Display<br />Modes&rdquo;.</p>
<p><strong>Port your app to a native app for a particular OS.</strong></p>
<p>What platforms are you going to target? Windows<br />Phone, obviously&hellip; but how about iOS and Android? Once you&rsquo;ve decided, do you<br />have the skills and tooling in your team to do this? You may need training,<br />physical devices, emulators, IDEs, and more. How do you build it in a CI<br />environment, and what is the impact on your testers?</p>
<p>Native apps have a very different lifecycle; they<br />are in an &ldquo;often disconnected&rdquo; world, and the platforms will evolve<br />independently of your app; updates might change the way the app <i>can run</i>, its permissions, or the device<br />capabilities. Planning for the maintenance involved and determining the<br />economic and servicing model are fundamental to your success.</p>
<p><br /><strong>Hybrid<sub>4</sub></strong></p>
<p>Hybrids are built using HTML5 and JavaScript,<br />with a thin native wrapper around it. This reduces the amount of native code to<br />write, maintain, run, port and test, but can increase the skillset required.<br />Alternatively you could use tooling to do this part for you, but it is likely<br />to be limited to the &ldquo;lowest common denominator&rdquo; rather than fully utilizing<br />the device capabilities.<sub>5</sub></p>
<p>Which approach you select depends on your priorities and what you are trying to achieve. If you don&rsquo;t need to support mobile, do nothing; although this is rare today. If you do, using Media Queries or Display Modes can be a cost effective way to prevent a loss of business through a site not compatible with mobile devices, or to start providing great mobile experiences for like-for-like feature scenarios. When your gear shifts to investment, seeing mobile as a true growth area and a distinct part of your offering, start thinking about native or hybrid approaches. This brings the ability to target your feature set and User Experience directly at mobile users in return for additional effort in development, maintenance, and related disciplines such as<br />marketing.</p>
<p>Whichever way sounds right to you, speak to your Application Development Manager about how we can help; we have ADMs that have specialist skills in ASP.NET WebForms, MVC, JavaScript, HTML 5, and in native device development on Windows Phone or Windows 8. We can teach you the technologies, run Architecture &amp; Design sessions to help you choose the right mix for your scenario, partner with you to build a Proof of Concept, or conduct reviews of your progress at regular intervals to help you stay on the right path.</p>
<p>&nbsp;</p>
<p>References:</p>
<ol>
<li><a href="http://blog.flurry.com/">http://blog.flurry.com/</a></li>
<li><a href="http://mobithinking.com/guide-mobile-web-uk">http://mobithinking.com/guide-mobile-web-uk</a></li>
<li><a href="http://www.smartinsights.com/mobile-marketing/mobile-marketing-analytics/mobile-marketing-statistics/">http://www.smartinsights.com/mobile-marketing/mobile-marketing-analytics/mobile-marketing-statistics/</a></li>
<li><a href="http://www.readwriteweb.com/mobile/2012/01/hybrid-html5-apps-are-more-les.php">http://www.readwriteweb.com/mobile/2012/01/hybrid-html5-apps-are-more-les.php</a></li>
<li><a href="http://www.phonegap.com/">http://www.phonegap.com/</a></li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Service Bus Property Promotion Nuget Package</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/service-bus-property-promotion-nuget-package</link>
      <pubDate>Tue, 24 Jul 2012 02:09:26 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/07/24/service-bus-property-promotion-nuget-package/</guid>
      <description><![CDATA[I have just published a Nuget package which adds property promotion features to Service Bus WCF...]]></description>
      <content:encoded><![CDATA[<p>I have just published a <a href="https://nuget.org/packages/ServiceBus.Extensions.PromotedProperties/1.0.1">Nuget package</a> which adds <a href="http://zamd.net/2011/05/25/pubsub-with-wcf-part-2/">property promotion</a> features to <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30376">Service Bus</a> WCF programing model.</p>
<p><a href="http://zuahmed.files.wordpress.com/2012/07/image.png"><img width="1028" height="687" title="image" style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" alt="image" src="http://zuahmed.files.wordpress.com/2012/07/image_thumb.png?w=1028&amp;h=687" border="0" /></a></p>
<p>Once you added the package to your project you can use the <strong>PromotedProperty </strong>attribute to mark your properties as promoted. The package supports promotion from both complex &amp; primitive arguments. In addition to PromotedPropertyAttribute you also need to stick <strong>PropertyPromotionBehavior</strong> on each method of your service contract.</p>
<p>Following service contract captures the sample usage.</p>
<div class="wlWriterEditableSmartContent" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0bc11f2f-720e-4e36-9a5b-c8bf2655216c" style="margin: 0px; padding: 0px; float: none; display: inline;">
<div style="border: 1px solid #000080; color: #000000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;">
<div style="background: #ffffff; overflow: auto; max-height: 300px;"><ol style="background: #ffffff; margin: 0px; padding: 0px 0px 0px 5px; white-space: nowrap;">
<li><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #2b91af;">Order</span></li>
<li style="background: #f3f3f3;">{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> Amount { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</li>
<li style="background: #f3f3f3;">&nbsp;&nbsp;&nbsp;&nbsp;[<span style="color: #2b91af;">PromotedProperty</span>]</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">string</span> ShipCity { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }</li>
<li style="background: #f3f3f3;">}</li>
<li>&nbsp;</li>
<li style="background: #f3f3f3;">[<span style="color: #2b91af;">ServiceContract</span>]</li>
<li><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> <span style="color: #2b91af;">IOrderService</span></li>
<li style="background: #f3f3f3;">{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;[<span style="color: #2b91af;">OperationContract</span>(Name = <span style="color: #a31515;">"SubmitFlat"</span>, IsOneWay = <span style="color: #0000ff;">true</span>)]</li>
<li style="background: #f3f3f3;">&nbsp;&nbsp;&nbsp;&nbsp;[<span style="color: #2b91af;">PropertyPromotionBehavior</span>]</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">void</span> Submit(<span style="color: #0000ff;">double</span> amount, [<span style="color: #2b91af;">PromotedProperty</span>] <span style="color: #0000ff;">string</span> shipCity);</li>
<li style="background: #f3f3f3;">&nbsp;</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;[<span style="color: #2b91af;">OperationContract</span>(IsOneWay = <span style="color: #0000ff;">true</span>)]</li>
<li style="background: #f3f3f3;">&nbsp;&nbsp;&nbsp;&nbsp;[<span style="color: #2b91af;">PropertyPromotionBehavior</span>]</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000ff;">void</span> Submit(<span style="color: #2b91af;">Order</span> order);</li>
<li style="background: #f3f3f3;">}</li>
</ol></div>
<p></p>
</div>
<p></p>
</div>
<p>Enjoy&hellip;</p>
<p><strong>Posted by Zulfiqar Ahmed on July 18th </strong>(<a href="http://zamd.net/2012/07/18/service-bus-property-promotion-nuget-package/">http://zamd.net/2012/07/18/service-bus-property-promotion-nuget-package/)</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Migrated to Azure Web Sites</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/migrated-to-azure-web-sites</link>
      <pubDate>Thu, 12 Jul 2012 02:00:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/07/12/migrated-to-azure-web-sites/</guid>
      <description><![CDATA[I&rsquo;ve been thinking about moving this blog over to Windows Azure for a while, but I&rsquo;ve...]]></description>
      <content:encoded><![CDATA[<p>I&rsquo;ve been thinking about moving this blog over to Windows Azure for a while, <br />but I&rsquo;ve finally got around to it, and it has to be said the experience was <br />pretty simple. Previously I&rsquo;d experimented with <a title="Windows Azure Cloud Services" href="https://www.windowsazure.com/en-us/home/features/cloud-services/" target="_blank" jquery1720005083400368240509="1">Windows Azure Cloud Services</a>, <br />specifically packaging it up as a web role. However, this blog is powered by <a title="WordPress" href="http://wordpress.org/" target="_blank" jquery1720005083400368240509="2">WordPress</a>, which is PHP and MySql based, so <br />this wasn&rsquo;t the simplest process in the world, and left quite a lot to be <br />desired when it came to enabling and using all the WordPress features, like <br />being able to use plugins without having to repackage the web role. But then <a title="Windows Azure Web Sites" href="https://www.windowsazure.com/en-us/home/features/web-sites/" target="_blank" jquery1720005083400368240509="3">Windows Azure Web Sites</a> comes along, and <br />migrating was simple.</p>
<p>In case anyone else is looking to do the same, here&rsquo;s the steps I <br />followed:</p>
<ul>
<li>Backed up all the files from my blog at my existing hosting provider (in <br />this case copied everything locally via FTP)</li>
<li>Exported the MySql database at my existing hosting provider to a local SQL <br />file using <a title="MySql Workbench" href="http://www.mysql.com/products/workbench/" target="_blank" jquery1720005083400368240509="4">MySql Workbench</a>&nbsp;(yes, I know I could do <br />this with a command line, but I like GUIs!)</li>
<li>Logged into the Windows Azure Management Portal and created a new Windows <br />Azure Web Site from the gallery, and selected WordPress as the template</li>
<li>I didn&rsquo;t bother setting up WordPress as I was going to copy over everything</li>
<li>Connected to the new Windows Azure Web Site via FTP, and copied over all the <br />files I backed up from my existing provider</li>
<li>At this point the site mostly worked as it was connecting back to my <br />existing MySql database</li>
<li>Logged into the WordPress Dashboard to reconfigure the site URL to the <br />Windows Azure Web Site URL</li>
<li>Connected to the new MySql database created by the Windows Azure Web Site <br />WordPress template with MySql Workbench, and imported the export I took earlier</li>
<li>Opened up the wp-config.php file in the root of the web site, and <br />reconfigured the MySql database connection information</li>
<li>All done!</li>
</ul>
<p>Well, when I say all done, I mean that WordPress, with all my content and <br />options, is running in Windows Azure. However, I also had to move all the DNS <br />for phazed.com over too, and that&rsquo;s where I tripped over a little. You can <br />certainly do this with Windows Azure Web Sites, you just need to use a reserved <br />instance, add a CNAME in your domain for the Windows Azure Web Site hostname, <br />and then add a custom domain to your Windows Azure Web Site. This is all <br />explained quite well here:</p>
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazurewebsitespreview/thread/2a22b012-dc80-4f7a-9500-2a5ff628b5c4" jquery1720005083400368240509="5">http://social.msdn.microsoft.com/Forums/en-US/windowsazurewebsitespreview/thread/2a22b012-dc80-4f7a-9500-2a5ff628b5c4</a></p>
<p>There&rsquo;s a caveat however. At the moment you can only add custom domains using <br />CNAMEs, which is practice means I can add www.phazed.com for <br />phazed.azurewebsites.net, but not phazed.com (without the www).&nbsp;Apparently&nbsp;it&rsquo;s <br />coming, but this was a problem for this blog as all the permalinks used <br />phazed.com, not www.phazed.com. I won&rsquo;t bore you with the details of how, but I <br />got around it by adding some redirection at my DNS hoster for phazed.com to <br />www.phazed.com, and bulk editing the contents of the database export before <br />importing back into the new MySql database.</p>
<p>Anyway, it&rsquo;s all done, and I&rsquo;m quite pleased that&rsquo;s the blog is finally on <br />Windows Azure. It&rsquo;s even a little faster I think!</p>
<p><em><a href="http://www.phazed.com/2012/07/11/migrated-to-azure-web-sites/">Original post by Rupert Benbrook on July 12th 2012.</a></em></p>]]></content:encoded>
    </item>
    <item>
      <title>Entity Framework 5: Controlling automatic query compilation</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/entity-framework-5-controlling-automatic-query-compilation</link>
      <pubDate>Thu, 21 Jun 2012 02:00:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/06/21/entity-framework-5-controlling-automatic-query-compilation/</guid>
      <description><![CDATA[When working with LINQ to Entities, Entity Framework has to parse the expression tree from the LINQ...]]></description>
      <content:encoded><![CDATA[<p>When working with LINQ to Entities, Entity Framework has to parse the expression tree from the LINQ query and convert it to SQL. It is possible to save the output of this using <a href="http://msdn.microsoft.com/en-us/library/bb896297.aspx">CompiledQuery</a>, but this is something that you have to manually code. One of the new features coming in Entity Framework 5 (EF5) is automatic query compilation (see <a href="http://blogs.msdn.com/b/efdesign/archive/2011/06/30/auto-compiled-linq-queries-entity-framework-june-2011-ctp.aspx">here</a>) and it is enabled it by default. For repeated queries this can bring some nice performance improvements (as demonstrated <a href="http://blogs.msdn.com/b/adonet/archive/2012/02/14/sneak-preview-entity-framework-5-0-performance-improvements.aspx">here</a>).</p>
<p>The posts from the EF team show how to control the caching by setting context.ContextOptions.DefaultQueryPlanCachingSetting = false. In the Release Candidate for EF5 this property is no longer there. Instead, you need to set the EnablePlanCaching property on the ObjectSets. As an example, consider the following simple query:</p>
<p>&nbsp;</p>
<div class="wlWriterEditableSmartContent" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:445588be-80ec-454a-aa96-451d1e89b06c" style="margin: 0px; padding: 0px; float: none; display: inline;">
<div style="border: 1px solid #000080; color: #000000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;">
<div style="padding: 2px 5px; overflow: auto; max-height: 300px; background-color: #ffffff;"><span style="background: #ffffff; color: #0000ff;">var</span><span style="background: #ffffff; color: #000000;"> query1 = </span><span style="background: #ffffff; color: #0000ff;">from</span><span style="background: #ffffff; color: #000000;"> customer </span><span style="background: #ffffff; color: #0000ff;">in</span><span style="background: #ffffff; color: #000000;"> context.Customers</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">where</span><span style="background: #ffffff; color: #000000;"> customer.Country == </span><span style="background: #ffffff; color: #a31515;">"UK"</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">select</span><span style="background: #ffffff; color: #000000;"> customer;</span></div>
</div>
</div>
<p>In this query, context.Customers is the ObjectSet. To disable caching we need to set the EnablePlanCaching property as shown below:</p>
<p>&nbsp;</p>
<div class="wlWriterEditableSmartContent" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:66e30f9e-2981-4d3b-a1cd-80f3aba8c573" style="margin: 0px; padding: 0px; float: none; display: inline;">
<div style="border: 1px solid #000080; color: #000000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;">
<div style="padding: 2px 5px; overflow: auto; max-height: 300px; background-color: #ffffff;"><span style="background: #ffffff; color: #2b91af;">ObjectQuery</span><span style="background: #ffffff; color: #000000;">&lt;</span><span style="background: #ffffff; color: #2b91af;">Customer</span><span style="background: #ffffff; color: #000000;">&gt; customersNoCache = context.Customers;</span><br /> <span style="background: #ffffff; color: #000000;">customersNoCache.EnablePlanCaching = </span><span style="background: #ffffff; color: #0000ff;">false</span><span style="background: #ffffff; color: #000000;">;</span><br /> <span style="background: #ffffff; color: #0000ff;">var</span><span style="background: #ffffff; color: #000000;"> query1 = </span><span style="background: #ffffff; color: #0000ff;">from</span><span style="background: #ffffff; color: #000000;"> customer </span><span style="background: #ffffff; color: #0000ff;">in</span><span style="background: #ffffff; color: #000000;"> context.Customers</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">where</span><span style="background: #ffffff; color: #000000;"> customer.Country == </span><span style="background: #ffffff; color: #a31515;">"UK"</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">select</span><span style="background: #ffffff; color: #000000;"> customer;</span></div>
</div>
</div>
<p>Personally, this feels like quite a lot of noise that gets in the way of the query. To solve this I created a little extension method that means we can now write the query as</p>
<div class="wlWriterEditableSmartContent" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2c51caaf-a0c9-48e0-b0a8-55eb88e852b1" style="margin: 0px; padding: 0px; float: none; display: inline;">
<div style="border: 1px solid #000080; color: #000000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;">
<div style="padding: 2px 5px; overflow: auto; max-height: 300px; background-color: #ffffff;"><span style="background: #ffffff; color: #0000ff;">var</span><span style="background: #ffffff; color: #000000;"> query1 = </span><span style="background: #ffffff; color: #0000ff;">from</span><span style="background: #ffffff; color: #000000;"> customer </span><span style="background: #ffffff; color: #0000ff;">in</span><span style="background: #ffffff; color: #000000;"> context.Customers.DisablePlanCaching()</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">where</span><span style="background: #ffffff; color: #000000;"> customer.Country == </span><span style="background: #ffffff; color: #a31515;">"UK"</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">select</span><span style="background: #ffffff; color: #000000;"> customer;</span></div>
</div>
</div>
<p>&nbsp;</p>
<p>The extension methods to achieve this are really pretty simple:</p>
<div class="wlWriterEditableSmartContent" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6761587e-a2d8-440b-a099-3eb168f9290f" style="margin: 0px; padding: 0px; float: none; display: inline;">
<div style="border: 1px solid #000080; color: #000000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;">
<div style="padding: 2px 5px; overflow: auto; max-height: 300px; background-color: #ffffff;"><span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">public</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #0000ff;">static</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #0000ff;">class</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #2b91af;">ObjectQueryExtensions</span><br /> <span style="background: #ffffff; color: #000000;">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">public</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #0000ff;">static</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #2b91af;">ObjectQuery</span><span style="background: #ffffff; color: #000000;">&lt;T&gt; DisablePlanCaching&lt;T&gt;(</span><span style="background: #ffffff; color: #0000ff;">this</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #2b91af;">ObjectQuery</span><span style="background: #ffffff; color: #000000;">&lt;T&gt; query)</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;">query.EnablePlanCaching = </span><span style="background: #ffffff; color: #0000ff;">false</span><span style="background: #ffffff; color: #000000;">;</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">return</span><span style="background: #ffffff; color: #000000;"> query;</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;">}</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">public</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #0000ff;">static</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #2b91af;">ObjectQuery</span><span style="background: #ffffff; color: #000000;"> DisablePlanCaching(</span><span style="background: #ffffff; color: #0000ff;">this</span><span style="background: #ffffff; color: #000000;"> </span><span style="background: #ffffff; color: #2b91af;">ObjectQuery</span><span style="background: #ffffff; color: #000000;"> query)</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;">{</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;">query.EnablePlanCaching = </span><span style="background: #ffffff; color: #0000ff;">false</span><span style="background: #ffffff; color: #000000;">;</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;"></span><span style="background: #ffffff; color: #0000ff;">return</span><span style="background: #ffffff; color: #000000;"> query;</span><br /> &nbsp;&nbsp;&nbsp;&nbsp;<span style="background: #ffffff; color: #000000;">}</span><br /> <span style="background: #ffffff; color: #000000;">}</span></div>
</div>
</div>
<p>&nbsp;</p>
<p>Enjoy!</p>
<p>Original Post by Stuart Leeks on June&nbsp;12th, 2012</p>
<p>Here: <a href="http://blogs.msdn.com/b/stuartleeks/archive/2012/06/12/entity-framework-5-controlling-automatic-query-compilation.aspx">http://blogs.msdn.com/b/stuartleeks/archive/2012/06/12/entity-framework-5-controlling-automatic-query-compilation.aspx</a></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>ASP.NET MVC: Supplying HTML attributes with EditorFor</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/asp-net-mvc-supplying-html-attributes-with-editorfor</link>
      <pubDate>Thu, 31 May 2012 02:00:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/05/31/asp-net-mvc-supplying-html-attributes-with-editorfor/</guid>
      <description><![CDATA[My colleague Simon Ince and I recently discovered that we had been working on the same problem...]]></description>
      <content:encoded><![CDATA[<p>My colleague <a href="http://blogs.msdn.com/simonince">Simon Ince</a> and I recently discovered that we had been working on the same problem independently so we combined our efforts and have written a <a href="http://blogs.msdn.com/b/ukadc/archive/2012/05/24/asp-net-mvc-adding-html-attributes-in-templated-helpers-editorfor.aspx">joint blog post on our team blog</a>.</p>
<p>The problem was something that I&rsquo;d encountered in a number of blog posts that used modified editor templates <a href="http://blogs.msdn.com/b/stuartleeks/archive/2011/01/25/asp-net-mvc-3-integrating-with-the-jquery-ui-date-picker-and-adding-a-jquery-validate-date-range-validator.aspx">(jQuery UI datepicker</a>, <a href="http://blogs.msdn.com/b/stuartleeks/archive/2012/05/01/asp-net-mvc-adding-aria-required-attribute-for-required-fields.aspx">aria-required</a> and <a href="http://blogs.msdn.com/b/stuartleeks/archive/2012/05/02/asp-net-mvc-amp-jquery-ui-autocomplete-part-2-editorfor.aspx">autocomplete</a>). In each of these posts I ended up adding a custom template, and then updating it to output an attribute in the rendered HTML. The thing that bothered me about all of these posts is that they didn&rsquo;t compose well. For example, if you wanted to combine autocomplete and aria-required then you&rsquo;d have to merge the changes to the templates. In the <a href="http://blogs.msdn.com/b/ukadc/archive/2012/05/24/asp-net-mvc-adding-html-attributes-in-templated-helpers-editorfor.aspx">blog post</a>, Simon and I walk through a fairly simple way to solve this problem with the introduction of HtmlAttributeProvider.</p>
<h2>aria-required</h2>
<p>In the remainder of this post I thought I&rsquo;d show how the previous solutions would look with the new HtmlAttributeProvider. In the joint post we show how the <a href="http://blogs.msdn.com/b/stuartleeks/archive/2012/05/01/asp-net-mvc-adding-aria-required-attribute-for-required-fields.aspx">aria-required</a> scenario can be handled simply by adding the following line of code to global.asax:</p>
<blockquote>
<p><span style="font-family: Courier New;" face="Courier New">HtmlAttributeProvider.Register(metadata =&gt;metadata.IsRequired, "aria-required", true);</span></p>
</blockquote>
<p>This simply says that when the model metadata has the IsRequired field set (e.g. if the property on the model has the Required attribute applied) then output an attribute with name &ldquo;aria-required&rdquo; and value &ldquo;true&rdquo;.</p>
<h2>jQuery UI datepicker</h2>
<p>In the case of the <a href="http://blogs.msdn.com/b/stuartleeks/archive/2011/01/25/asp-net-mvc-3-integrating-with-the-jquery-ui-date-picker-and-adding-a-jquery-validate-date-range-validator.aspx">jQuery UI datepicker</a> the approach is also simplified. In fact, we no longer need to create the Date.cshtml editor template. Instead we can simply add the following line of code to global.asax:</p>
<blockquote>
<p><span style="font-family: Courier New;" face="Courier New">HtmlAttributeProvider.Register(metadata =&gt; metadata.DataTypeName == "Date", "class", "date");</span></p>
</blockquote>
<p>This code says that if the DataTypeName is Date (e.g. if you&rsquo;ve added the DataType(DataType.Date) attribute to the model property) then it should add the &ldquo;date&rdquo; class to the element. Note that the attribute provider handles merging attribute values, so this will add the &ldquo;date&rdquo; class to the other class values (i.e. it plays nicely with the classes that are added by default)</p>
<h2>jQuery UI autocomplete</h2>
<p>The autocomplete change requires a little bit more effort, but only a little! To trigger the autocomplete behaviour, we added a &ldquo;data-autocomplete-url&rdquo; attribute with the value of the URL that returns the autocomplete data. The generation of the URL uses HtmlHelper, so we need to use the overload of HtmlAttributeProvider.Register that allows us to pass a delegate that takes the HtmlHelper as a parameter:</p>
<blockquote>
<p><span style="font-family: Courier New;" face="Courier New">HtmlAttributeProvider.Register((html, metadata) =&gt; <br />{ <br />&nbsp;&nbsp;&nbsp; string autocompleteUrl = html.GetAutoCompleteUrl(metadata); <br />&nbsp;&nbsp;&nbsp; if (!string.IsNullOrEmpty(autocompleteUrl)) <br />&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new[] { new KeyValuePair&lt;string, object&gt;( <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "data-autocomplete-url", autocompleteUrl) }; <br />&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp; return null; <br />});</span></p>
</blockquote>
<p>The Register overload here expects a collection of attributes (KeyValuePairs) to be returned. The previous examples could have been written using this overload, but we opted to add a Register overload to simplify that common scenario.</p>
<h2>Summary</h2>
<p>Whilst it is nice that the previous scenarios have been simplified by the introduction of HtmlAttributeProvider, the <em><span style="text-decoration: underline;">real</span></em> benefit is the composability as you can simply add multiple registrations!</p>
<p>&nbsp;</p>
<p>Original Post by Stuart Leeks on May 24th, 2012</p>
<p>Here: <a href="http://blogs.msdn.com/b/stuartleeks/archive/2012/05/24/asp-net-mvc-supplying-html-attributes-with-editorfor.aspx">http://blogs.msdn.com/b/stuartleeks/archive/2012/05/24/asp-net-mvc-supplying-html-attributes-with-editorfor.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Injecting Custom HTML Attributes in ASP.NET MVC</title>
      <link>https://docs.microsoft.com/archive/blogs/ukadc/injecting-custom-html-attributes-in-asp-net-mvc</link>
      <pubDate>Thu, 31 May 2012 02:00:00 GMT</pubDate>
      <dc:creator><![CDATA[ukadc]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ukadc/2012/05/31/injecting-custom-html-attributes-in-asp-net-mvc/</guid>
      <description><![CDATA[Recently Stuart Leeks and I have developed a worrying pattern of having the same ideas at the same...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Calibri; font-size: small;" face="Calibri" size="3">Recently </span><a href="http://blogs.msdn.com/stuartleeks"><span style="color: #0000ff; font-family: Calibri; font-size: small;" face="Calibri" size="3" color="#0000ff">Stuart Leeks</span></a><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri"> and I have developed a worrying pattern of having the same ideas at the same time. I&rsquo;m starting to doubt we&rsquo;re different people. Except he&rsquo;s about a foot taller so maybe that&rsquo;s aspirational from my side.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;" face="Calibri" size="3">Our latest coinciding of ideas was a way to automatically inject HTML attributes for fields rendered as part of your model with Html.EditorFor. We&rsquo;ve just blogged about it on our team blog &ndash; </span><a href="http://blogs.msdn.com/b/ukadc/archive/2012/05/24/asp-net-mvc-adding-html-attributes-in-templated-helpers-editorfor.aspx"><span style="color: #0000ff; font-family: Calibri; font-size: small;" face="Calibri" size="3" color="#0000ff">Adding Html Attributes in Templated Helpers</span></a><span style="font-family: Calibri; font-size: small;" face="Calibri" size="3">, published the code on the MSDN Code Gallery under </span><a href="http://code.msdn.microsoft.com/Code-for-UkadcHtmlAttribute-7cc49a05"><span style="color: #0000ff; font-family: Calibri; font-size: small;" face="Calibri" size="3" color="#0000ff">UkadcHtmlAttributeProvider</span></a><span style="font-family: Calibri; font-size: small;" face="Calibri" size="3">, and pushed a working version to </span><a href="http://www.nuget.org/packages/UkadcHtmlAttributeProvider"><span style="color: #0000ff; font-family: Calibri; font-size: small;" face="Calibri" size="3" color="#0000ff">NuGet under UkadcHtmlAttributeProvider</span></a><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">.</span></span></p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">Have a read of the blog post to learn more. To try our solution just use the NuGet command;</span></span></p>
<p><span style="font-family: courier new,courier; font-size: small;" size="3">Install-Package UkadcHtmlAttributeProvider</span></p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">A few examples of attribute provider delegate registrations are below. Do let us know if you like the approach!</span></span></p>
<p><b><i><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">Output the aria-required attribute for required fields;</span></span></i></b></p>
<p><span style="font-family: courier new,courier;">HtmlAttributeProvider.Register(</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp; metadata =&gt; metadata.IsRequired,</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp; "aria-required",</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp; "true");</span></p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">This results in the following HTML for a string field;</span></span></p>
<p><span style="font-family: courier new,courier; font-size: small;" size="3">&lt;input aria-required="true" class="text-box single-line" &hellip; snip &hellip; /&gt;</span></p>
<p><b><i><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">Output an HTML 5 Custom Data Attribute (CDA) when the field contains a URL;</span></span></i></b></p>
<p><span style="font-family: courier new,courier;">HtmlAttributeProvider.Register(</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp; metadata =&gt; metadata.DataTypeName == "Url",</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp; "data-url",</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp; "true");</span></p>
<p>&nbsp;<span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">This results in the following HTML for a string field;</span></span></p>
<p><span style="font-family: courier new,courier; font-size: small;" size="3">&lt;input class="text-box single-line" data-url="true" &hellip; snip &hellip; /&gt;</span></p>
<p><b><i><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">Output the Square Root of a value of a number field as an HTML 5 CDA;</span></span></i></b></p>
<p><span style="font-family: courier new,courier;">HtmlAttributeProvider.Register((html, metadata) =&gt;</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; {</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (metadata.ModelType == typeof(Int32))</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new[]</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;new KeyValuePair&lt;string, object&gt;(</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"data-sqroot-value",</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Math.Sqrt(</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert.ToDouble(metadata.Model)))</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Enumerable.Empty&lt;KeyValuePair&lt;string, object&gt;&gt;();</span></p>
<p><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; });</span></p>
<p>&nbsp;<span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">This results in the following HTML for an Integer field;</span></span></p>
<p><span style="font-family: courier new,courier; font-size: small;" size="3">&lt;input class="text-box single-line" data-sqroot-value="4.58257569495584" &hellip; snip&hellip; /&gt;</span></p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri">OK so that last one is a bit arbitrary &ndash; but there&rsquo;s a huge amount you can do here. Think of tab indexes, URLs for Ajax callbacks, CSS classes&hellip; the list goes on.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;" face="Calibri" size="3">Head over to the </span><a href="http://blogs.msdn.com/b/ukadc/archive/2012/05/24/asp-net-mvc-adding-html-attributes-in-templated-helpers-editorfor.aspx"><span style="color: #0000ff; font-family: Calibri; font-size: small;" face="Calibri" size="3" color="#0000ff">blog post</span></a><span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"> to read about how it works. And check out </span><a href="http://blogs.msdn.com/b/stuartleeks/archive/2012/05/24/asp-net-mvc-supplying-html-attributes-with-editorfor.aspx"><span style="color: #0000ff; font-family: Calibri; font-size: small;" face="Calibri" size="3" color="#0000ff">Stu&rsquo;s follow-up post</span></a><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri"> on some good real examples.</span></span></p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri"></span></span>&nbsp;</p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri"></span></span>&nbsp;</p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri"></span></span></p>
<p>&nbsp;</p>
<p><span style="font-size: small;" size="3"><span style="font-family: Calibri;" face="Calibri"></span></span></p>
<p>Original Post by Simon Ince on May 24th, 2012</p>
<p>Here: <a href="http://blogs.msdn.com/b/simonince/archive/2012/05/24/injecting-custom-html-attributes-in-asp-net-mvc.aspx">http://blogs.msdn.com/b/simonince/archive/2012/05/24/injecting-custom-html-attributes-in-asp-net-mvc.aspx</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>