<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>The .NET Addict's Blog</title><link>http://dotnetaddict.dotnetdevelopersjournal.com/</link><description>The obsessive ramblings of a man hopelessly addicted to all things programming, including .NET, C#, Networking, Gaming, and much more.</description><copyright>Copyright 2009 dotnetaddict.dotnetdevelopersjournal.com</copyright><generator /><lastBuildDate>Wed, 15 Jul 2009 11:38:00 GMT</lastBuildDate><image><title>The .NET Addict's Blog</title><url>http://files.blog-city.com//files/J05/88284/p/f/penfold.jpg</url><link>http://dotnetaddict.dotnetdevelopersjournal.com/</link></image><ttl>360</ttl><docs>http://backend.userland.com/rss</docs><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/dotnetaddict" type="application/rss+xml" /><item><title>Silverlight Polling Duplex Channel is NOT a Scalable Solution</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/sl_polling_duplex.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/sl_polling_duplex.htm</link><pubDate>Wed, 01 Jul 2009 12:41:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=sl%5Fpolling%5Fduplex</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>First, let&#39;s talk about the problem that Polling Duplex solves. Polling Duplex is a special WCF channel that is <em>available only to Silverlight</em>. When your Silverlight application needs data from the server, it needs it in one of two different ways: </p><ul><li>On-Demand : Something in your application happens and it needs data. It specifically asks the server for that data upon encountering the need for that data. This is what most people think of as &quot;pull&quot; data. </li><li>Push : This is where you need data sent to your application as the data becomes available and the overhead of setting up a timer on which you pull (or poll) for data is unacceptable to you. The main reason why this is unacceptable to people is because there may be frequent periods of time where the pull/poll has no data, which means your app will be occupying server resources every X seconds even when there is nothing to do.</li></ul><p>The Polling Duplex channel is a solution to the push problem. It allows server-side code to &quot;push&quot; data down to the Silverlight application. Under the hood the channel is using &quot;Comet&quot;-style tricks keeping HTTP connections open in much the same way that the Gmail application is able to receive push notifications of new mail.</p><p>This is great and the programming model for communicating with the Polling Duplex channel is brain-dead simple. It does <em>NOT get any easier </em>to implement push data to a RIA - not in Flash, not in AIR, and certainly not in JavaFX. The problem is that this solution doesn&#39;t scale. On the server side, for each concurrently running Silverlight application (so probably one per concurrent user), there is a full live socket being consumed that will not be relinquished until the client disconnects/closes their browser.</p><p>Worse is that the Polling Duplex channel defaults to only allowing 10 concurrent connections. You can programmatically tweak that by configuring the throttling behavior (as shown in this <a href="http://weblogs.asp.net/alexeyzakharov/archive/2009/04/17/how-to-increase-amount-of-silverlight-duplex-clients.aspx" target="_blank">blog post here</a> ).Even if you do increase the amount of concurrent connections allowed, those concurrent connections are still going to beat the crap out of your servers and good luck getting that to work seamlessly in a cluster/farm scenario. </p><p>If you need more than a handful of concurrent users and you want to do it in a way that scales and doesn&#39;t abuse your servers, then I highly, highly recommend looking into some kind of messaging / open gateway server. The only one I&#39;ve played with for more than a few minutes is <a href="http://www.kaazing.org/confluence/display/KAAZING/Home" target="_blank">Kaazing</a> , but I have nothing but good things to say about it. It&#39;s based on HTML 5 Web Sockets so you will be in good shape for the future. </p><p>Web Sockets are freaking awesome but that&#39;s a topic for another post.</p><p>Bottom line here is that if you&#39;re looking at any of the Polling Duplex samples online like the &quot;stock ticker&quot; sample, don&#39;t be fooled. It looks easy, but especially in the financial industry, you need high concurrency, high speed, low latency - and you&#39;re not going to get that with the polling duplex channel. If there was one place where I see it fitting is in the creation of intranet applications internal to an organization with a limited number of concurrent users. </p>]]></description><category>silverlight</category><category>duplex</category><category>wcf</category><category>polling</category><category>push</category></item><item><title>Crickets</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/crickets.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/crickets.htm</link><pubDate>Sun, 21 Jun 2009 00:44:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=crickets</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>As the two remaining readers of this blog are aware, I haven&#39;t posted a blog entry in quite some time. I have finally managed to get a few quiet moments in front of a computer (I&#39;m waiting for a hideously long file transfer via hotel wireless, so I quite literally had nothing better to do). As a result of having a few minutes to myself I thought I would put up a blog post explaining my absence.</p><p>A couple of weeks ago my family and I started packing boxes in preparation for fleeing the great state of New Jersey. We packed everything up, threw as much as we could in the minivan and trekked up to Connecticut where I have taken a new position with a new company as a .NET Architect. As any of you who have moved before know, it&#39;s an incredibly stressful experience and the logistics involved are absolutely ridiculous. It&#39;s a miracle I still know where my car keys, sneakers, and computers are. At one point I was sure I&#39;d left the cat on the roof of the minivan. </p><p>We&#39;re now in Connecticut, huddled into a small hotel room while we await the closing date on our new house. One of the rather unexpected side effects of moving was that, in relinquishing equipment belonging to my previous company, I suddenly realized that I do not actually own a machine capable of running Windows Vista or Windows 7, thereby preventing me from accessing Visual Studio 2008 or VS2010!! All of my addictions to things like Azure, Oslo, &quot;M&quot;, and VS2010 are currently suffering horrible withdrawal symptoms.</p><p>Needless to say, while I currently only own a Macbook Air and a Macbook Pro 17&quot; (without enough disk space remaining to boot camp Vista), I haven&#39;t had much in the way of ability to blog about my usual fare. I am using the iPhone 3.0 SDK which, I believe is still currently under NDA (though as of yesterday it might not be...).</p><p>So the plan is thus: I will acquire a Windows machine once we&#39;ve closed on the house and paid for the essentials that are normally associated with moving into a new place. Then I will be able to go back to blogging about the finer points of WCF4, WF4, C#4, Azure, and all the other goodies coming up. Also, if I get a chance, I might even post some iPhone code samples for the new 3.0 SDK (which rocks, btw).</p><p>Please bear with me as I go through this transition and I will be back to blogging like my usual (old) self in no time! </p>]]></description><category>personal</category><category>blog</category></item><item><title>Modifying the default unit tests for an ASP.NET MVC project to use Moq</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/aspnet_mvc_moq.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/aspnet_mvc_moq.htm</link><pubDate>Mon, 04 May 2009 22:35:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=aspnet%5Fmvc%5Fmoq</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>When you create a new ASP.NET MVC project, one of the first things that you might notice is that you get an AccountController which takes advantage of the ASP.NET membership provider to allow your site to automatically do forms-based authentication right from the very beginning. This is a very handy feature and definitely helps get you going quickly. </p><p>The issue is that when you look at the unit tests for the AccountController, they are positively littered with manually mocked classes. I realize that this is because you don&#39;t want to make the default project template rely on a third party mocking library so in this blog post, I&#39;m going to show how you can delete all of the manually implemented mocks for the identity, principal, membership service and forms auth service. The secret is using Moq. Moq is a lightweight mocking framework for .NET that was designed specifically for the .NET Framework 3.5 and LINQ. As such, definining mock expectations and mock return values is all done through lambdas in a ridiculously easy to read syntax, as you&#39;ll see below.</p><p>First, you want to add a reference to the Moq library. To get Moq, you can go to <strong><a href="http://code.google.com/p/moq/" target="_blank">Moq&#39;s Google Code home page</a></strong> . Once you&#39;ve got the Moq library on your machine, add a reference to it from your unit test project (you did choose to create a unit test project with your new ASP.NET MVC project, didn&#39;t you?). With that in place, you can replace the contents of the &quot;GetAccountController()&quot; method with the Moq-enabled one below:</p><pre>private static AccountController GetAccountController()<br />{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; var mockFormsAuth = new Mock&lt;IFormsAuthentication&gt;();<br />&nbsp;&nbsp;&nbsp; var mockUser = new Mock&lt;MembershipUser&gt;();<br /><br />&nbsp;&nbsp;&nbsp; mockUser.Setup(u =&gt; u.ChangePassword(It.IsAny&lt;string&gt;(),<br />                   It.Is&lt;string&gt;(s =&gt; s == &quot;newPass&quot;))).Returns(true);<br /><br />    var mockMembership = new Mock&lt;MembershipProvider&gt;();<br />    mockMembership.Setup(m =&gt; m.EnablePasswordReset).Returns(false);<br />    mockMembership.Setup(m =&gt; m.EnablePasswordRetrieval).Returns(false);<br />    mockMembership.Setup(m =&gt; m.MinRequiredNonAlphanumericCharacters).Returns(0);<br />    mockMembership.Setup(m =&gt; m.MinRequiredPasswordLength).Returns(6);<br />&nbsp;&nbsp;&nbsp; mockMembership.Setup(m =&gt; m.ValidateUser(It.IsAny&lt;string&gt;(), <br />       It.Is&lt;string&gt;(s =&gt; s == &quot;goodPass&quot;))).Returns(true);<br />&nbsp;&nbsp;&nbsp; mockMembership.Setup(m =&gt; m.GetUser(It.IsAny&lt;string&gt;(), <br />       It.IsAny&lt;bool&gt;())).Returns(mockUser.Object);<br /><br /> &nbsp;&nbsp; // Registration success mock<br /> &nbsp;&nbsp; MembershipCreateStatus goodStatus = MembershipCreateStatus.Success;<br />&nbsp;&nbsp;&nbsp; mockMembership.Setup(m =&gt; m.CreateUser(It.Is&lt;string&gt;(s =&gt; s == &quot;someUser&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.Is&lt;string&gt;(s =&gt; s == &quot;goodPass&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.Is&lt;String&gt;(s =&gt; s == &quot;email&quot;), It.IsAny&lt;string&gt;(), <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.IsAny&lt;string&gt;(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.IsAny&lt;bool&gt;(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.IsAny&lt;object&gt;(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out goodStatus)).Returns(mockUser.Object);<br /><br />&nbsp;&nbsp;&nbsp; // Registration failed mock (duplicate username)<br />&nbsp;&nbsp;&nbsp; MembershipCreateStatus dupeStatus = MembershipCreateStatus.DuplicateUserName;<br />&nbsp;&nbsp;&nbsp; mockMembership.Setup(m =&gt; m.CreateUser(It.Is&lt;string&gt;(s =&gt; s == &quot;someUser&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.Is&lt;string&gt;(s =&gt; s == &quot;badPass&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.Is&lt;string&gt;(s =&gt; s == &quot;DuplicateUserName&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It.IsAny&lt;string&gt;(), It.IsAny&lt;string&gt;(), It.IsAny&lt;bool&gt;(), It.IsAny&lt;object&gt;(), out dupeStatus));<br /><br />&nbsp;&nbsp;&nbsp; AccountMembershipService mockService = <br />      new AccountMembershipService(mockMembership.Object);<br /><br />&nbsp;&nbsp;&nbsp; AccountController controller = new AccountController(mockFormsAuth.Object, mockService);<br />&nbsp;&nbsp;&nbsp; controller.SetFakeAuthenticatedControllerContext();<br />&nbsp;&nbsp;&nbsp; return controller;<br />}</pre><p>What you can then do is delete all of the manually created Mock classes. Additionally, there&#39;s a unit test that verifies whether or not the constructor has set the appropriate properties. You can remove that if you&#39;re using Unity to construct your objects (which I am, as indicated in the previous blog post). </p><p>The SetFakeAuthenticatedControllerContext() is an adaptation from one of Scott Hanselman&#39;s MvcMockHelpers. </p><p>What I like so much about this is that Moq lets me take the intent of the original code and reduce all that extra plumbing and &quot;ceremony&quot; and just get down to what is really important - what I want the Moq objects to provide to my objects under test. I can&#39;t imagine doing unit testing without a decent mock framework like this and again, what I like about Moq is its simplicity. </p>]]></description><category>moq</category><category>unittesting</category><category>tdd</category><category>mvc</category><category>aspnet</category><category>mocks</category></item><item><title>Upgrading the default ASP.NET MVC project with IoC and the Unity Controller Factory</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/aspnet_mvc_ioc.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/aspnet_mvc_ioc.htm</link><pubDate>Mon, 04 May 2009 15:53:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=aspnet%5Fmvc%5Fioc</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>The ASP.NET MVC framework is one of the coolest things to happen to ASP.NET since its creation. One of the things that I love about the MVC framework more than anything else is its flexibility. This flexibility allows it to be configured anyway the developer likes, including replacing the factory that creates controllers.</p><p>There are two main things that I wanted to accomplish with the Unity integration. The first was that I wanted my controllers to have the objects on which they depend injected into them in standard DI fashion. Secondly, I wanted the controllers themselves to be resolved through the IoC container rather than being tightly coupled by the routing rules. This would allow me to yank in and out different controller implementations if I need to (I figured this would come in quite handy for TDD and unit testing). </p><p>The first part is easy, just grab the Unity DLLs and reference them in your MVC project. At this point, you&#39;re now free to use Unity to inject whatever you feel like. Rigging up the controller factory so that it will use Unity to resolve controllers is equally easy because the <a href="http://mvccontrib.codeplex.com" target="_blank">mvc contrib codeplex site</a>  has already created a class called UnityControllerFactory that does just this. Once you&#39;ve added references to Unity and Mvc.Contrib.Unity from your MVC project, you can change your global.asax.cs file to look something like this:</p><pre>using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Web;<br />using System.Web.Mvc;<br />using System.Web.Routing;<br />using MvcContrib.Unity;<br />using Microsoft.Practices.Unity;<br />using UlyssesAgenda.Controllers;<br />using System.Web.Security;<br /><br />namespace UlyssesAgenda<br />{<br />&nbsp;&nbsp;&nbsp; // Note: For instructions on enabling IIS6 or IIS7 classic mode, <br />&nbsp;&nbsp;&nbsp; // visit http://go.microsoft.com/?LinkId=9394801<br /><br />&nbsp;&nbsp;&nbsp; public class UlyssesApplication : HttpApplication, IUnityContainerAccessor<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void RegisterRoutes(RouteCollection routes)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; routes.IgnoreRoute(&quot;{resource}.axd/{*pathInfo}&quot;);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; routes.IgnoreRoute(&quot;{filename}.ico&quot;); // IE8 requests this and it tries to hit a controller for it.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //routes.IgnoreRoute(&quot;{filename}.png&quot;);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; routes.MapRoute(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Default&quot;,&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Route name<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;{controller}/{action}/{id}&quot;,&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;&nbsp; // URL with parameters<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = &quot;&quot; }&nbsp; // Parameter defaults<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void Application_Start()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitializeContainer();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegisterRoutes(RouteTable.Routes);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected virtual void InitializeContainer()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_container == null)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _container = new UnityContainer();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ControllerBuilder.Current.SetControllerFactory(typeof(UnityControllerFactory));&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _container.RegisterType(typeof(HomeController), typeof(HomeController));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _container.RegisterInstance(typeof(AccountController), new AccountController());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #region IUnityContainerAccessor Members<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private static UnityContainer _container;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static IUnityContainer Container<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get { return _container; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IUnityContainer IUnityContainerAccessor.Container<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get { return Container; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #endregion<br />&nbsp;&nbsp;&nbsp; }<br />}<br /></pre><p>You&#39;ll notice that I mapped the HomeController type and allowed Unity to manage the instantiation of it. However, with AccountController I created my own instance. The main reason for this is that account controller relies directly upon a service which relies upon a SqlMembershipProvider instance. If I attempt to constructor-inject the AccountController, I get stuck in a quagmire where I have to register my own instances of SqlMembershipProvider and SqlProfileProvider and much more - and that removes the flexibility I get from defining that stuff in the Web.config file (and potentially breaks other ASP.NET functionality by not having it in that file).. So (just this once!) I am allowing the AccountController to be a manually created instance that is injected by Unity.</p><p>Next, I&#39;ll be posting about how to convert the default Unit Tests for the AccountController into tests that use <a href="http://code.google.com/p/moq/" target="_blank"><span style="font-weight: bold">Moq</span></a>  rather than hand-mocked POCOs. </p>]]></description><category>unity</category><category>mvc</category><category>aspnet</category><category>ioc</category><category>mvccontrib</category></item><item><title>Fix for Minor Bug in ASP.NET MVC New Project Template</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/aspnet_mvc_bug.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/aspnet_mvc_bug.htm</link><pubDate>Mon, 04 May 2009 02:48:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=aspnet%5Fmvc%5Fbug</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>This evening I was plugging away at ASP.NET MVC 1.0 and I kept having a really weird problem with the default implementation of <strong>AccountController</strong>. Every time I tried to log in, I was getting some kind of annoying error about the &quot;rememberMe&quot; parameter being null.</p><p>I don&#39;t really know how this one slipped through the cracks and its more of a nitpick than a real bug, but it is application-breaking nonetheless. All you have to do in order to see the bug is attempt to log into the default ASP.NET MVC project after creating it and don&#39;t check the &quot;remember me&quot; box. I guess that edge case never got tested ;)</p><p>Anyway, the fix is quite easy. I just modified the signature of the LogOn method in AccountController to look like this:</p><pre>public ActionResult LogOn(string userName, string password, <strong>bool?</strong> <em>rememberMe</em>, string returnUrl)</pre><p>Notice that rememberMe is now a nullable parameter. Now you can&#39;t pass a nullable bool to the actual implementation of the LogOn method in the forms authentication service they provide, so you can just do something like this to pass along the appropriate information:</p><pre>FormsAuth.SignIn(userName, rememberMe == true);</pre><p>This will give you a meaningful default value of false. </p><p>Again, given the ridiculously high quality of ASP.NET MVC 1.0, I&#39;m not really sure how this slipped through other than the idea that maybe most people yank out the default AccountController or all of the testers checked &quot;remember me&quot; :) Either way, it&#39;s a 30 second fix. </p>]]></description><category>aspnet</category><category>mvc</category><category>bug</category></item><item><title>Deploying Azure Hosted Services should be as easy as deploying a Heroku Application</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/azure_deployment_heroku.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/azure_deployment_heroku.htm</link><pubDate>Sun, 03 May 2009 15:04:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=azure%5Fdeployment%5Fheroku</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>Recently a friend of mine showed me <a href="http://www.heroku.com" target="_blank">Heroku</a>, an &quot;instant Ruby platform&quot;. Basically what you can do with Heroku is build your Ruby application and the deployment to the remote Heroku site is not only brainless, painless, and simple, but it can be done entirely from the command line (which means it can be automated even further than it already is). But don&#39;t take my word for it,&nbsp;<strong><a href="http://remi.org/2009/04/23/deploying-rails-and-rack-applications-to-heroku.html" target="_blank">check out this screencast</a></strong>&nbsp;showing exactly how simple it is to build Ruby applications in the cloud using Heroku.</p><p>This got me thinking about Windows Azure, Microsoft&#39;s &quot;cloud operating system&quot;. I&#39;m not really sure I like that particular marketing slant on what Azure is, because at the same time Azure is so much more than an OS and yet doesn&#39;t function like what a lot of people would consider to be an OS. Regardless, the promise of Azure is that you can build your hosted services on your local machine and deploy them &quot;to the cloud&quot; quickly, easily, and simply. What Microsoft says you get in return&nbsp;for hosting your&nbsp;services is scalability, reliabiltiy, and ease of maintenance without having to have all of your own data center infrastructure.</p><p>There are plenty of other resources avaiable on Azure so I won&#39;t go on and on about it here but the main idea is that you can build your data-driven web application to work against a cloud-based data source, communicate with cloud-based services, and deploy to Microsoft&#39;s data center in the cloud (which now has configurable geography-based affinity). The main barrier to entry that I see here is how EASY things are. If an ASP.NET developer attempts to go build a web application that is based entirely on Azure services and they encounter road blocks, headaches, sources of frustration and places where &quot;it&#39;s just broken&quot; instead of &quot;it just works&quot;, they aren&#39;t going to use it. In fact, they will probably start blogging about how bad the experience was.</p><p>What Microsoft needs to do is ensure that going forward, it is as easy to build and deploy Azure hosted services ASP.NET applications as it is to build and deploy Ruby applications with <a href="/console/admin/v5/edit/http;/www.heroku.com" target="_blank">Heroku</a>. I should be able to <strong><em>seamlessly</em></strong> build against a local version of the cloud data store that requires NO CHANGE on my part to work against the remote cloud store. Right now, this is broken and there are subtle incompatibilities between the local fabric simulator and the actual cloud fabric in Microsoft&#39;s cloud. This is annoying and a speed bump. When I&#39;m satisfied that my local application works the way I want it to, I should be able to migrate that application from my machine to the cloud quickly, easily, and in a way that I can automate or control. This includes a way to migrate the data currently stored in my local fabric to the data stored in the cloud fabric. Right now Azure doesn&#39;t do this - your local fabric Azure Storage data has no way of being migrated to the remote storage unless you write code to do it.</p><p>So, to summarize - if Microsoft can make the process of developing Azure-based ASP.NET web applications as simple, easy, reliable, automatable and pleasant as the Heroku deployment process then they will find developers flocking to them in droves, begging to get their apps hosted in the cloud. On the other hand, if they make the process brittle, rigid, slow, painstaking, and what some people consider &quot;Microsofty&quot; then developers will universally cry &quot;Meh&quot; in response to Azure and possibly even pick up Ruby as a new tool just so they can take advantage of services like Heroku.</p>]]></description><category>azure</category><category>heroku</category><category>deployment</category><category>cloud</category></item><item><title>Tour of Oslo: Storing Models in the Repository</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/oslotour_repository.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/oslotour_repository.htm</link><pubDate>Tue, 28 Apr 2009 12:36:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=oslotour%5Frepository</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>In my<a href="/oslotour_model2sql.htm" target="_blank"> last blog post on Oslo</a> , I walked through a simple scenario where we created an &quot;M&quot; file that contained the models for a fictitious science fiction game. We used this file and IntelliPad to see what the T-SQL might look like if we were to create just the tables defined by the model. In this blog post, I&#39;m going to walk through the process of taking an &quot;M&quot; model, compiling it into an MX image, and finally storing that image in the repository.</p><p>If you&#39;re following along, you can grab the &quot;M&quot; file that I created in the previous blog post or you can create your own. The repository is a central storage location for models. Not only does it contain the actual schemas generated by your model image, but it also contains a lot more like security and versioning information. In the interest of keeping this post as small as possible I won&#39;t go into too much detail, but you can find tons of Repository-related videos over on the <a href="http://msdn.microsoft.com/oslo" target="_blank">Oslo Developer Center</a> . </p><p>The first thing we need to do is compile our model. To do that, we&#39;ll use the command-line tool that ships with the CTP called m.exe. This tool can be used to generate regular T-SQL, repository SQL, and of interest to us: a repository image of the model. Sticking with the M file I created last time, I can open up a command prompt, make sure the Oslo SDK &quot;bin&quot; directory is in my path and issue the following command:</p><pre>m UlyssesAgenda.m /p:image<br /></pre><p>The output is a file named UlyssesAgenda.mx. This is a compiled M file. Now we need to get the compiled M image into the repository. Using this CTP we can accomplish that from the command-line as well using the MX utility:</p><pre>mx -i:UlyssesAgenda.mx -d:Repository -s:kev-win7\SQLEXPRESS<br /></pre><p>Depending on your configuraiton, you may not need the &quot;-s&quot; command line switch to indicate the server where the Repository database is stored. In my case, I have a full-blown installation of SQL Server 2008 and SQLEXPRESS is not my default instance so I&#39;ve found that every now and then that means I have to modify connection strings or, in this case, pass the server/instance explicitly. </p><p>And now we can look at SQL Manager and we see that all of the tables that correspond to our high-level model were created:</p><p><img src="http://files.blog-city.com/files/J05/88284/p/f/oslotour_models_repository.png" alt="" width="323" height="458" /></p><p>Using the MX command-line tool we can also directly query the repository. I thought it worth showing the output of this because it illustrates one of the more valuable aspects of Oslo - model versioning:</p><pre>&gt;mx -l -d:Repository -s:kev-win7\SQLEXPRESS<br /><br />Microsoft (R) code name &quot;M&quot; Command-line Utility version 1.0.1308.1<br />Copyright (C) Microsoft Corporation. All rights reserved.<br /><br />Contents of the database<br />============================================================<br /><br />Models.mx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Models.mx;Version=1.0;Locale=neutral<br />UlyssesAgenda&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UlyssesAgenda;Version=1.0;Locale=neutral<br /></pre><p>Models.mx is the compiled list of all of the stock models that Microsoft has provided and put into the database as part of the core Oslo offering. What I think is really important to keep track of is that the models themselves are versioned. There are no table versions - the versioning takes place at the model level which is, IMHO, where it should be. Also keep in mind that because at the lowest level we&#39;ve also created a standard SQL schema, you can use any tool you like against this server, including LINQ to SQL or ADO.NET or the Entity Framework.&nbsp; </p><p>So now we&#39;ve created a model and put it in the repository. In upcoming blog posts, I&#39;m going to cover some of the other interesting things that you can do with models. </p>]]></description><category>oslo</category><category>repository</category><category>tour</category></item><item><title>Tour of Oslo: Using Models to Generate SQL</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/oslotour_model2sql.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/oslotour_model2sql.htm</link><pubDate>Mon, 27 Apr 2009 17:50:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=oslotour%5Fmodel2sql</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>There are many different workflows and use cases that describe how a developer might use Oslo and &quot;M&quot;, maybe one of the most straightforward and easy to explain is the idea of using the &quot;M&quot; modeling language to define models that will eventually represent tables in a database. This is an extremely common task. Today we often do this by starting out&nbsp; on a whiteboard and then when we&#39;re happy with what we see on the whiteboard we might switch to something like Visio or, if we&#39;re really a glutton for punishment we&#39;ll model right on the DB diagram surface in the SQL Server Management Studio.</p><p>What &quot;M&quot; allows us to do is model in text. But this isn&#39;t like typing XML (thank God). Instead, what you&#39;re typing is a clear representation of your intent. The end result is a clear, concise description of your model. More importantly, this textual description of your model can be reasoned on, passed around for comment, versioned, and stored. When you feel like creating SQL tables out of this model, you can do that. If you need to create new versions of the model that are compatible with old versions of the model then you also have that ability (though that topic is beyond the scope of this blog post).</p><p>I&#39;m always a big fan of trying this stuff out myself. The problem with a lot of models is they&#39;re too simplistic. So, rather than enter in a model for a customer than their phone numbers or some other contrivance to suit a &quot;Hello World&quot; sample, I decided to model the data structures for a space-based trading/conquest game that I designed a long time ago and just never got around to implementing for various reasons. This game allows the player to create their own super-massive ship and this ship can carry cargo and it can also have a squadron of fighters associated with it. There are more details to the game but I won&#39;t bore you with those.</p><p>So I started off by creating a type that I called &quot;Ship&quot;:</p><pre>type Ship<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Id : Integer32 = AutoNumber();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sector: Integer32;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X : Integer32;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Y : Integer32;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Z : Integer32;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CurrentFuel : Integer32;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Owner : Avatar where Owner in Avatars;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HullType : HullType where HullType in HullTypes;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DriveType: DriveType where DriveType in DriveTypes;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TacticalSystemType : TacticalSystemType where TacticalSystemType in TacticalSystemTypes;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; } where identity (Id); <br /></pre><p>What I like about this model is it is easy to read. You don&#39;t have to sift through a bunch of T-SQL crap to figure out that my ship objects (whether they be rows in a table or instances of CLR objects or whatever...) will have some kind of location (sector, X, Y, and Z), the ability to consume fuel, a configurable hull and engine type, as well as a configurable tactical system. All very straightforward, easy to read, easy to share, and easy to comment on and maintain. Also remember that this model can be visualized in Quadrant (we don&#39;t yet have a standalone CTP for Quadrant yet) and it can be stored in the repository for querying and safekeeping.</p><p>Take a look at the screenshot below. On the left you can see my &quot;M&quot; modeling code and on the right you can see IntelliPad giving me a preview of what the T-SQL is going to look like that generates this model: </p><p>&nbsp;</p><p><img style="width: 916px; height: 776px" src="http://files.blog-city.com/files/J05/88284/p/f/intellipad_model2sql.png" alt="" /></p><p>When looking at your model, which would you rather see, a statement that indicates that a Fighter has a reference to the Ship entity in the Ships extent (M) or a whole bunch of stuff about foreign key constraints and database columns? When I&#39;m architecting a solution, I want to look at the &quot;M&quot;, especially if I don&#39;t yet know how I&#39;m actually going to physically represent this model in my applicatoin code yet. There are two avenues: I could reprsent them in SQL and use the models to generate T-SQL or I could host the models in my own runtime and CLR instances from Mgraph instances from a DSL (I&#39;ll show that in a subsequent blog post).</p><p>For now, let&#39;s assume we&#39;re modeling for the database. The screenshot only gives you a small glimpse of the benefits you get by using &quot;M&quot;. Anything more complex than my really simple game model would consume hundreds of tables and have thousands and thousands of foreign keys and constraints and other things... Other things that would be much easier to grasp when looking at &quot;M&quot; than looking at T-SQL or even the SQL design surface.</p><p>In the next blog post I will show how to interact with the Oslo repository using this model that I just created. If you want to see the entire model that I created for this fictitious game, <a href="http://files.blog-city.com/files/J05/88284/b/ulyssesagenda.m">click here</a> .To see the SQL behavior, just click the &quot;M Mode&quot; menu in Intellipad and select the Generic SQL preview. </p>]]></description><category>oslo</category><category>modeling</category><category>sql</category><category>schemas</category><category>tour</category></item><item><title>Microsoft Codename "Oslo" Distilled</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/oslo_distilled.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/oslo_distilled.htm</link><pubDate>Mon, 27 Apr 2009 12:46:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=oslo%5Fdistilled</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>One of the things that amazes me most about Oslo isn&#39;t all of the functionality it provides or the productivity it claims to enhance. No, the most amazing thing about Oslo is the fact that nobody I talk to understands what the hell it is or why they should care about it. Worse, it usually takes me nearly an hour to explain to these people enough about Oslo so that they&#39;re convinced one way or the other if Oslo should be on their radar. To me, this is a clear sign that the information available on Oslo right now isn&#39;t cohesive enough. Sure there is a LOT of information, including a ton of videos - but the information is all at the bottom level. If you want details of how the underpinnings work or if you want syntax examples then you&#39;re good to go. But if you want info on what Oslo is and why you should care, it&#39;s harder to find - even if you watch some of the &quot;lap around&quot; videos.</p><p>I don&#39;t claim that my information will be any more cohesive than Microsoft&#39;s, but I&#39;m writing this post as much for my own edification as I am yours. I often gain better insight about things I&#39;m working on by blogging about them or trying to explain them to others. </p><h3>What is Oslo?</h3><p>This is, of course, a loaded question. The fact that Oslo appears to be so many things is one of the big problems. In short, Oslo is all about modeling. Not just data modeling in the traditional sense of sketching out ERDs but in the abstract notion of simply creating models. More specifically, Oslo is what I would call a <span style="font-style: italic">platform for model-driven development</span>. Everything that Oslo has and does is designed to enable developers to do model-driven development.</p><p>Model-driven development is what a lot of us do without knowing it. We start with abstractions of the models on which our application needs to operate (whether these models become C# classes or tables in a database is irrelevant at this point). As work progresses the models become more refined until finally we&#39;re working with code. Some of the classic problems that come with model driven development are:</p><ul><li>Model Complexity - Not every application is a &quot;Hello World&quot; app. Real-world data-heavy applications have hundreds or even thousands of database tables. Now add to the mixture SOA and exchanging a subset of those models with customers or business partners over web services, through Biztalk, etc and simply managing and keeping track of all of your models can become a burden or even a nightmare.</li><li>Model Versioning - Many environments are extremely rigid and brittle and make it very hard for us to version our models. If we&#39;re managing a model domain that is vastly complex (see previous bullet), making small changes to this model often involves weeks of &quot;deployment on our knees&quot; (deployment that involves more praying than deploying). </li><li>Unified Language - Sure, we&#39;ve all probably used UML for modeling but UML is over-hyped (IMHO) and not everybody understands it or worse, people think they understand it and use it incorrectly. Since everyone seems to have their own unique interpretation of how they should be doing UML ... it isn&#39;t very universal is it? Also, 99.9% of all UML tools I&#39;ve used in the past have sucked. </li><li>Model-to-Code Resistance - In most cases right now, model-driven development can seem like an awful lot of work. People usually give up because their abstractions are nice to look at and they give people a nice frame of reference, but there is often a herculean effort that goes into converting that model into executable code or store-able data. Because of this, people think it&#39;s not worth it. <br /></li></ul><p>Wouldn&#39;t it be awesome if we could do model-driven development in a way that allowed our developers, architects, designers, and business stakeholders to all communicate about that model using a unified language? Better still, wouldn&#39;t it be awesome if we could take that same shared model, store it in a repository of models that can be re-used throughout an enterprise, and then actually use that model directly to build data, generate code, or even <span style="font-style: italic">execute the model directly</span>? This is the crux of what Oslo is attempting to do.<br /><br />What you get with Oslo is the following:</p><ul><li>&quot;M&quot; , the Modeling Language. It&#39;s syntax is very simple to read even if you&#39;re not a hardcore developer. This means that reasonably tech-savvy business analysts will be able to understand your model definitions even from the text you&#39;ve written in &quot;M&quot;. &quot;M&quot; allows you to define model schemas (types) as well as instances of models (extents). If you are using &quot;M&quot; to target SQL, this means the same language you use to define your table schemas can be used to define the contents of those tables, and it&#39;s a hell of a lot nicer to look at than SQL, T-SQL, or PL/SQL. </li><li>&quot;Mgrammar&quot; or &quot;Mg&quot;. This is a language that allows you to define your own DSLs (Domain-Specific Languages). A DSL is a language for declaring <span style="font-style: italic">instances</span> of models or model data. Mg takes a little getting used to, but it dramatically simplifies the process of making a DSL, so much so that people who used to think DSLs were too much work should reconsider that evaluation based solely on the existence of Oslo.</li><li>Model Repository - SQL Server database to allow for storing, versioning, and querying models. Multiple blog posts could be written on this so I&#39;ll keep it brief here. </li><li>&quot;Quadrant&quot; - A visual modeling tool written in WPF that allows you to visualize models defined by &quot;M&quot; and stored in the repository. </li><li>IntelliPad - An incredibly extensible editor that you can use to write your models, your Mgrammar languages, and even test your DSL input and output dynamically.</li><li>Visual Studio Integration - quite frankly this sucks (during this CTP) compared to just using IntelliPad and the command-line tools so I don&#39;t really have much to say about this. </li></ul><h3>Why should I Care?</h3><p>The bottom line is if you build data-heavy applications or applications with large models or you are currently doing your development in a model-first fashion, then you should definitely be looking into Oslo and experimenting with it. I will be showing an example of what this looks like in an upcoming blog post, but the simple benefit of being able to define your model in the easy-to-read &quot;M&quot; instead of writing your own T-SQL directly is a beautiful thing.&nbsp;</p><p>There are other things that are all worthy of their own blog posts like integration with Dublin (Microsoft&#39;s new Web Application Server Extensions... think of it as a container for WCF and WF services), using the repository to query and version shared models, and much more.</p><p>I&#39;ve already experienced how different it feels to start with a simple .m text file to define my model. I can see what kind of SQL it would generate on the fly. Once I&#39;m happy with the model, I can put it in the repository. Now if I want to I can create my own Domain-Specific Language (DSL) for defining instances of my models <span style="font-style: italic">in a way that makes sense to the domain experts</span>, not necessarily in a way that requires a programmer. </p><p>Anyway, this is just a quick overview of Oslo... the more lengthy I make this post the more I run the risk of confusing people with too much details too soon. I will be posting subsequent blog posts that go into the details of all the different parts of Oslo that interest me and that will hopefully interest you as well. </p>]]></description><category>oslo</category><category>mgrammar</category><category>mschema</category><category>mgraph</category><category>modeling</category><category>quadrant</category><category>dsl</category></item><item><title>UX (Good or Bad) is Universal</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/gwl_magiquest_ux.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/gwl_magiquest_ux.htm</link><pubDate>Tue, 14 Apr 2009 19:40:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=gwl%5Fmagiquest%5Fux</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>This past weekend my family and I did some vacationing at the Great Wolf Lodge, a massive hotel that also happens to have within it a ridiculously huge water park and many other amenities (most of which cost an arm, a leg, and sometimes an internal organ or two). While I certainly had a lot of fun at the hotel and the water park, one of the things that I spent most of my time thinking about was the overall User Experience of one of the hotel&#39;s attractions: a live interactive role-playing/questing game called <span style="font-weight: bold">MagiQuest</span>.</p><p>The basic idea behind the game, from the <span style="font-style: italic">player</span>&#39;s perspective is this: you get a magic wand (and potentially other stuff like a belt or holster for said wand, plus a &quot;tome of knowledge&quot; to help guide you on your quests). Nearly half of the hallway space in this hotel that would otherwise remain &quot;just a hallway&quot; was repurposed as the setting for this game. The kids (and many grownups) go to a special forest with touch-screen monitors in the trees where they can be given quests. Once they have an active quest, they go around scavenger-hunt style &quot;gathering&quot; ingredients by waving their magic wand at everything from paintings on the wall to stars in the ceiling to animatronic raccoons. The game keeps track of what quests you&#39;ve done, where you&#39;ve been, etc. You can even go around hunting gold by waving your wand at the locks on chests, some of which tell you that you&#39;ve found gold when they open.</p><p>From a <span style="font-style: italic">technology </span>standpoint, what you have is this: The magic wand is an IR transmitter and there are various devices with varying levels of motion/lights/bling that respond to IR transmissions. The wand sends what amounts to a GUID to each device. The device then reads the GUID, checks back with the quest server to see where you are in terms of quests, etc and then responds accordingly. This can be anything from triggering a video playing on a wall-sized screen to opening a chest to making a statue&#39;s eyes glow. </p><p>The game itself has all the hallmarks of being awesome for kids to play: persistent state, measured progress, rewards for completing tasks, unlocking of new tasks when you reach a given level, very creative interface and an extremely high degree of interactivity. What I found fascinating about it was its novel take on user experience, which I review below.</p><p>What developers should pay particular attention to here is how universal some concepts of UX are and how integrated technology AND design are when it comes to producing both good and bad experiences.&nbsp; </p><h2>UX Review - The Good</h2><p>What I found utterly fascinating was the use of what would otherwise be completely dead space in the hotel and turn it into a space that is not only useful, but revenue generating, fun for the kids and a space that creates fond memories that can increase customer loyalty and brand recognition.</p><p>The software that runs the system is somewhat forgettable. It actually is pretty cliche, most of the screens that users interact with look kind of like scrolls or unfurled maps and everything is done in a medieval font. But what I think developers should take note of is that nobody remembered the GUI. <span style="font-style: italic">Everyone remembers the experience</span> they had running around the hotel looking for hidden objects and solving puzzles and getting their parents help to decipher clues. <span style="font-style: italic">It&#39;s all about the experience</span>. </p><h2>UX Review - The Bad</h2><p>While this was a truly awesome User Experience, there were also a lot of pain points, many of which were visibly frustrating the kids and driving the parents insane (myself included).</p><h4>Race Conditions<br /></h4><p>Just about everyone who has written server-side software or even many types of multi-threaded client applications is aware of the problems inherent with performing multiple tasks at the same time. These problems occur in software where two different requests occur at the same time (or nearly the same time). If the application is poorly designed, these types of requests can create inconsistent data at best or at worst cause ugly crashes. The hotel&#39;s game has this problem too : if two kids run up to a quest painting and wave their magic wands at it the painting lights up and gives the &quot;congratulations&quot; speech indicating that the kid got the item. The problems is, how do you know <span style="font-style: italic">which wand</span> triggered the painting? Kids have neither the patience nor the understanding of how crappy software works to be able to guess, &quot;Hey wait. We should both try that again serially to ensure that we both got the quest reward.&quot; ... Hell no, the kids see the painting light up and both assume they got the reward. The kid who lost the race condition doesn&#39;t find out he lost until he goes to slay the dragon and finds out he doesn&#39;t have the Gem of Awesome or whatever.</p><h4>Perceived Performance</h4><p>There are few things you can do to screw up someone&#39;s impression of your application more than making it run slowly. This is especially true for non-technical users. &quot;Regular&quot; people don&#39;t give a crap about latency, network bandwidth, wireless radio interference, or any of the other excuses that us technical people can handle for poor performance. Regular people push a button and they want that button to do something, <em>immediately</em>. Kids are even less tolerant. Right around 9:30pm or so, about a half hour after the pool closes and every kid in the hotel has had a chance to change out of their bathing suits and into regular clothes - a swarming horde of kids descends upon the quest-enabled hallways. I&#39;ve seen this bring the system to its knees. Kids wave their wand at the final encounter with the dragon. They know the dragon video is supposed to come up so they can start the routine to defeat him. But the dragon doesn&#39;t come up... So, the kids wait patiently until the request queue clears enough to allow the video cue request to come up, right? Hell no. The kids just start wanding the activation stone over and over again. Worse, <em>multiple kids do it at the same time</em>. So now when the system finally does unclog and is able to start servicing requests, instead of cutting the queue short, it processes them all, so the dragon spits, spasms, twists, contorts, makes a bunch of funny noises, and then 30 seconds later is congratulating the <em>last kid</em> to wave his wand... and nobody knows who got the reward. </p><h4>The &quot;Devil User&quot;</h4><p>Everybody has a different word or phrase for this user. This is the user that never pushes the right button, never waits for the system to finish doing what it&#39;s doing before pushing more buttons and always manages to find a way to completely screw up a system or put it in a totally confused state. The thing about this application that I can imagine was particularly difficult is that <em>every single user</em> of this application is a devil user. You cannot assume that anyone is going to &quot;play nice&quot; with the game... Especially when the interaction involves physically shaking a wand they&#39;re holding in their hands. </p><h3>Summary</h3><p>I think the single most important thing that stuck with me after this weekend was that the kids weren&#39;t talking about the cool screens in the application. None of them were talking about how awesome the back-end server infrastructure must&#39;ve been. Nobody cared about the use of IR plus an accelerometer to &quot;cast&quot; the wand. Instead everyone remembers <span style="font-style: italic">playing </span>the game. They remember what it felt like to have their imagination stimulated, to solve puzzles, to experience the game. They do not remember interacting with the game <span style="font-style: italic">unless the interaction was frustrating</span>. You can screw up a User Experience very easily whether you are talking about a novelty live-action game at a hotel or whether you&#39;re talking about your company&#39;s corporate website.</p><p>The moral of the story here is that as developers, whether we&#39;re building iPhone apps or live-action interactive RPGs or enterprise websites, we should be thinking about how we can create a <span style="font-weight: bold; font-style: italic">compelling experience</span> and a <span style="font-weight: bold; font-style: italic">truly forgetful user interface</span>. </p>]]></description><category>ux</category><category>uxd</category><category>userexperience</category></item><item><title>Geneva Distilled</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/geneva_distilled.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/geneva_distilled.htm</link><pubDate>Thu, 09 Apr 2009 13:27:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=geneva%5Fdistilled</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>I don&#39;t know about you but I&#39;m not what you would call a &quot;security guy&quot;. Sure, I know how to write secure code and I&#39;ve done my share of encryption programming and SSL and forms authentication and windows authentication in applications, but that doesn&#39;t make me a security guy.&nbsp;</p><p>Think of it this way. I&#39;ve got a toolbox with a bunch of tools in it. I know how to use the screwdriver and I know how to use the hammer. The security guy, however, can look at that toolbox and build a backyard BBQ complete with big-screen TV. I, on the other hand, would probably end up building a shaky birdhouse that makes all the nearby birds go, &quot;WTF?!&quot;.</p><p>The point here is that when I talk to security people about Geneva, they usually only need one or two sentences of overview and they get it. Developers who have been working with applications secured using conventional/traditional means often don&#39;t have enough context to dive right into the Geneva documentation without feeling lost.</p><p>So I&#39;m going to try and explain Geneva in terms that developers who have spent most of their time using various flavors of &quot;credential passing&quot; can easily digest. I think the most important thing to keep in mind while reading this is a conversation I had with a true security guy once. I said, &quot;What&#39;s the safest way to send credentials so they can&#39;t be spoofed, re-directed, or stolen?&quot; He responded with, <span style="font-style: italic; font-weight: bold">&quot;Don&#39;t send &#39;em&quot;</span>. </p><h2>A Brief History of Geneva</h2><p>Disclaimer: This is the history as far as my involvement goes back. There could easily be many more months or years of history that I&#39;m not aware of. I remember back as far as PDC 2003 (seriously, I can actually remember that far...). They handed out these nifty little flashlights that said &quot;WinFX&quot; on them (I still have it!). WinFX was then the codename for what would encompass the codenames for Avalon (WPF), Indigo (WCF), Workflow Foundation, and this other obscure and confusing thing called InfoCard.</p><p>What InfoCard set out to do was to allow the desktop GUI to present the user with a list of &quot;Cards&quot;. These cards could then be sent to a website (that had suitable WCF + InfoCard coding on it) and the website would know who they were. The grand scheme was to eventually see things like your own VISA card in this list, issued to you by your credit card company. Whenever a website asked for a credit card, you could &quot;show&quot; them this card and the site would be able to make your purchase without ever having been given direct access to your credit card number.</p><p>There are a few hundred tangents I could go off onto here but the main thing that I felt was that InfoCard was ahead of its time. There were trust issues, issues with it requiring Longhorn (during the first preview we got to see anyway) and even more of a barrier was that every site would have to do extensive work just to support this thing that currently had 0 adoption rate.</p><p>Over the years InfoCard became CardSpace and it got better at doing what it did, but the adoption rate (at least within my circles) was limited to 0 commercial users and the rest were developers doing samples for blogs and conferences.</p><p>Then came a project called &quot;Zermatt&quot;. Zermatt, in my opinion, was an attempt to decouple all of the various pieces that made up the CardSpace infrastructure and finally make the use of tokens (discussed below) more standardized, more open, and more importantly, easy for developers to adopt. I played with Zermatt, loved it, thought it was a great improvement over previous incarnations of CardSpace... but it still felt lacking. Sure, it was a nicer, friendlier, more accessible CardSpace but it didn&#39;t make the adoption of federated identity and claims-based authorization (again, discussed below) easier in an enterprise.</p><p>This is where Geneva comes in. Geneva is a suite of products consisting of: Geneva Server, Geneva Framework (.NET SDK that does not require a PhD in security to consume), and CardSpace &quot;Geneva&quot;. The Geneva Server looks to be something that you can simply install, configure easily, and fire it up and you now have Geneva support in your enterprise. Let&#39;s hope it continues to aim for that target. Geneva is currently in Beta 1 and you can download it from Microsoft. </p><h2>Claims vs. Credentials</h2><p>If there was one thing that I thought you needed to be able to firmly grasp about Geneva it would be the concept of <span style="font-style: italic; font-weight: bold">claims</span>. Claims are something that may feel very new and very alien to developers used to the traditional model that looks something like this:</p><p>User hits your website (or your desktop app..) and is prompted for a username and password. The user then submits their credentials. Your website grabs those credentials and validates the user. If the user is valid, the website can then go fetch the user&#39;s profile information and other information about the user including the roles to which they belong for security purposes. </p><p>What Geneva (and other industry standard solutions that conform to the same set of protocols and languages that Geneva speaks (more on that later)) operates on are claims. A claim is really just a statement of fact. It could be anything from &quot;my name is Kevin&quot; to &quot;my credit card number is 1111-1111-1111-1111&quot;. Claims are very special statements of fact, however. Every claim comes with a sort of guarantor - some entity that has certified that claim to be true. You, as a developer, also get some information about the entity certifying the claims.</p><p>Here are some more examples of claims (deliberately not showing what a claim looks like in code):</p><ul><li>My name: <span style="font-style: italic">Kevin</span>, Issuer: <span style="font-style: italic">Me</span></li><li>My e-mail address: <span style="font-style: italic">alothien@gmail.com</span>, Issuer: <span style="font-style: italic">Gmail</span></li><li>My security role: <span style="font-style: italic">Administrator,</span> Issuer: <span style="font-style: italic">FantasticSite.com</span></li></ul><p>As the developer of a site that accepts claims I realize that the &quot;name&quot; claim is self-certified which means it&#39;s pretty insecure (the user can pick anything they like). But, in a lot of cases, especially for sites like a message forum, I really don&#39;t care if the user is who they say they are. The e-mail address claim is interesting because (assuming Gmail was involved in this scenario) we can verify with 100% certainty that the e-mail address for that user did actually come from Gmail. Finally, we see that the user is also claiming to have administrative access on the site FantasticSite.com. If we have a trust relationship (federation anyone?) with FantasticSite.com, we can then know without a doubt that the user is actually an administrator.</p><p>Couple of things of note here... First - there are no credentials. There is no username and no password in this set of claims. Now, the user may have had to enter a username and a password in order to be given one of the claims (like the Gmail address), but that username and password was only ever sent to Google, not us. Second - we know who certified the claim and we also know how much we trust claims from that source and we can use that to make an informed decision about whether or not we&#39;re going to accept the claim. [Oversimplification Warning] basically the entity that certifies the claims digitally signs the claim with it&#39;s private key. We then use the public key to verify the signature. In this fashion, we know without a doubt that the claim came from that entity and hasn&#39;t been tampered with or faked. </p><h3>Security Benefits</h3><p>So now we have a basic idea that Geneva works by taking the authentication and authorization bits that are normally hand-rolled by your team and tightly coupled with your solution and abstracting it out to the use of external parties. So what exactly does this buy you from a security standpoint?</p><p>As I mentioned earlier, what this means is that no two relying parties (sites/applications that rely on a Geneva or Geneva-like infrastructure) need to share the same backing store for users. This means that secure user information is never stored outside the single authoritative location for that user information. More importantly, the user (or client application) will never need to submit credentials over the wire to parties who don&#39;t own those credentials. Think about the number of times you&#39;ve seen in the news about hackers cracking into some website and stealing credit card numbers from purchase histories. What if the site never needed to know your credit card number? What if you could still securely and easily use that site, but <em>that site was never given any information that could harm you if stolen</em>.Obviously the site would have to be playing ball with the whole WS-Trust, WS-Policy, and WS-Security stuff but you get the idea.</p><p>To really simplify things down: Using Geneva, you can walk up to any website or web service built by any team or department within your organization and say &quot;hey, I&#39;m Bob and I&#39;m going to be consuming your services tonight.&quot; and then the site/service can <strong><em>reliably, with certainty</em></strong>, be able to say &quot;OK Bob we believe you. Enjoy your stay.&quot; This leads me to the organizational and Single-Sign-On (SSO hereafter) benefits. </p><h3>Organizational &amp; SSO Benefits</h3><p>For me, as an architect and developer, this is where Geneva starts to get really appealing. Picture this scenario: In your organization you&#39;ve got 5 different departments. Between those 5 departments they are creating 7 different applications. All of these applications have strict mid-tier requirements and so all of them have these back-end infrastructure services exposed that all other applications can consume to share data. It&#39;s an awesome architecture that involves cats and dogs living together in total harmony... except for authentication and authorization. This beautiful architecture typically degrades into multiple silos of user authentication. Each department has their own unique customer base. They have different information they need stored about different users. Worse, many of these applications use different types of credentials to log in. </p><p>So now let&#39;s say you&#39;re a developer on Team A and you want to use a service written by Team B that lets a customer of Team A&#39;s application create a new order in Team B&#39;s application. Great! Cross-sell opportunities FTW!!1 Here&#39;s the rub: Team B&#39;s application has no idea who the hell any of Team A&#39;s users are. Now things get really messy and people start creating these &quot;bridge users&quot; in each of their user silos to allow Team A apps to log in to Team B services. So now when Team A wants to create an order in Team B&#39;s app, Team A consumes the Team B services by logging in as &quot;teama&quot; with a password of &quot;teama&quot;. If you&#39;ve never been in this situation before...trust me, it smells bad and it&#39;s a downhill spiral that is really hard to escape.</p><p>This is where Geneva comes in. Let&#39;s refactor the previous scenario using Geneva. First we&#39;ve got a Geneva server in the enterprise. There are trust relationships set up between the different teams and each team has a service that can certify claims made as to the user&#39;s identity and their security privileges.</p><p>Now a user of Team A wants to do something that will create an order in Team B&#39;s application. The Team A application walks up to the Team B service and says, &quot;Hey my name is Bob. you don&#39;t know me, but (TeamA) says my name is Bob and that I&#39;m allowed to use your service.&quot; The TeamB application responds with, &quot;Sweet. Me and TeamA go WAY back. Oh, hey, your claims also have your billing address and other information that I couldn&#39;t possibly have known otherwise. Thanks.&quot;</p><p>So what just happened? Two applications with two completely different architectures that both rely on back-end web services that both have two completely isolated user databases were able to communicate securely. Without either app being aware of the other application&#39;s user information and without creating hacked &quot;bridge users&quot;, one app was able to talk to the other app securely. </p><p>So if you have ever seen the situation where you&#39;ve got multiple web services that need to talk to each other securely (regardless of whether or not there is a shared user base), then Geneva could come in really handy. Now when you add in the ability to federate with other organizations outside your building without needing to maintain remote user information locally... <span style="font-style: italic">now</span> you&#39;re starting to talk about real value-add and real savings in terms of cost, time, effort, and aspirin consumed. </p>I plan on keeping my eye on Geneva as it matures but so far what I&#39;ve seen is pretty impressive. I&#39;m still doubtful about whether users will ever &quot;get&quot; the whole card space stuff but that&#39;s OK since you don&#39;t actually have to use card space for the scenarios I discussed above. From what I&#39;ve seen, if the users know what it actually is, they&#39;re on board. But more often than not, it&#39;s so strange and unfamiliar to them that they&#39;re not sure what&#39;s going on... and if an end user is confused, they will <span style="font-weight: bold; font-style: italic">NOT</span> click the &quot;next&quot; button. They will hit &quot;cancel&quot; and never use your site again.]]></description><category>geneva</category><category>microsoft</category><category>zermatt</category><category>cardspace</category><category>identity</category></item><item><title>T4, Visual Studio 2008's Best Kept Secret</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/t4_intro.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/t4_intro.htm</link><pubDate>Thu, 02 Apr 2009 10:42:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=t4%5Fintro</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>T4 is a Text Template engine that comes with Visual Studio 2008. I&#39;m a little fuzzy on its origins and true purpose, but from the documentation that is available on MSDN, it looks as though T4 was originally conceived as the underlying plumbing that allowed DSLs (Domain-Specific Languages) to programmatically generate compileable classes on the fly.</p><p>The benefit of this engine is that it&#39;s available for code generation even if you&#39;re not working on a DSL. In fact I would go so far as to say that regardless of it&#39;s original intent, T4 probably has wider appeal among developers looking to code generate as a solution to the &quot;boilerplate of spaghetti&quot; problem than it does among the relative minority of people building DSLs. I&#39;m not saying that it&#39;s less meaningful to DSL builders, I&#39;m just saying that there are more devs who need code generation for their day-to-day tasks than there are devs who are building DSLs.</p><p>Before diving into a sample I just want to try and make it clear that T4 is a code eneration utility. It handles those situations where you cannot fix your redundant or tedious code problems with inheritance, DI, or Aspects.</p><p>One of the tasks that I do all of the time when building an application with a desktop (or Silverlight) GUI is build classes that implement INotifyPropertyChanged. This allows me to bind the GUI to those classes and have the GUI react when those properties change. The problem is that for every single property that I want the class to have, I have to manually type in the code that fires the NotifyPropertyChanged event. While I can factor out the 3 lines of code for the event firing into a base class, I&#39;m still left with this huge stream of property definitions. The properties all have the same shape (this should be a good clue that we can use codegen here) and all behave the same way. The getter returns the backing variable and the setter sets the backing variable and invokes a method which fires the property changed notification.</p><p>So in this T4 introduction I&#39;m going to build a T4 template that automatically generates these notifier properties on a ViewModel class for me. It&#39;s going to be a partial class so if I want to add custom methods to the already generated members, I can do that without worry of having the generation process wipe out my code.</p><p>First thing to do is simply create a new file with the &quot;.tt&quot; extension in your project. In my case, I&#39;m going to create a template called StateNotifierClass.tt. Just add a new file to the project with the &quot;.tt&quot; extension. Set the code for this template to the following:</p><pre>&lt;#@ template language=&quot;C#&quot; #&gt;<br />&lt;#@ output extension=&quot;cs&quot; #&gt;<br />&lt;#@ import namespace=&quot;System.Collections&quot; #&gt;<br />&lt;#@ import namespace=&quot;System.Collections.Generic&quot; #&gt;<br /><br />using System;<br />using System.ComponentModel;<br /><br />namespace &lt;#= this.Namespace #&gt;<br />{<br />  public partial class &lt;#= this.ClassName #&gt; : INotifyPropertyChanged<br />  {<br />&lt;# for (int idx = 0; idx &lt; this.properties.GetLength(0); idx++)<br />&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #&gt;<br />&nbsp;&nbsp;&nbsp; private &lt;#= this.properties[idx,0] #&gt; _&lt;#= this.properties[idx,1].ToLower() #&gt;;<br />&lt;# <br />}<br />#&gt;<br /><br />&nbsp;&nbsp; public void DoHello()<br />&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;foo&quot;);<br />&nbsp;&nbsp; }&nbsp;&nbsp; <br /><br />&nbsp;&nbsp; &lt;# for (int idx = 0; idx &lt; this.properties.GetLength(0); idx++)<br />&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #&gt;<br />&nbsp;&nbsp;&nbsp; public &lt;#= this.properties[idx,0] #&gt; &lt;#= this.properties[idx,1] #&gt;<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return _&lt;#= this.properties[idx,1].ToLower() #&gt;;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _&lt;#= this.properties[idx,1].ToLower() #&gt; = value;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NotifyChange(&quot;&lt;#= this.properties[idx,1]#&gt;&quot;);<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }<br /><br />&lt;#<br />&nbsp;&nbsp; }<br />&nbsp;&nbsp; #&gt;&nbsp;&nbsp; <br /><br />&nbsp;&nbsp; protected void NotifyChange(string propertyName)<br />&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (PropertyChanged != null)<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PropertyChanged(this, new PropertyChangedEventArgs(propertyName));<br />&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp; #region INotifyPropertyChanged Members<br /><br />&nbsp;&nbsp; public event PropertyChangedEventHandler PropertyChanged;<br /><br />&nbsp;&nbsp; #endregion<br />}<br />}<br /><br />&lt;#+<br />&nbsp;&nbsp;&nbsp; string Namespace = &quot;Demo&quot;;<br />&nbsp;&nbsp;&nbsp; string ClassName = &quot;DemoClass&quot;;<br /><br />&nbsp;&nbsp;&nbsp; string[,] properties = {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&quot;int&quot;, &quot;Property1&quot;},<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&quot;string&quot;, &quot;Property2&quot;}};&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <br />#&gt;<br /></pre><p>With this template in place, you should see that your solution explorer has a new file beneath your template called StateNotifierClass.cs. Take a look at it, you&#39;ll see that it has a namespace, a classname, private member variables providing a backing store for the properties and public property definitions that are not only strongly typed without having to use generics but they also fire the property changed event notification.</p><p>This is great, but now what does it look like to build a real, live view model class using this template? Here is a view model class template for a stock quote that re-uses the previous template. As you can see, looking at this template is a LOT easier than looking at the huge pile of generated properties and you know immediately what simple, notification-enabled state members are exposed by that class:</p><pre>&lt;#<br />&nbsp;&nbsp;&nbsp; this.Namespace = &quot;DotNetAddict.Samples&quot;;<br />&nbsp;&nbsp;&nbsp; this.ClassName = &quot;StockQuote&quot;;<br />&nbsp;&nbsp;&nbsp; this.properties = new string[,]{<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&quot;string&quot;, &quot;Symbol&quot;},<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&quot;decimal&quot;, &quot;Price&quot;},<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&quot;DateTime&quot;, &quot;TimeStamp&quot;},<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&quot;int&quot;, &quot;Quantity&quot;}};<br /> #&gt;<br />&lt;#@ include file=&quot;StateNotifierClass.tt&quot; #&gt;</pre><p>That&#39;s it! Obviously there is a lot more to T4 than what I&#39;m showing here and if I end up spending more time using it I will do some more blog posts about it. The bottom line here is that for lightweight code generation tasks, you no longer need to look outside Visual Studio for third party codegen products... It&#39;s all right there for you.&nbsp;</p><p>Obviously your mileage may vary, but I know from experience that having this tool available on some of my previous projects would&#39;ve saved me DAYS of work and the end result would&#39;ve been cleaner, more elegant, and a lot easier to change. </p>]]></description><category>t4</category><category>text</category><category>templates</category><category>dsl</category></item><item><title>Microsoft releases new predictive Dependency Injection / Inversion of Control Container</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/microsoft_releases_new_predictive_dependency_injection__inv.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/microsoft_releases_new_predictive_dependency_injection__inv.htm</link><pubDate>Wed, 01 Apr 2009 10:24:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=microsoft%5Freleases%5Fnew%5Fpredictive%5Fdependency%5Finjection%5F%5Finv</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>Just this morning I managed to get my hands on some new bits that I think people might be interested in. If you&#39;re familiar with the concepts behind Inversion of Control and Dependency Injection (just a special type of IoC really) then you might want to keep reading.</p><p>Basically what a DI framework lets you do is decouple the dependencies within your application. Rather than a controller having code in it that is manually new&#39;ing up a reference to the view and the model, a DI framework lets your controller simply state that it needs a view of a certain type and a model of a certain type. The wiring up is then done for you automatically either at compile-time or runtime (or a little of both, depending on what you&#39;re using).</p><p>The problem with this approach is that it requires developers and architects to actually figure out what dependencies each piece of their application needs. Worse, this often requires developers to do some hard thinking about how they want to split their application into components to maximise re-use, increase efficiency, and create a highly resilient application. These are all admirable goals but let&#39;s face it - it sounds an awful lot like <em><strong>work</strong></em>. </p><p>What we really need is the next level of Dependency Injection.... Predictive Dependency Injection. Instead of us having to be explicit about the code on which other code depends, Predictive Dependency Injection (PDI) works by figuring out what you&#39;re going to need and when you&#39;re going to need it, and putting it there.</p><p>Say, for example, you&#39;re building an online banking application that allows customers to look at their transaction history and perform basic transactions like withdrawals, transfers, etc. Rather than having to go through the tradiational (hard work!) process of figuring out what components you&#39;re planning on building and how they all inter-relate with each other, now you can let PDI do the work for you.</p><p>Basically it works like this:</p><pre>var bankingApplication = PredictiveUnity.Resolve&lt;WhatIWant&gt;();<br />bankingApplication.DoWhatIWant();</pre><p>The PDI container will figure out what kind of app you&#39;re building and, using a combination of an advanced code generation tool (acronym: ESP) and other predictive heuristics the PDI container will make available to you an instance of an object that provides the backing functionality for your application. It creates several methods on this generated object that will perform the tasks that you need.</p><p>This doesn&#39;t sound all that interesting, right? But here&#39;s where it becomes a useful tool: you don&#39;t need to figure out what you need at the time you&#39;re coding it. The DoWhatIWant() method will figure out what the app needs to do and do it. The developer no longer has to be burdened with the hard work of design, analysis, or the tedium of manually typing C# code.</p><p>I recommend PDI for every developer who is currently thinking that tasks like design and coding are old-school and there&#39;s something better out there. </p><p>You can download the first CTP of Predictive Dependency Injection <a href="http://www.youtube.com/watch?v=Yu_moia-oVI">here</a> . </p>]]></description><category>di</category><category>ioc</category><category>april1</category><category>microsoft</category><category>unity</category></item><item><title>WPF Control Development Unleashed</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/wpf_control_devunleashed.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/wpf_control_devunleashed.htm</link><pubDate>Wed, 25 Mar 2009 14:26:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=wpf%5Fcontrol%5Fdevunleashed</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p style="margin: 0in 0in 0pt" class="MsoNormal">The proverbial cat has been let out of the bag and Amazon.com and other book store web sites are now showing pre-orders for a new book entitled, &quot;WPF Control Development Unleashed&quot;. Coincidentally enough, I happen to be one of the authors of this book. The real genius behind this project is <a href="http://blog.pixelingene.com/?p=384">Pavan Podila</a>, a Microsoft MVP and WPF veteran. He doesn&#39;t like being called a&nbsp;<em>guru</em> but he has powers that can make WPF submit to his will that I have never seen on any other developer.&nbsp;My role on this project has been something like that of a muse... I try and tap directly into Pavan&#39;s brain and make the information contained therein accessible, easy-to-read, and enjoyable. My goal is to make it so that reading this book from cover to cover will be both pleasant and informative. </p><p style="margin: 0in 0in 0pt" class="MsoNormal">&nbsp;</p><font face="Calibri" size="2">This book isn&#39;t like most reference books that start you at the beginning with a bunch of &quot;Hello World&quot; samples and then when you finally get to the end of the book you&#39;re still doing &quot;Hello World&quot;, you&#39;re just doing it in infinitely more complex ways. Instead, this book aims to teach you how WPF <em>really</em> works and what it looks like under the hood. Without all the lipstick and eyeliner, what really makes WPF tick? Using that knowledge, you can then make absolutely incredible controls that will please your users, shorten your development time, and make your applications more solid, more reliable, and easier to maintain. <p><a href="http://www.amazon.com/WPF-Control-Development-Unleashed-Experiences/dp/0672330334" target="_blank"><img src="http://blog.pixelingene.com/wp-content/uploads/2009/03/image1.png" border="0" alt="" width="240" height="240" /></a></p><p>So what are you waiting for? Go pre-order it already!</p></font>]]></description><category>wpf</category><category>microsoft</category><category>publications</category><category>controls</category></item><item><title>Silverlight 3 Out-of-Browser Apps vs. Live Framework Mesh-Enabled Web Applications</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/sl3oob_mewa.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/sl3oob_mewa.htm</link><pubDate>Tue, 24 Mar 2009 13:24:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=sl3oob%5Fmewa</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>In case you&#39;re not all that familiar with the Live Framework, a <strong><em>MEWA</em></strong> is a <em>Mesh-Enabled Web Application</em>. What that really means is a Silverlight (currently v2.0 only) application that is actually installed in your Mesh. When I say &quot;installed&quot;, what I mean is that the Silverlight application is actually a Mesh Object and the XAP file is actually an attachment to one of the entry items in that mesh object. This is all a bunch of technical hooey that boils down to the idea that a MEWA is a Silverlight application that follows you whereever you go. It will install itself onto the desktop of any machine in your mesh and can be run from the Mesh portal website if you&#39;re on the go or at a coffee shop or library, etc. Support for running these MEWAs from Windows Mobile is also in the works.</p><p>It is important to note that the MEWA stuff was available in CTP form for quite some time before Silverlight 3 was unveiled to the public with it&#39;s support for Out-of-Browser installation. So what are the key differences between a MEWA that was installed on your desktop by the Mesh and a Silverlight 3 application that you took offline by interacting with it?</p><h2>Data</h2><p>The Live Framework is all about data synchronization; making sure that no matter what you&#39;re doing or where you are running an application, your data follows you. Internally this is done by having all of the data in the mesh synchronize bi-directionally using the FeedSync protocol and the Atom Publishing Protocol (APP). The primary means by which a MEWA stores its data is by creating and manipulating entries in the various feeds that belong to its Mesh Object. This allows data changes made on your computer to automatically synchronize throughout your mesh so that the data is available to all other instances of that application (and potentially other applications as well). MEWAs also have access to Isolated Storage and can of course consume Web Services (provided the server has a valid cross-domain policy XML file because MEWAs do not have a site-of-origin domain that you can count on..they come from the Mesh).</p><p>A Silverlight 3 application was, at one point or another, accessed from someone&#39;s Web Site. Whether that site is hosted by Azure or by your corporation or by some third party hosting company is irrelevant. To bring the application offline, the user either right-clicked the SL3 app and chose &quot;Install&quot; or clicked a button in the app to take it offline. Once offline, the SL3 application can access traditional Web Services, can receive &quot;Data Push&quot; messages from it&#39;s site of origin, and can access Isolated Storage. It&#39;s worth keeping in mind that the SL3 application has a 25MB Iso Store quota whereas the MEWA only has 1MB. SL3 also has access to .NET RIA Services, which allow for multi-tier spreading of common models and business logic to abstract on top of Web Service calls.</p><p>In theory, you could have an offline SL3 application use the Local MOE to talk to the Mesh, but I won&#39;t get into that ;)</p><p><strong>Summary:<br /></strong>&nbsp;&nbsp; SL3 - IsoStore, Web Services, .NET RIA Services<br />&nbsp;&nbsp; MEWA - IsoStore, Web Services, Mesh Objects/Feeds</p><h2>Automatic Updates</h2><p>When a new version of a MEWA is published to the Live Mesh by the application author it is then run through an approval pipeline. Once it comes out the other side of this pipeline, it is published on the Live Mesh and optionally made available in the Mesh&#39;s central Application Gallery. As soon as this publication occurs and you connect your computer with a Mesh that has an old version of this application, the new version of the application will be synchronized down to your machine. This happens for all your connected devices and the cloud-based Mesh portal will also get a new version of the MEWA. Upgrades to a MEWA application can often cause problems with existing data already in the Mesh feeds so the developer needs to be constantly aware of accessing &quot;old&quot; mesh data.</p><p>As the application author of an SL3 application, you publish a new version of this application onto your web site. The next time anyone runs their offline browser application, it will asynchronously check for new updates. Once found, the application can respond to this and notify the user that new updates have been downloaded. After a restart, the SL3 application will be updated to the new version.</p><p><strong>Summary:</strong><br />&nbsp;&nbsp;&nbsp; MEWA - Passive feed-based synchronization of new application bundle<br />&nbsp;&nbsp;&nbsp; SL3 - Automated poll of site of origin for new updates, can respond to &quot;updates downloaded&quot; event to notify user.</p><h2>Network Connectivity</h2><p>Mesh-Enabled Web Applications are synchronized to your Live Desktop and to all of your mesh-connected devices automatically by the Live Framework itself. As a result, MEWAs have the ability to access the Mesh URLs because those all have valid cross-domain policy files, but there is no real &quot;site of origin&quot; to speak of since the applications call from from &quot;the mesh&quot;. </p><p>Silverlight 3 Out-of-Browser applications at some point begin their lives as traditional web-hosted Silverlight applications and as such have a known site-of-origin. They can access any network resources on both the origin site and any other site with a valid cross-domain policy XML file.</p><p><strong>Summary:</strong><br />&nbsp;&nbsp;&nbsp; MEWA - Can access any site with a valid cross-domain policy file<br />&nbsp;&nbsp;&nbsp; SL3 OOB - Site of origin automatically, plus any sites with cross-domain policy files.</p><h2>Location on Disk</h2><p>MEWAs are currently stored on your computer in a cryptic, semi-hidden location that involves a lot of directories with names that look like GUIDs. MEWAs are launched by a&nbsp;custom live framework chrome&nbsp;container that hosts the HTML necessary to launch a Silverlight application.</p><p>Silverlight 3 Out-of-Browser applications are launched by invoking the <strong>sllauncher.exe</strong> application with a parameter that usually looks something like <strong>localhost.0</strong> which is a unique ID that is used to look up the downloaded XAP file. Also don&#39;t forget that Silverlight 3 applications have the ability to open files on your hard drive via an &quot;Open File&quot; dialog (returns a Stream for security reasons) as well as save files to disk using the same mechanism. These files <em>are not managed by quotas as they reside wherever the user wants them to be</em>. This is a very powerful new addition and creates some very exciting possibilities for file-based SL3 applications.</p><p><strong>Summary:<br />&nbsp;&nbsp; </strong>MEWA - Custom chrome container that launches the Mesh Object by reading it from the Local MOE<br />&nbsp;&nbsp;&nbsp;SL3 OOB - Custom chrome container that launches the Silverlight 3 application by ID lookup into local cache</p><h2>Should I Be Building a MEWA or an OOB SL3 App?</h2><p>The bottom line really boils down to where the vast majority of your data is and how much infrastructure you plan to have. MEWAs are nice because if you write your application to exclusively use the Live Framework feeds for its data then you don&#39;t ever need to host your own website - everything is stored locally and then synchronized by the Live Framework. The downside is that MEWAs only synchronize within a single mesh, so to expand the reach of your application people need to invite other people to share the application data. This may or may not be exactly what you&#39;re looking for - but you will probably know immediately whether this is a model you want to support or embrace.</p><p>Silverlight 3 Out-of-Browser applications feel more like a Silverlight enhancement to the original concept of ClickOnce. You have a website (could be hosted by Azure, a third party, your own data center, etc) from which people access your Silverlight application. If they want, they can install an out-of-browser version of that application and run it offline. When running OOB, they can access data locally (IsoStore) or remotely (site of origin or other &quot;trusted&quot; (policy XML) sites. </p><p><strong>Summary:</strong><br />&nbsp;&nbsp;&nbsp; MEWA - Isolated smallish groups of app instances sharing data via synchronization<br />&nbsp;&nbsp;&nbsp; Silverlight 3 OOB - Central infrastructure w/ ability to run apps offline and store data locally</p><p>I think&nbsp;the real take-away here should be that MEWAs and Out-of-Browser Silverlight 3 applications are really designed to solve two entirely different problems. Right now there is some overlap in intent and in implementation and I&#39;m hoping that in the near future you&#39;ll be able to build Silverlight 3-based MEWAs. In the end it really boils down to your infrastructure and what your application plans to do with it&#39;s data that will steer you toward MEWAs or toward SL3 OOBs. Now get coding!</p><p>Stay tuned for more posts related to SL3 and all the extremely exciting new stuff that comes along with it.</p>]]></description><category>mesh</category><category>liveframework</category><category>livefx</category><category>mewa</category><category>silverlight</category><category>silverlight3</category></item><item><title>What is .NET RIA Services and why should you care?</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/riaservices_intro.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/riaservices_intro.htm</link><pubDate>Mon, 23 Mar 2009 02:50:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=riaservices%5Fintro</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>At MIX 2009 this year, there were a lot of really good sessions (and a couple of really bad ones, too). Microsoft unveiled a lot of really cool stuff, including Silverlight 3 and new CTPs of various Azure and Mesh products and even a new CTP of the Velocity distributed cache and there was even a preview of ASP.NET 4.0.</p><p>One of the bits of technology that didn&#39;t seem to get near enough attention relative to how valuable it is was .NET RIA Services. .NET RIA Services is a set of tools and libraries that make the life of a RIA (Rich Internet Application) developer much easier. Basically if you are writing a Silverlight application that will ever need to talk to your server, then .NET RIA Services <em>is your new best friend</em>. No, I&#39;m not sugar coating it, it&#39;s<em> that useful</em>. </p><p>This is a huge oversimplification, but basically here&#39;s how it works: You expose some entities on the server using RIA Services. These entities can be LINQ to SQL, LINQ to Entities, or your own custom data (such as data you obtain by talking to another tier or more services). Once these entities are exposed, when you build your solution a client proxy is auto-generated and placed into your Silverlight application project. This allows you to use LINQ queries, maintain local state in Silverlight, manage dirty entities, perform batch updates, perform transactions, and even access authentication, authorization, and profiles all while hiding the underlying HTTP communication. </p><p>If you stop to think about this for a minute, this is bigger than it seems. The main reason is because typically every time you expose data via Web Services to a client, you have a server-side model and a client-side model. Anytime you change the server model it breaks the client model and you end up with this little anti-corruption layer on the client to allow you to communicate cleanly. People often get around this problem by creating a single shared library that contains the model... but this has other problems too, including enforcing too much tight coupling between the client and the server.</p><p>Having the client proxies generated in this manner means that you can have your server-side entity model and you can have a client-side local-state model that is _bindable_ (it publishes change events!) enables all sorts of possibilities. In addition, you can decorate the server model with validation attributes which will also be enforced in the client proxies, giving your GUI the capability of displaying rich validation messages while still maintaining server integrity by preventing &quot;bad&quot; commits. </p><p>Again, I&#39;m horribly oversimplifying things (I will be posting some code walkthroughs later), but having this robust model to synchronize server and client models and share code between tiers saves the developer a flaming truckload of work. And because .NET RIA services embraces LINQ and the concept of entities, you can even supply a full LINQ query on the client side which will be serialized out, converted into URL parameters, and then invoked by the server. Try doing that with your own home-brewed service communication library.</p><p>The bottom line is that if you are writing a Silverlight application that will ever require reading or writing data on your server, then you absolutely need to check out .NET RIA Services. </p>]]></description><category>silverlight</category><category>dotnet</category><category>ria</category><category>riaservices</category></item><item><title>Walkthrough: Creating an Out-of-Browser Application in Silverlight 3</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/sl3_outofbrowser_walkthrough.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/sl3_outofbrowser_walkthrough.htm</link><pubDate>Sat, 21 Mar 2009 21:45:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=sl3%5Foutofbrowser%5Fwalkthrough</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>By now you&#39;ve probably seen the MIX demos of creating out-of-browser Silverlight applications but I wanted to go through the process myself just to make sure that what was being demo&#39;d actually worked. It&#39;s a good practice for many reasons, including finding potential bugs in the new CTPs as well as further cementing what I learned during the sessions.</p><p>An out-of-browser Silverlight 3 application is one that can be installed to the Start Menu and/or Desktop. These Silverlight applications can run with or without a network connection, they can detect changes to their network status, and they have increased storage quotas within Isolated Storage. If you&#39;ve worked with ClickOnce, then the whole OOB experience should be very familiar... the difference is that the SL3 OOB experience is leaner, quicker, and most importantly, <em><strong>can be run by limited/restricted users</strong></em>! </p><p>So the first step in creating an OOB Silverlight application is creating a new SL3 application. The Out-of-Browser stuff is controlled almost entirely through the manifest properties in AppManifest.xml. The Deployment.ApplicationIdentity element is the element that enables &quot;detaching&quot; (separating the XAP from the browser), here&#39;s what my AppManifest.xml looks like:</p><pre>&lt;Deployment xmlns=&quot;http://schemas.microsoft.com/client/2007/deployment&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EntryPointAssembly=&quot;SilverlightOOB1&quot;<br />&nbsp;&nbsp;&nbsp; EntryPointType=&quot;SilverlightOOB1.App&quot;&gt;&nbsp; <br />&nbsp; &lt;Deployment.Parts&gt;<br />&nbsp; &lt;/Deployment.Parts&gt;<br /><br />&nbsp; &lt;Deployment.ApplicationIdentity&gt;<br />&nbsp;&nbsp;&nbsp; &lt;ApplicationIdentity<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ShortName=&quot;App of Awesome&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Title=&quot;Out-of-Browser Awesomeness&quot;&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ApplicationIdentity.Blurb&gt;This is the best application ever built. It will give you an awesome overdose!&lt;/ApplicationIdentity.Blurb&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ApplicationIdentity.Icons&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Icon Size=&quot;128x128&quot;&gt;transformers128.jpg&lt;/Icon&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Icon Size=&quot;64x64&quot;&gt;transformers64.jpg&lt;/Icon&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Icon Size=&quot;32x32&quot;&gt;transformers32.jpg&lt;/Icon&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Icon Size=&quot;16x16&quot;&gt;transformers16.jpg&lt;/Icon&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ApplicationIdentity.Icons&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/ApplicationIdentity&gt;<br />&nbsp; &lt;/Deployment.ApplicationIdentity&gt;<br />&lt;/Deployment&gt;</pre><p>Now when you run the application, you will be able to right-click the Silverlight surface and see the option to install the application on the desktop or the start menu (or both). It will also pick up your 128x128 icon and use that in the installation dialog (the current bits don&#39;t set the desktop/start menu icons though...). This is where it gets good: you can detect whether the application was launched attached (in-browser) or detached (OOB). This allows you to do things like hide a region of the application until the app has been installed. In my case, I will display the &quot;Install Me&quot; button if the app is not yet detached, and I&#39;ll display the &quot;real&quot; application GUI if it is detached. Here is my page startup code in the MainPage.xaml.cs file:</p><pre>namespace SilverlightOOB1<br />{<br />&nbsp;&nbsp;&nbsp; public partial class MainPage : UserControl<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public MainPage()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitializeComponent();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Application.Current.ExecutionState == ExecutionStates.Detached)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LayoutRoot.Visibility = Visibility.Visible;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InstallPanel.Visibility = Visibility.Collapsed;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LayoutRoot.Visibility = Visibility.Collapsed;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InstallPanel.Visibility = Visibility.Visible;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void mainButton_Click(object sender, RoutedEventArgs e)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Application.Current.ExecutionState != ExecutionStates.Detached)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Application.Current.Detach();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }<br /></pre><p>Here&#39;s a screenshot of the application launching before it has been detached: </p><p><img src="http://files.blog-city.com/files/J05/88284/p/f/sloob_preinstall.png" alt="" width="652" height="510" /></p><p>When you click the Install button or when you right-click and choose install, you will be prompted to install the application. Here&#39;s what my install prompt looks like (note the custom logo/image supplied for the install prompt):  </p><p><img src="http://files.blog-city.com/files/J05/88284/p/f/sloob_installprompt.png" alt="" width="456" height="191" /></p><p>After I choose to install the Silverlight application, I get an icon on my desktop and an icon in my start menu. When you click either of these to launch the application (there is currently some weirdness with localhost-based SL3 apps but if you use a full-on website to deploy these it seems to work properly) you will get the application but this time it will detect that it is running in detached mode and display the &quot;real&quot; app GUI and hide the install button: </p><p><img src="http://files.blog-city.com/files/J05/88284/p/f/sloob_postinstall.png" alt="" width="545" height="413" /></p><p>Even cooler is that in order to make it so that applications launch instantly, they check for updates asynchronously _after_ launch. Your application can then respond to the &quot;ExecutionStateChanged&quot; event and check to see if the app is now in the ExecutionStates.DetachedUpdatesAvailable state. This means that a new version of your app has been downloaded and is ready to go. You can use this event to inform your users that the app should be restarted to take advantage of the new goodies.</p><p>This is just the tip of the iceberg for the things that you can do with SL3 and I will be posting tons more walkthroughs and more in-depth coverage of some of the new features, so stay tuned! </p>]]></description><category>silverlight</category><category>silverlight3</category><category>outofbrowser</category><category>clickonce</category><category>dotnet</category></item><item><title>What's New in Silverlight 3</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/new_silverlight3.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/new_silverlight3.htm</link><pubDate>Fri, 20 Mar 2009 14:38:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=new%5Fsilverlight3</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>While I realize that this conference is about the web and about blurring the lines between development and design, what I&#39;ve been really, really inspired about at this conference so far has been Silverlight 3. After hearing about some of the new features in SL3, I completely changed my planned conference schedule so that I could soak up as much SL3 information as humanly possible. </p><p>I will be doing several more detailed posts about various aspects of Silverlight 3 once I get back home and get a decent night&#39;s sleep, but for now, I wanted to touch on a few of the things that I think Silverlight and potential Silverlight developers need to keep an eye on.</p><ul><li>Hardware Acceleration. For things like stretches, transformations, and alpha blending Silverlight 3 will offload that work to the GPU. In some very informative and objective analysis given during a session yesterday, this can show over 50% speed improvement depending on the graphics your application is using.</li><li>Element-to-Element binding. I know this may not seem like much if you&#39;ve never used Silverlight, but to WPF developers this is like pure gold. Using E2E binding you can rig the value of one property to the value of another property on another XAML element... this can create some&nbsp;really great GUI quickly with very little code.</li><li>Perspective 3D. They&#39;ve taken the 80% case for why people need 3D (performing psuedo-3D transformations on 2D elements to create effects like cover flow, etc.</li><li>Animation Easing - multiple built-in types of easing functions to make the animations you do in Silverlight seem more natural and smooth, including things like a standard exponential ease and little &quot;bounces&quot; to make your controls take on a more visceral feel.</li><li>File Saving and Opening !! - Your SL3 application can now read and write to files anywhere on the user&#39;s disk, provided the user tells you where the file is. It&#39;s still secure because all the SL3 app gets is a stream and it can only operate on that stream.</li><li>Pixel Shaders - I could write an entire blog post on this (and most likely I will), but SL3 now has the ability to use Pixel Shaders using the same HLSL 2 language that WPF 3.5 SP1 uses for it&#39;s pixel shaders. These can be used to create transitions, inversions, blends, blurs, and much more. Even cooler is that there are already huge treasure troves of publicly available pixel shaders that you can easily import into your application.</li><li>Read/Write pixels. There is now a WriteableBitmap intermediate surface. It might seem a little unnecessary at first, but if you&#39;ve ever needed to take control of low-level pixel blitting for your SL app, this is good news for you.</li><li>Adaptive Streaming - this was demo&#39;d multiple times and I won&#39;t go into too much detail. Basically it allows you to stream live video content directly to a SL3 application (not just pre-recorded) in VC1 or H.264 and it can dynamically switch up or down bitrates depending on various network factors. Also allows for &quot;instant seek&quot; behavior. </li><li>We finally get a WrapPanel!! :)</li><li>Pixel Shaders can be combined with layering, alpha blending, and media elements to perform live, on-the-fly &quot;green screen&quot; effects. Demo was putting static backgrounds behind a video of John McCain talking. The possibilities here for creating high-end, rich applications are endless.</li><li>Local Messaging - We can now use named-pipe style communication channels to talk to other instances of Silverlight applications running on the same machine, even if they&#39;re not in the same browser.</li><li>Some new controls - DockPanel, WrapPanel, Expander, Label, TreeView, ViewBox, ChildWindow, etc.</li><li><strong><em><u>Silverlight can now run out of the browser</u></em></strong> and install desktop icons similar to ClickOnce. I cannot possibly express how huge this is for Silverlight developers. Basically you can right-click a Silverlight app and choose the &quot;Install&quot; option (or hit a button coded by the app developer). This can put an icon on the desktop and/or in the start menu and will install the app. Installed apps can detect what their own state is (running offline, etc) and receive notifications when the network IP address changes, allowing apps to determine their own connectivity level. Again, this is HUGE.</li></ul><p>As I said, I will be posting more about SL3 once things calm down a little bit (and I get some sleep), but this should whet your appetite. I think the key thing to realize here is that Silverlight 3 is quite possibly the single best zero-install-required cross-platform rich application development environment available given the list of supported features and the ease with which certain tasks are possible.</p><p>Stay tuned!</p>]]></description><category>silverlight</category><category>silverlight3</category><category>ria</category><category>microsoft</category><category>web</category><category>mix09</category></item><item><title>MIX 2009 - Day 1 Recap</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/mix09_day1.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/mix09_day1.htm</link><pubDate>Thu, 19 Mar 2009 14:17:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=mix09%5Fday1</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>The first day of MIX 2009 was an interesting one. I&#39;ve never been to a MIX before - my usual Microsoft conference agenda involves conferences like Tech-Ed and PDC and going to local Microsoft events or the occasional summit up in Redmond, so I wasn&#39;t sure what to expect.</p><p>I realize that it is a designer and developer conference (hence the term &quot;MIX&quot;) but it still feels kind of like Microsoft can&#39;t quite figure out what message they want to deliver. Some of the designer-focused sessions seemed too technical and some of the technical sessions seemed to designer-y, but otherwise I learned a lot and got a lot of really useful information yesterday. </p><p>First and foremost: the SWAG report: A leather-wrapped coffee travel mug, a plastic water bottle, a free copy of Buxton&#39;s book, a free copy of &quot;First Look Silverlight 3&quot;, a DVD of Windows Web Server, a thumb drive, a t-shirt, a pretty flimsy tote (fell apart under the weight of the SWAG), and a really well-bound journal for taking notes.</p><p>OK, with that out of the way we can get to the content. I&#39;m going to run through the major highlights from yesterday in bullet form because I plan on doing individual blog posts on some of the other technology that I saw (such as Silverlight 3).</p><ul><li>Buxton&#39;s keynote was very inspired and he was very excited about industrial design. He lost a few points by bringing up the Zune in the same context as bringing up past successes of industrial design, but otherwise the keynote was very informative and inspiring. The key take away is that you are building and selling an experience, not a product or a thing. <ul><li>noteworthy quote: &quot;If you don&#39;t have as much detail in transitions as in states, you&#39;re going to get it wrong&quot; - said when talking about sketching out application states and flow.</li></ul></li><li>The HP touchsmart demo failed (monitor wouldn&#39;t respond to touches) :)</li><li>Scott Guthrie was given a hero&#39;s welcome. His video about getting ready to present his keynote, including jokes about his red polo and him in full &quot;stayin&#39; alive&quot; disco gear is sure to replace the infamous &quot;Bill Gates retiring&quot; video as an epic cheese-filled achievement.</li><li>SuperPreview - a technology that is part of Expression Web 3 that allows you to view the baseline version of a web page, compare using overlay with other rendering engines, etc.<ul><li>SP can even talk to a cloud service to get a page rendered for a particular target browser/engine even if that engine isn&#39;t on your computer. This means you can now SxS compare Ie6,7,8 as well as Firefox, Safari, and Chrome without having to have them all installed on your machine.</li><li>If you are building HTML and CSS stuff, SuperPreview will absolutely make your life easier.</li></ul></li><li>ASP.NET MVC 1.0 shipped yesterday (congratulations to all involved, this is a fantastic product and a testament to the idea that Microsoft actually can build lean, agile, bloat-free products)</li><li>ASP.NET 4 and VS 2010 - velocity (distributed caching) will be rolled into ASP.NET 4. ASP.NET 4 also gets the dynamic routing engine built originally for MVC.</li><li>Netflix - championed Silverlight and Silverlight 3 because it makes it so that their customers don&#39;t have an install experience (&quot;Installers are Evil!&quot; was his quote) and it runs on Windows and the Mac.</li><li>Silverlight 3 has new codec support - H.264, AAC, MP4. To anybody who has considered using Silverlight for media and decided against it - this is HUGE.</li><li>IIS Media Services - a new back-end for streaming media to Silverlight clients.</li><li>2010 Olympics is going to be in full 720p HD online using Silverlight 3, complete with DVR controls like pause, rewind, etc.</li><li>Silverlight 3 and Blend 3 can now import assets directly from Photoshop and Illustrator. I cannot possibly make it clear enough how incredibly useful this is.</li><li>Blend 3 is getting SketchFlow, a way to quickly go from idea to prototype. </li><li>SL3 has client/server proxies and new libraries to make multi-tier apps using SL3 easier to build</li><li>SL3 now has the ability to install offline and become aware of network changes (think of this as ClickOnce, next generation, for Silverlight). I will be posting more about this in my upcoming SL3 post. Again, this is HUGE HUGE HUGE.</li></ul><p>I really dislike using the bullet form to do blog posts, but there was so much information crammed into the keynote that I just wouldn&#39;t be able to create some readable narration of it without making it so long that your eyes glazed over and you fell asleep before finishing reading the article.</p><p>The main takeaways for me from the keynote are that Microsoft is investing a LOT of time, effort, and marketing around Silverlight 3 and with good reason. Years and years ago, when IE4 came out, I remember saying how the line between the browser and the desktop was going to become irrelevant to the end user - their data comes from the Internet and people won&#39;t care if they are using a downloaded semi-offline RIA or a desktop app. That future is coming and SL3 is going to be right there at the forefront. </p><p>Noticeably (for me at least) absent from the keynote was a good overview of Windows Azure. Azure is huge and I was hoping it would get more &quot;air time&quot; as it were, but I can see how at a half-designer conference, ultra-geeky stuff like cloud storage, the ServiceBus, and SQL Data Services would bog down an otherwise glitzy and shiny bouncing keynote.</p><p>Again, stay tuned because I&#39;ll be posting more detailed blog posts related to the technology that I&#39;ve been seeing.</p>]]></description><category>mix09</category><category>mix2009</category><category>mix</category><category>microsoft</category><category>conference</category></item><item><title>At MIX 2009, pre-keynote</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/mix09_prekeynote.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/mix09_prekeynote.htm</link><pubDate>Wed, 18 Mar 2009 14:50:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=mix09%5Fprekeynote</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>So I&#39;m sitting here in the colossal meal hall in the conference area of the Venetian, trying to soak everything in. So far I&#39;ve been completely overwhelmed by the sheer scale of this place and the other casinos on the strip... These structures make most of the buildings I walk by in Manhattan every day look like little kid&#39;s block buildings.</p><p>As you may know, I&#39;m somewhat of a people-watcher more by accient of my own particular symptoms of being unable to tune out white noise than anything else. I find it interesting what topics are being discussed near me as people eat breakfast and wait for the chance to go get seats for the keynote. A lot of people are talking about Silverlight... though those conversations actually sound like bragging matches to see which person at the table has used more Silverlight than the others.</p><p>Definitely a lot of excitement around here, though I am kind of dissappointed that there aren&#39;t as many people talking about Azure and Live Framework. Those things are completely underrated and, if you looked at my schedule, you&#39;d see that it&#39;s almost entirely Azure-related with a little bit of Silverlight peppered in for good measure.</p><p>Anyway, I will be posting my thoughts on the conference and the different sessions I attend, so stay tuned. For now, I&#39;m just going to try and find a small drab corner in which to hide from all the shiny, extremely over-the-top opulence here.</p>]]></description><category>keynote</category><category>mix09</category><category>mix</category><category>microsoft</category><category>conference</category></item><item><title>Live Framework April 2009 CTP is out!</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/liveframework_april2009.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/liveframework_april2009.htm</link><pubDate>Fri, 13 Mar 2009 12:11:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=liveframework%5Fapril2009</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>Yesterday the Live Framework folks published <a href="http://blogs.msdn.com/liveframework/archive/2009/03/11/live-framework-updated.aspx"><strong>this blog post</strong></a>. Quite possibly the single most important update in this release is that you can now use both the beta Live Mesh client and the CTP Live Framework client side-by-side. This means that you can continue to share your files using Live Mesh on the same machine that you&#39;re using to develop Live Framework applications. This is huge because up until now, you had to devote two different machines (physical or virtual) to this. I&#39;m very pleased to say that I&#39;m now running both clients and it&#39;s a huge relief to not have to use one machine for my file sharing and another machine for my development.</p><p>Support for Win7 is also included in these bits, which is timely, considering I <a href="/win7_firstday.htm">just recently installed Win7</a> on my laptop. If you want all the gory details, you can find the complete <a href="http://dev.live.com/liveframework/aprilctpchangelist.aspx">API change list here</a>. One of the things that was interesting while looking through the change list was the addition of the <strong>LiveQuery</strong> class. I&#39;m going to have to experiment with that one as it could make app dev on the Mesh much easier/smoother.</p><p><strong>LoopStatement</strong> is a new class that looks like it will ease the pain for people who were extensively using resource scripts, but as the bits were released yesterday I haven&#39;t had time to play with this class yet either.</p><p>And finally, quite possibly my favorite feature, is that the bug fix from the Jan CTP where they fixed the icon changing problem is well, still fixed. :) The only reason I mention it is because the bug fix came from one of my threads on the Live Framework forum.</p><p>Once I&#39;ve had time (because I have oh so much spare time...) I will do some more playing with these new bits and post some code samples and my thoughts on the subject.</p>]]></description><category>liveframework</category><category>live</category><category>microsoft</category><category>mesh</category><category>livefx</category><category>livemesh</category></item><item><title>Velocity CTP3 coming up next week</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/velocityctp3.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/velocityctp3.htm</link><pubDate>Thu, 12 Mar 2009 16:44:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=velocityctp3</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>In the past I&#39;ve <a href="/velocity_introduction.htm">posted a brief discussion</a> about Velocity that was based on my experience with it during CTP1/CTP2, which was a pretty raw and unpolished CTP. CTP2 was an improvement over the original CTP and CTP3 has even more improvements planned.</p><p>To recap, Velocity is Microsoft&#39;s distributed cache system. What sets it apart from other caches like memcached is that it has some pretty advanced features. Memcached has always struck me as a very useful distributed cache, if all you want is simple keyed put/get/delete. Velocity actually gives us a bit more than that.</p><p><strong>Regions</strong> allow you to logically group keyed values next to each other. So if you have cached data items that you know are going to be stored and/or retrieved within a short time period of each other you can put them all in the same region. Those keys can have the same back-up policy and can be backed up together. This kind of thing can be used for application partitioning or even finer grained control within an individual application. Let&#39;s say you&#39;ve got a shopping site you might create a region for all of your DVD cache data because if a user is flipping through DVD data on your site, optimizing the cache to feed those requests is a good thing.</p><p><strong>Tags</strong>. I mentioned this before, and I&#39;ll mention it again. You folks all know what a freak I am about tags (even wrote a whitepaper about building tag clouds...) and the fact that not only can I create flat segmentation within my cache via tag, but that I can actually search and retrieve all cache items with a particular tag is awesome.</p><p>There are a whole bunch of other features that I am really excited about like auto-failover, backups, HA, load <em>balancing that is not based on a fixed hash</em> (take that memcached!), and much more.</p><p>Some of the stuff coming in CTP3 that I can&#39;t wait to find out about next week at MIX includes:</p><ul><li>Bulk operation APIs</li><li>Security (including WCF channel security, simple token security, and domain credentials)</li><li>Event Notifications - this is one that I begged for during CTP1. I want the ability for my app to be notified when the cache changes. Keeping in mind that Velocity can be used for more than just ASP.NET, this is a fantastically useful feature, especially if you&#39;ve got a bunch of back-end stuff running on .NET that is supporting your ASP.NET tier.</li><li>Read-Through/Write-Behind. Mmmmmmm...Performance...</li></ul><p>I will post again about Velocity after I get my tech-obssessed hands on CTP3 so stay tuned :)</p>]]></description><category>mix09</category><category>mix</category><category>velocity</category><category>cache</category><category>microsoft</category><category>ctp</category></item><item><title>SSDS loses an "S" and gains some awesome</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/ssds_now_sds.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/ssds_now_sds.htm</link><pubDate>Wed, 11 Mar 2009 11:42:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=ssds%5Fnow%5Fsds</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>This morning I was reading <a href="http://blogs.msdn.com/ssds/archive/2009/03/10/9469228.aspx">this blog entry</a> and got pretty excited. My biggest problem with SSDS vs. Azure Storage was that the line was too blurry. Expecting people to be able to rationally make a decision between the ACE (Authority, Container, Entity) model of SSDS and the keyed-entity storage model of Azure Storage was putting the burden in the wrong place. Worse, in every discussion I had with people about it, including Microsofties, very few could actually come up with compelling arguments as to why to use one over the other.</p><p>Now that confusion is gone. In an effort to drop the confusion levels, they are going to stop supporting the ACE model and will instead be exposing SQL Server (or something that looks, acts, and talks like it) in the cloud using TDS (Tabular Data Stream). So why is this a good thing? Well, with the &quot;old&quot; (funny how we say old for things that never made it out of beta...) ACE method the access method for your SQL data was proprietary (XML , sure, but still proprietary in the sense that it didn&#39;t work out of the box with anything else). By exposing SDS via TDS in the cloud, we automatically gain compatibility with:</p><ul><li>Visual Studio</li><li>ADO.NET</li><li>ODBC (though you shouldn&#39;t be using this if you are writing .NET client code)</li><li>Tables, Triggers, Stored Procedures, Views, Indexes</li></ul><p>What this really boils down to is that when you are building your cloud application, you should be able to flip a switch and go from on-premise SQL databases to off-premise SQL databases. Anybody who has tried to make a decent prototype using the ACE bits of SDS knows how much of a pain in the ass the whole dev-&gt;build-&gt;test-&gt;stage-&gt;prod life cycle was going to be. Now it should fit in nicely with your current tools and process.</p><p>An added bonus is that they are going to be using Astoria to expose REST endpoints on this. This is a good thing because in classic Microsoft form they had two teams working on essentially the same thing (SSDS was building their own REST endpoint system...even though Astoria has been around longer and works with the Entity Framework).</p><p>This leads to my final conclusion - If you can build locally against a local SQL server and then push your code to the cloud with Azure SDKs and flip a switch and point to your cloud-based SQL server, then you can also use Entity Framework code in your client for both on-premise and off-premise databases. Sweet.</p>]]></description><category>ssds</category><category>sds</category><category>sql</category><category>sqlserver</category><category>azure</category><category>cloud</category><category>data</category></item><item><title>My first day using Windows 7 Beta 1</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/win7_firstday.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/win7_firstday.htm</link><pubDate>Wed, 25 Feb 2009 13:58:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=win7%5Ffirstday</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>A couple of days ago I sacrificed a laptop to the deities of experimentation and beta by putting Windows 7 on it. Turns out that the upgrade process from Vista to Windows 7 completely blew away my boot record and the system actually lost track of my NTFS so the bootable recovery disks (yes people, I actually had a reco disk!!) saw my original drive partition as free space.</p><p>So I figured, &quot;What the hell..the drive&#39;s already empty anyway... might as well put Win7 on a fresh drive!&quot;</p><p>So that&#39;s what I did. That process, in stark contrast to the Vista-&gt;Win7 upgrade, was ridiculously smooth. It&#39;s a fairly high-end laptop which typically means a crapload of OEM drivers that confuse Vista and prevent things like sound cards from working. Win7 recognized the 512MB laptop video card and it recognized the audio driver and the keyboard and trackpad worked...as did the WiFi and bluetooth and built-in camera. The only thing it didn&#39;t recognize out of the box was the custom keyboard functionality like the volume controls that trigger various HUD displays... 10 minutes after hitting the manufacturer website for the Vista drivers, that too was working.</p><p>My first impression was mixed. By default, Win7 gave me the crappy theme with no transparency. After changing to the good theme, things started looking up. The most completely surprising thing that happened to me is that after using Win7 for a couple of hours, <em>I am absolutely addicted to the new taskbar. I absolutely hate all taskbars in comparison, including my beloved OS X dock</em>.</p><p>The quick preview you get when you hover over an item in the task bar is really useful. But what makes it MORE useful is that if you hover over the preview, all windows on the desktop become transparent borders, allowing you to see the full contents of that window. If you then click the preview, that window becomes the foreground window. This is HUGE for me. I typically have 10+ windows open and can&#39;t find <em>squat</em> when I&#39;m knee deep in some programming task with an IDE open, a couple command lines, two browser windows, an SDK manual, and various and sundry other gadgetry. IE8 even goes so far as to give me a preview of every single TAB in every single IE8 window in a nice grid format. I don&#39;t know about you, but seeing a quick preview of a browser window does me no good if I can&#39;t see all 15 tabs. Win7&#39;s taskbar + IE8 makes that possible...I only hope Firefox will eventually work the same way.</p><p>Couple other observations that people might find interesting:</p><ul><li>UAC prompts seem to be a little less frequent (though this could be entirely wrong... that&#39;s just how it <em>felt</em>)</li><li>Win7 Beta 1 is <em>noticeably</em> and <em>quantifiably</em>&nbsp;faster and responsive than Vista SP1. Try copying a file from a network share to your local disk on Vista. Time it. Do the same on Win7. Rejoice.</li><li>The &quot;libraries&quot; thing seems like a good feature. I know my wife would get a lot of use out of it because she has literally thousands of documents on her computer. Me, not so much but I&#39;ll have to see how it works when I start tagging code directories and the like.</li><li>WiFi configuration seems to have <em>MORE</em> clicks required than Vista and somehow bends the laws of user experience physics to be <em>MORE</em> confusing than Vista&#39;s configuration. That said, once WiFi is configured, it doesn&#39;t seem to fail nearly as often as my Vista one. Also, I no longer have to reboot when the wireless router obtains a new IP... that one &quot;feature&quot; of Vista is enough to make me want to stab my eyes with rusty forks and I&#39;ve already decided I shall never use Vista on my home router again...not when I&#39;ve got Win7 available.</li><li>Downloadable content. Even in Beta 1, there are like 10 additional desktop themes that you can download from the gallery website and they auto-install when you click on them. This is often underrated but dammit I love my extras and the fact that Vista&#39;s &quot;ultimate extras&quot; <em>never added a single damn extra throughout the entire lifetime of the product</em> was vastly dissappointing. The fact that Win7 already has downloadable extra goodies is a promising sign. Let&#39;s hope MS keeps it up and makes it so there&#39;s like 30 pages of&nbsp;fun crap people can download when they get Win7 on day 1.</li></ul><p>Bottom line is that I&#39;ve already removed Vista from the machines that I have that are not mission critical. I didn&#39;t do that to XP even after Vista SP1. Win7 (beta 1!)&nbsp;seems to be faster, smoother, more sturdy, and even looks a little better than Vista. All MS has to do is deliver what&#39;s in this beta and I&#39;m sold.</p><p>Of course...I was sold when I used Longhorn and then they trashed Longhorn and turned it into Vista and it had none of the stuff I really wanted anymore, so I&#39;m still a little leery. As I use Win7 beta 1 more I will post more blog entries if I find things that are really cool or really crappy :)</p>]]></description><category>win7</category><category>windows7</category><category>vista</category><category>windows</category><category>microsoft</category><category>beta</category><category>review</category></item><item><title>Building RESTful Java Web Services with JAX-RS</title><guid isPermaLink="true">http://dotnetaddict.dotnetdevelopersjournal.com/restful_jaxrs_webservices.htm</guid><link>http://dotnetaddict.dotnetdevelopersjournal.com/restful_jaxrs_webservices.htm</link><pubDate>Mon, 23 Feb 2009 20:42:00 GMT</pubDate><comments>http://dotnetaddict.dotnetdevelopersjournal.com/console/comments/popup/?f=restful%5Fjaxrs%5Fwebservices</comments><dc:creator>Kevin Hoffman</dc:creator><description><![CDATA[<p>In a <a href="/know_thine_enemy_restful_web_services_in__java.htm" target="_blank">previous blog entry</a> I wrote about building RESTful Web Services using Java and the JAX-WS library. As a result of JAX-WS being designed specifically as a generic, all-purpose Web Service tool that can do both WSDL and RESTful type web services, I think the syntax lacks a little bit of that simplicity that I&#39;m striving for. That kind of simplicity I&#39;ve already seen is possible using WCF&#39;s RESTful attributes and I&#39;m constantly on the lookout for cooler, simpler, better RESTful stacks. I can&#39;t help it, I&#39;m completely obsessed.</p><p>So this is when I found JAX-RS. You can find implementations of this in Metro, hosted by Java&#39;s GlassFish container...but you can also find a really good implementation of it in the latest snapshot of the CXF framework.</p><p>To create a RESTful Web Service using JAX-RS, all you really need to do is create a class that will be your service and then your container (in my case Tomcat) and CXF do the rest. Here&#39;s a snippet of a sample class from a CRM service that has been decorated with JAX-RS/RESTful attributes:</p><pre>// misc imports<br />@Path(&quot;/&quot;)<br />@Produces(&quot;application/xml&quot;)<br />public class CustomerService implements ApplicationContextAware {<br /><br />&nbsp;&nbsp;&nbsp; // private member variables go here.<br /><br />&nbsp;&nbsp;&nbsp; @GET<br />&nbsp;&nbsp;&nbsp; @Path(&quot;/customers&quot;)<br />&nbsp;&nbsp;&nbsp; public CustomerList getCustomers() {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // code to build customer list goes here<br />&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp; @GET<br />&nbsp;&nbsp;&nbsp; @Path(&quot;/customers/{customerId}&quot;)<br />&nbsp;&nbsp;&nbsp; public Customer getCustomer(@PathParam(&quot;customerId&quot;) String customerId) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // code to fetch individual customer goes here<br />&nbsp;&nbsp;&nbsp; }<br />}</pre><p>As you can see, there&#39;s a /customers URL and a /customers/### URL that allow you to retrieve either a full list of customers or a payload for a single customer. It&#39;s pretty self-explanatory from just looking at the code (which I like). One thing you&#39;ll notice is that the service class is application context aware, which means I&#39;m going to be creating an instance of my JAX-RS server using spring. Below is a little snippet of the spring.xml file that instantiates (or injects, depending on who you ask) the JAX-RS server:</p><pre>&lt;bean id=&quot;crmService&quot; class=&quot;com.dotnetaddict.samples.CustomerService&quot;<br />    init-method=&quot;init&quot;/&gt;<br /><br />&lt;jaxrs:server id=&quot;customerServerJaxRs&quot; address=&quot;/crm&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &lt;jaxrs:serviceBeans&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ref bean=&quot;crmService&quot;/&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/jaxrs:serviceBeans&gt;<br />&lt;/jaxrs:server&gt;</pre><p>In short, this is yet another way that you can build RESTful Web Services using Java. I prefer the JAX-RS way of doing things over the JAX-WS way of doing things mostly because the syntax is specifically designed to be RESTful and RESTful isn&#39;t just some kind of add-on that you can tack on to an otherwise WSDL-type Web Service.</p><p>However, my quest for the simplest and easiest RESTful syntax <strong><em>that is also applicable in the enterprise</em></strong> isn&#39;t over yet :)</p>]]></description><category>wcf</category><category>jaxrs</category><category>jaxws</category><category>java</category><category>cxf</category><category>apache</category><category>tomcat</category><category>rest</category><category>restful</category><category>webservices</category></item></channel></rss>
