CodeClimberhttp://codeclimber.net.nz/Default.aspx
Climbing the Cliffs of C#en-NZSimone ChiarettaSubtext Version 2.5.1.0http://www.codeclimber.net.nz/http://www.codeclimber.net.nz/Skins/CodeClimber/Images/codeclimber_50.gifCodeClimber45.494811430938789.219868183135986http://creativecommons.org/licenses/by/3.0/Web European Conference Registrations opens 1st July 12:00CETCommunity Lifehttp://feedproxy.google.com/~r/Codeclimber/~3/NUcmCY40ALI/Web-European-Conference-Registrations-opens-1st-July-1200CET.aspx
<p align="center"><a href="https://webnextconf.eventbrite.com"><img title="title" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="title" src="http://codeclimber.net.nz/images/codeclimber_net_nz/Windows-Live-Writer/283a95d8721a_9AB5/title_3.png" width="640" height="240" /></a></p> <p>The moment has finally come: <a href="http://www.timeanddate.com/worldclock/fixedtime.html?msg=Opening+Registration+Web+European+Conference&amp;iso=20150701T12&amp;p1=157">tomorrow at midday</a>, Central European Time, it will be possible to start registering for the <a href="http://webnextconf.eu/">2nd Web European Conference</a>.</p> <p>In the previous edition of the conference we sold out all the tickets available at the time (170) in the first few hours after opening: this year we’ll have 400 seats, but just to be sure, remember to set an alarm and get to the <a href="https://webnextconf.eventbrite.com">registration page</a> on time not too loose the option to take part in the conference.</p> <p align="center"><a title="https://webnextconf.eventbrite.com" href="https://webnextconf.eventbrite.com"><strong><font size="5">Register for the Web European Conference</font></strong></a></p> <h3>Speakers and session</h3> <p>Tomorrow we’ll also close the Call for Presenters, and we’ll also ask for your opinion on which sessions to include in the conference: you can already see <a href="https://github.com/Web-European-Conference/c4p">all the proposals on out github repository</a> and from tomorrow you’ll be able to vote for your favorite sessions.</p> <p>But we have already our two <strong>TOP</strong> speakers: <a href="http://www.twitter.com/shanselman">Scott Hanselman</a> and <a href="https://twitter.com/despos">Dino Esposito</a>. </p> <p align="center"><img title="speakers" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="speakers" src="http://codeclimber.net.nz/images/codeclimber_net_nz/Windows-Live-Writer/283a95d8721a_9AB5/speakers_3.png" width="640" height="177" /></p> <p> </p> <h3>Sponsors</h3> <p>A final word on our sponsors and partners, without whom this conference will not be possible.</p> <p align="center"><img title="sponsors" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="sponsors" src="http://codeclimber.net.nz/images/codeclimber_net_nz/Windows-Live-Writer/283a95d8721a_9AB5/sponsors_3.png" width="640" height="396" /></p> <p align="left"> </p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f52b48d7-8fb7-41d6-bb15-4aa377fcaecd" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/webnextconf/default.aspx" rel="tag">webnextconf</a>, <a href="http://codeclimber.net.nz/tags/conference/default.aspx" rel="tag">conference</a></div><img src="http://codeclimber.net.nz/aggbug/1025.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=NUcmCY40ALI:fI4jug7GktQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=NUcmCY40ALI:fI4jug7GktQ:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=NUcmCY40ALI:fI4jug7GktQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=NUcmCY40ALI:fI4jug7GktQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=NUcmCY40ALI:fI4jug7GktQ:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=NUcmCY40ALI:fI4jug7GktQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=NUcmCY40ALI:fI4jug7GktQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=NUcmCY40ALI:fI4jug7GktQ:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/NUcmCY40ALI" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2015/06/30/Web-European-Conference-Registrations-opens-1st-July-1200CET.aspxTue, 30 Jun 2015 09:36:48 GMThttp://codeclimber.net.nz/archive/2015/06/30/Web-European-Conference-Registrations-opens-1st-July-1200CET.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1025.aspxhttp://codeclimber.net.nz/archive/2015/06/30/Web-European-Conference-Registrations-opens-1st-July-1200CET.aspxCodeGarden 2015: recap of day 1Community Lifehttp://feedproxy.google.com/~r/Codeclimber/~3/tYik76Q73uI/CodeGarden-2015-recap-of-day-1.aspx
<p>Here I am again, for the third time at <a href="http://codegarden15.com/">Umbraco CodeGarden</a>. For those who do not know what it is, it's the yearly <a href="http://umbraco.com/">Umbraco</a> developer conference, this year celebrating its 10th anniversary.</p>
<p>Before going to sleep after a long day I just wanted to post my recap of the day.</p>
<h3 id="the-keynote">The Keynote</h3>
<p><img src="http://codeclimber.net.nz/images/codeclimber_net_nz/14/r_codegarden15.jpg" alt="CodeGarden Keynote" /></p>
<p>Some numbers on the "size" of the community:</p>
<ul>
<li>almost 200k active developers on the community site</li>
<li>almost 300k active public installation of Umbraco </li>
<li>over 200k installation of Umbraco v7 in the last year</li>
</ul>
<p>In addition to giving all these figures, Niels also highlighted some popular packages contributed by the community (<a href="https://our.umbraco.org/projects/backoffice-extensions/vorto">Vorto</a> for 1 to 1 translations, <a href="https://our.umbraco.org/projects/backoffice-extensions/nupickers">NuPicker</a> and <a href="https://our.umbraco.org/projects/backoffice-extensions/nested-content">Nested Contents</a> for enhanced editors experience, <a href="https://our.umbraco.org/projects/backoffice-extensions/lepainter">LePainter</a> a visual grid editor and <a href="https://our.umbraco.org/projects/backoffice-extensions/bookshelf/">BookShelf</a> to provide inline contextual help to the backoffice).</p>
<p>Other announcements included the features that are coming with v7.3 (automatic load balancing, a new API library as first path to get rid of legacy API, authentication based on ASP.NET Identity, which enables twitter, Google, Active Directory and 2 factor authentication via Google) and future features that are currently being experimented like the new cache layer, a new content type editor and a full-fledged REST API based on the HAL standard.</p>
<h3 id="roadmap-panel">Roadmap panel</h3>
<p>Immediately after the keynote, 5 members of the core dev team answered questions on specific pain-points that users would like addressed in future (v8) releases, and also unveiled HQ's priorities:</p>
<ul>
<li>Improving the UX</li>
<li>Fresh start on the code (getting rid of the decennial original legacy API)</li>
<li>Bringing many features of Umbraco.com (the SaaS platoform) to on-premises installations (like migrations from environments, syncronization of content and so on)</li>
<li>Segmentation, segments-based content variations and personalization</li>
</ul>
<h3 id="contributing-to-the-core">Contributing to the core</h3>
<p>After the usual organic lunch, the afternoon started with some Git tips to better contribute to the core of Umbraco and make maintainers' life easier:</p>
<ul>
<li>First <em>squash</em> all commits into one, making sure no typos or "missed file" kind of commits are sent in the pull request. The suggestion was to use the <code>git rebase --interactive</code> command.</li>
<li>Then making sure our pull request is based on a pretty recent version of the repository, using the following process:<ul>
<li>Track upstream <code>git remote add upstream ...</code></li>
<li>Fetch upstream <code>git fetch upstream</code></li>
<li>Rebase your commit on top of the latest version of the repo <code>git rebase upstream/dev-7</code></li>
</ul>
</li>
<li>And finally, merge all the conflicts that might arise before doing the pull request</li>
</ul>
<h3 id="make-editors-happy">Make Editors Happy</h3>
<p>As last year, one of the main tenet of the conference is reminding us developers that also content editors deserve love, and with Umbraco 7 it's very easy to craft data editors tailored to custom editing expectations and flows. But even without going down the path of customization with AngularJS, many things can be done also with the core editors and a few selected packages: group properties in tabs, remove from the RTE everthing tha editors do not need, provide contextual help (maybe consider the <a href="https://our.umbraco.org/projects/backoffice-extensions/ueditornotes">uEditorNotes</a> package) and finally use NuPicker and Nested Content to provide a better experience when choosing node from the tree and when creating list of items.</p>
<h3 id="how-to-sell-umbraco">How to sell Umbraco</h3>
<p>The day ended with an amazing talk by <a href="https://twitter.com/theotron">Theo Paraskevopoulos</a> with tips on how to sell Umbraco as platform when doing projects. Unfortunately the slides are not published yet, but will update the post as soon as they are.</p>
<p>Some impressive facts I didn't know about: NFL uses Umbraco for one of they sub-sites (<a href="http://operations.NFL.com">http://operations.NFL.com</a>) and Umbraco, with 0,7%, is the 5th platform in term of marketshare in the industry of CMS, after WordPress, Drupal, Joomla and DotNetNuke (1%); all the rest of the CMS account for 1.4%.</p>
<h3 id="conclusion">Conclusion</h3>
<p>The evening ended with a protest march through the streets of Copenhagen, which unfortunately I had to miss due to a broken toe, caused by an injury in a recent triathlon race.</p>
<p>The first day was not super-tech, but more soft-skill and UX oriented, but very useful anyway, especially for me since my reason to be here is to get a feeling of where Umbraco is going in the future to see if it can be used as CMS platform at my workplace.</p>
<p>Tomorrow it looks like a more tech-focused agenda.</p>
<p><b>NB</b>As soon as slides and video are published, I'll update the post.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9ad34dfa-2f2d-46e1-b06c-519198becf96" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/umbraco/default.aspx" rel="tag">umbraco</a>, <a href="http://codeclimber.net.nz/tags/codegarden/default.aspx" rel="tag">codegarden</a></div><img src="http://codeclimber.net.nz/aggbug/1024.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=tYik76Q73uI:Sgt5ug9Yq0Q:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=tYik76Q73uI:Sgt5ug9Yq0Q:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=tYik76Q73uI:Sgt5ug9Yq0Q:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=tYik76Q73uI:Sgt5ug9Yq0Q:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=tYik76Q73uI:Sgt5ug9Yq0Q:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=tYik76Q73uI:Sgt5ug9Yq0Q:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=tYik76Q73uI:Sgt5ug9Yq0Q:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=tYik76Q73uI:Sgt5ug9Yq0Q:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/tYik76Q73uI" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2015/06/10/CodeGarden-2015-recap-of-day-1.aspxWed, 10 Jun 2015 19:51:04 GMThttp://codeclimber.net.nz/archive/2015/06/10/CodeGarden-2015-recap-of-day-1.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1024.aspxhttp://codeclimber.net.nz/archive/2015/06/10/CodeGarden-2015-recap-of-day-1.aspxMy new free eBook is out: OWIN Succinctly by SyncfusionASP.NET MVCASP.NETWeb 2.0http://feedproxy.google.com/~r/Codeclimber/~3/d5X49a05YPs/My-new-free-eBook-is-out-OWIN-Succinctly-by-Syncfusion.aspx
<p><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://codeclimber.net.nz/images/codeclimber_net_nz/Windows-Live-Writer/c53fb003cdd9_A695/image_thumb.png" width="185" align="left" height="244" /> I’m happy to announce that my latest book, <a href="http://www.syncfusion.com/resources/techportal/ebooks/owin">OWIN Succinctly</a>, has just been released by <a href="http://www.syncfusion.com/">Syncfusion</a>, within their <a href="http://www.syncfusion.com/resources/techportal/ebooks">“succinctly” series of eBooks</a>.</p> <p>I’ve written this book together with my friend and co-organizer of the <a href="http://webnextconf.eu/">2nd Web European Conference</a>, <a href="http://tostring.it/">Ugo Lattanzi</a>, with whom I’ve also give a <a href="http://codeclimber.net.nz/archive/2014/05/19/Slides-and-demos-for-the-Owin-and-Katana-talk-from.aspx">speech in Paris last May, still about Owin</a>.</p> <p>Owin is a big inspiration for the new ASP.NET 5 stack, so we decided to write this book both to show how you can use this “philosophy” with current version of the ASP.NET, and to let you know how it could be in the future with ASP.NET 5.</p> <p>The book covers all aspects of OWIN, starting with a description of the OWIN specification, moving on to how <a href="http://katanaproject.codeplex.com/">Katana</a>, Microsoft’s implementation of the specs, works. Later we also show how to use Katana with various web frameworks, how to use authentication and finally how to write custom middleware.</p> <p>The table of contents is:</p> <ul> <li>OWIN </li> <li>Katana </li> <li>Using Katana with Other Web Frameworks </li> <li>Building Custom Middleware </li> <li>Authentication with Katana </li> <li>Appendix </li> </ul> <p>OWIN, and the new ASP.NET will be big actors in the <a href="http://webnextconf.eu/">2nd Web European Conference</a> in Milano next 26th of September, so, if you want to know more about those technologies, consider participating to the conference.</p> <p>A big “thank you” goes to Syncfusion, for giving us the possibility to reach their audience, and to our technical reviewer <a href="https://twitter.com/robert0muehsig">Robert Muehsig</a>, whose comments helped making the book even better.</p> <p>If you have comments or feedback on the book, do not hesitate to write a comment on this post, or contacting me on twitter <a href="https://twitter.com/simonech">@simonech</a>.</p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9ad34dfa-2f2d-46e1-b06c-519198becf96" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/owin/default.aspx" rel="tag">owin</a>, <a href="http://codeclimber.net.nz/tags/book/default.aspx" rel="tag">book</a>, <a href="http://codeclimber.net.nz/tags/aspnet+vNext/default.aspx" rel="tag">aspnet vNext</a></div><img src="http://codeclimber.net.nz/aggbug/1023.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=d5X49a05YPs:Xa1bA5avMlY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=d5X49a05YPs:Xa1bA5avMlY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=d5X49a05YPs:Xa1bA5avMlY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=d5X49a05YPs:Xa1bA5avMlY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=d5X49a05YPs:Xa1bA5avMlY:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=d5X49a05YPs:Xa1bA5avMlY:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=d5X49a05YPs:Xa1bA5avMlY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=d5X49a05YPs:Xa1bA5avMlY:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/d5X49a05YPs" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2015/03/16/My-new-free-eBook-is-out-OWIN-Succinctly-by-Syncfusion.aspxMon, 16 Mar 2015 11:13:33 GMThttp://codeclimber.net.nz/archive/2015/03/16/My-new-free-eBook-is-out-OWIN-Succinctly-by-Syncfusion.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1023.aspxhttp://codeclimber.net.nz/archive/2015/03/16/My-new-free-eBook-is-out-OWIN-Succinctly-by-Syncfusion.aspxUsing Entity Framework within an Owin-hosted Web API with UnityASP.NET MVCASP.NETWeb Serviceshttp://feedproxy.google.com/~r/Codeclimber/~3/v_R2_UWvcfM/Using-Entity-Framework-within-an-Owin-hosted-Web-API-with.aspx
<p>After quite a lot of time of writing applications without direct interaction with Databases, lately I’ve been working on a pretty simple ASP.NET Web API project that needs to save data on a database. Despite the simplicity of the application, I faced some interesting problems, which I’m going to write about in a few blog posts over the next weeks.</p> <p>The first of the problems, which I’m going to write about in this post, is how to configure an ASP.NET Web API application to run within Owin, have its dependencies resolved with Unity, and have Entity Framework DbContext injected via IoC/DI.</p> <h3>Setting up ASP.NET Web API with Owin</h3> <p>The first thing to do is getting the right packages:</p> <ul> <li>first create a new <strong>ASP.NET Web Application</strong>, choose the <strong>Empty</strong> template, and tick the <strong>Web API</strong> option under “Add folders and core references for”: this will install all the Nuget packages needed for a Web API project, and will setup the folder structure; </li> <li>then you need to install the Owin packages and the Owin-Web API “bridge”: by installing the <strong>Microsoft.AspNet.WebApi.Owin</strong> you’ll get everything you need; </li> <li>finally, depending on where/how you want to run the Web API project, you also need the Nuget package for the Owin server you need: download <strong>Microsoft.Owin.Host.SystemWeb</strong> for starter if you want your app to run within IIS. </li> </ul> <p>Once all the core dependencies are ready, you have to configure the Owin Startup class to fire up Web API: just add a <strong>OWIN Startup class</strong> from Visual Studio contextual menu and add to the <font face="Courier New">Configuration</font> method the right configuration for Web API.</p> <div class="dropshadow code"> <div class="innerbox"> <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Startup
{
<span class="kwrd">public</span> <span class="kwrd">void</span> Configuration(IAppBuilder app)
{
HttpConfiguration config = <span class="kwrd">new</span> HttpConfiguration();
<span class="rem">// ... Configure you web api routes</span>
app.UseWebApi(config);
}
}</pre>
</div>
</div>
<p>And Voilá! You have a Web API running with an Owin host.</p>
<h3>Adding Unity to Web API within Owin</h3>
<p>Next step is adding Unity and configuring it to correctly resolve dependencies in a Web API application. Just add the <strong>Unity.AspNet.WebApi</strong> Nuget package and all the needed packages and bootstrapping code will be added to the project: in particular it will add two important files:</p>
<ul>
<li><font face="Courier New">UnityConfig</font> class, where the configuration of the Unity container should go </li>
<li><font face="Courier New">UnityWebApiActivator</font> class, which is fired up using <strong>WebActivator</strong>, that registers the unity dependency resolver for Web API (by saving into the <font face="Courier New">GlobalConfiguration.Configuration</font> object) </li>
</ul>
<p>Unfortunately, if you run you application now (and you have already some dependencies injected into your controllers via IoC/DI) nothing will be injected, simple because the <font face="Courier New">DependencyResolver</font> is still empty, despite being set by the <font face="Courier New">Start</font> method of the <font face="Courier New">UnityWebApiActivator</font>: this works fine in a normal Web API application, but not with Owin, because of the sequence in which the various services are instantiated. </p>
<p>The solution to the problem is pretty easy : just delete the <font face="Courier New">UnityWebApiActivator</font> class and put the same code into the Owin configuration method:</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Startup
{
<span class="kwrd">public</span> <span class="kwrd">void</span> Configuration(IAppBuilder app)
{
HttpConfiguration config = <span class="kwrd">new</span> HttpConfiguration();
<span class="rem">// ... Configure you web api routes</span>
config.DependencyResolver = <span class="kwrd">new</span> UnityDependencyResolver(UnityConfig.GetConfiguredContainer());
app.UseWebApi(config);
}
}</pre>
</div>
</div>
<p>For reference, the <font face="Courier New">UnityConfig.GetConfiguredContainer</font> is a static method exposed by the <font face="Courier New">UnityConfig</font> class that has been added with the Unity bootstrapper for ASP.NET Web API nuget package, and looks like the following snippet (the part within region is added by the package, the method <font face="Courier New">RegisterTypes</font> is the one we need to configure our Unity container):</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode"><span class="rem">/// &lt;summary&gt;</span>
<span class="rem">/// Specifies the Unity configuration for the main container.</span>
<span class="rem">/// &lt;/summary&gt;</span>
<span class="kwrd">public</span> <span class="kwrd">class</span> UnityConfig
{
<span class="preproc">#region</span> Unity Container
<span class="kwrd">private</span> <span class="kwrd">static</span> Lazy&lt;IUnityContainer&gt; container = <span class="kwrd">new</span> Lazy&lt;IUnityContainer&gt;(() =&gt;
{
<span class="kwrd">var</span> container = <span class="kwrd">new</span> UnityContainer();
RegisterTypes(container);
<span class="kwrd">return</span> container;
});
<span class="rem">/// &lt;summary&gt;</span>
<span class="rem">/// Gets the configured Unity container.</span>
<span class="rem">/// &lt;/summary&gt;</span>
<span class="kwrd">public</span> <span class="kwrd">static</span> IUnityContainer GetConfiguredContainer()
{
<span class="kwrd">return</span> container.Value;
}
<span class="preproc">#endregion</span>
<span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RegisterTypes(IUnityContainer container)
{
container.RegisterType&lt;IUserRepository, MyUserRepository&gt;();
}
}</pre>
</div>
</div>
<p>And now also Unity is wired up correctly and dependencies resolved.</p>
<h3>Having Entity Framework DbContext injected via Unity</h3>
<p>Let’s get now to the juicy bits: how do we configure Unity to inject EF6 DbContext so that a new context is created with each request? On the internet there are a lot of samples of how to do it, as this is a <a title="Proper Session/DbContext lifecycle management" href="http://lostechies.com/jimmybogard/2013/12/20/proper-sessiondbcontext-lifecycle-management/">very common pattern used with all “heavy” ORMs</a>, but all of them use other IoC/DI frameworks, like <a title="Managing Entity Framework DbContext Lifetime in ASP.NET MVC" href="http://www.davepaquette.com/archive/2013/03/27/managing-entity-framework-dbcontext-lifetime-in-asp-net-mvc.aspx">Ninject</a>, StructureMap and so on, but none with Unity.</p>
<p>Unity doesn’t have a InRequestScope/PerRequest object-scope as most other IoC/DI, but is has something slightly different, called <strong>HierarchicalLifetimeManager</strong>: it basically creates a “singleton” for each child Unity container created. While being kind of strange, in reality it gives a bit more of flexibility as someone could create child containers for different occasions: which exactly what the Unity bootstrapper for ASP.NET Web API does: it introduces a new kind of <font face="Courier New">DependencyResolver</font> called <font face="Courier New">UnityHierarchicalDependencyResolver</font> that creates a new child container with every begin request.</p>
<p>Taking into consideration all the steps considered so far, here is the final Owin configuration method:</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Startup
{
<span class="kwrd">public</span> <span class="kwrd">void</span> Configuration(IAppBuilder app)
{
HttpConfiguration config = <span class="kwrd">new</span> HttpConfiguration();
<span class="rem">// ... Configure you web api routes</span>
config.DependencyResolver = <span class="kwrd">new</span> UnityHierarchicalDependencyResolver(UnityConfig.GetConfiguredContainer());
app.UseWebApi(config);
}
}</pre>
</div>
</div>
<p>and the Unity registration:</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RegisterTypes(IUnityContainer container)
{
container.RegisterType&lt;IUserRepository, MyUserRepository&gt;();
container.RegisterType&lt;MyDBContext&gt;(<span class="kwrd">new</span> HierarchicalLifetimeManager());
}</pre>
</div>
</div>
<p>The last line is important, because if you forget to specify it, a new DbContext will be injected in each of your repositories/command/query objects, you'll not be able to share the context and everything will fall apart.</p>
<h3>Wrapping up</h3>
<p>Once you solve a few pitfalls (the GlobalConfiguration not being “seen” by the Owin-hosted Web API and the configuration of the “Per Request” scope with Unity), the setup of the infrastructure is pretty easy and is implemented in just 2 lines of code.</p>
<p>Hope this helps, and please let me know if you solved the problem with a different approach or if my solution misses something. And I’ll write a few more posts with my findings in the next weeks.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9cb3807f-e479-478d-91c0-61bd0a0f6a0b" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/EntityFramework/default.aspx" rel="tag">EntityFramework</a>, <a href="http://codeclimber.net.nz/tags/Owin/default.aspx" rel="tag">Owin</a>, <a href="http://codeclimber.net.nz/tags/WebAPI/default.aspx" rel="tag">WebAPI</a>, <a href="http://codeclimber.net.nz/tags/Unity/default.aspx" rel="tag">Unity</a>, <a href="http://codeclimber.net.nz/tags/DbContext/default.aspx" rel="tag">DbContext</a></div><img src="http://codeclimber.net.nz/aggbug/1022.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=v_R2_UWvcfM:vkBC4hcmhZ0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=v_R2_UWvcfM:vkBC4hcmhZ0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=v_R2_UWvcfM:vkBC4hcmhZ0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=v_R2_UWvcfM:vkBC4hcmhZ0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=v_R2_UWvcfM:vkBC4hcmhZ0:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=v_R2_UWvcfM:vkBC4hcmhZ0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=v_R2_UWvcfM:vkBC4hcmhZ0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=v_R2_UWvcfM:vkBC4hcmhZ0:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/v_R2_UWvcfM" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2015/02/20/Using-Entity-Framework-within-an-Owin-hosted-Web-API-with.aspxFri, 20 Feb 2015 14:05:56 GMThttp://codeclimber.net.nz/archive/2015/02/20/Using-Entity-Framework-within-an-Owin-hosted-Web-API-with.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1022.aspxhttp://codeclimber.net.nz/archive/2015/02/20/Using-Entity-Framework-within-an-Owin-hosted-Web-API-with.aspxHow to unset a proxy for a specific git repository or remoteSource Control, CIhttp://feedproxy.google.com/~r/Codeclimber/~3/pe2-DO88mV0/How-to-unset-a-proxy-for-a-specific-git-repository.aspx
<p>In this post I’ll show something that I just discovered and solved a problem I had once we introduced a in-house git repository: how to have many git repositories using proxies but have one that connects directly without proxy.</p> <p>Lately we moved our source code repository, from a “standard” TFS repo to the <a href="http://blogs.msdn.com/b/visualstudioalm/archive/2013/01/30/getting-started-with-git-in-visual-studio-and-team-foundation-service.aspx">git-based TFS repository that has been introduced with TFS 2013</a>. Besides working with github repositories, now I had to connect also to some a repository hosted inside the local network and authenticate using the local domain credentials.</p> <p>All went well from within Visual Studio, but since you cannot do everything from VS, I also needed to connect to the internal repository via the <a href="http://msdn.microsoft.com/en-us/library/dd286572.aspx">git command line tools</a>. The problem is that it didn’t connect.</p> <p>After a bit of troubleshooting I realized that the problem was the proxy: I’m behind a corporate firewall, so I had to configure a proxy to connect to github. Unfortunately the proxy was not recognizing my connection as local, so was trying to resolve it on the internet, and of course it failed.</p> <p>I had to remove the proxy configuration, and I could connect to my local git-based TFS repository, but I couldn’t connect to the other repositories unless I specified the proxy on each of the repositories that needed it, which was kind of tedious since I need proxy for all repos except one.</p> <p>Looking through the <a href="http://git-scm.com/docs/git-config">git-config</a> documentation I found the solution:</p> <blockquote> <p>Set to the empty string to disable proxying for that remote.</p> </blockquote> <p>This not only work when specifying a proxy for a specific remote, but also for the whole repository.</p> <p>Without further ado, here are the command for this configuration.</p> <p>First you specify your global proxy configuration</p> <div class="dropshadow code"> <div class="innerbox"> <pre class="csharpcode">$ git config --global --add http.proxy "http://proxy.example.com"</pre>
</div>
</div>
<p>Then you move to the repository for which you want to unset the proxy and add an "empty" proxy.</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode">$ git config --local --add http.proxy ""</pre>
</div>
</div>
<p>And in case you need to specify an empty proxy only for a specific remote</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode">$ git config --local --add remote.&lt;name&gt;.proxy ""</pre>
</div>
</div>
<p>It took me a day to understand the cause of the problem, hope this post will help other people in a similar situation.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f4722006-e0d5-4df4-82a5-248836d5583e" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/git/default.aspx" rel="tag">git</a>, <a href="http://codeclimber.net.nz/tags/proxy/default.aspx" rel="tag">proxy</a>, <a href="http://codeclimber.net.nz/tags/TFS/default.aspx" rel="tag">TFS</a></div><img src="http://codeclimber.net.nz/aggbug/1021.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=pe2-DO88mV0:-r05fYEmwu4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=pe2-DO88mV0:-r05fYEmwu4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=pe2-DO88mV0:-r05fYEmwu4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=pe2-DO88mV0:-r05fYEmwu4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=pe2-DO88mV0:-r05fYEmwu4:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=pe2-DO88mV0:-r05fYEmwu4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=pe2-DO88mV0:-r05fYEmwu4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=pe2-DO88mV0:-r05fYEmwu4:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/pe2-DO88mV0" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2015/01/20/How-to-unset-a-proxy-for-a-specific-git-repository.aspxTue, 20 Jan 2015 10:16:17 GMThttp://codeclimber.net.nz/archive/2015/01/20/How-to-unset-a-proxy-for-a-specific-git-repository.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1021.aspxhttp://codeclimber.net.nz/archive/2015/01/20/How-to-unset-a-proxy-for-a-specific-git-repository.aspxUsing web api client in synchronous methods and some good async/await resources.NETC#http://feedproxy.google.com/~r/Codeclimber/~3/p5DNLMXziGs/Using-web-api-client-in-synchronous-methods-and-some-good.aspx
<p>Lately I’ve been trying to include a call to a REST service using the WebAPI client to a library already used from inside both an ASP.NET page and a WCF service.</p> <h3>The problem with mixing sync and async</h3> <p>Of course I started with an async/await code:</p> <div class="dropshadow code"> <div class="innerbox"> <pre class="csharpcode">HttpResponseMessage response = await client.PostAsJsonAsync(GetUpdateUri(), payload);</pre>
</div>
</div>
<p>Unfortunately both consumers were synchronous, so I had to wait for the async to complete before going on with the execution: so I did something that proved to be wrong (the following methods calls the line above):</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode">SendPayloadAsync(payload).Wait();</pre>
</div>
</div>
<p>Deadlock: this never completes as ASP.NET is blocking the context thread waiting for the webapi call to complete, which waits for the thread to be free so it can complete.</p>
<h3>How to make a synchronous web api call</h3>
<p>What I should have done, instead, would have been to change the <a href="http://www.hanselman.com/blog/TheMagicOfUsingAsynchronousMethodsInASPNET45PlusAnImportantGotcha.aspx">ASP.NET page to be an async page</a> (using the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.registerasynctask.aspx">Page.RegisterAyncTask</a>) and also change the <a href="http://msdn.microsoft.com/en-us/library/ms731177%28v=vs.110%29.aspx">WCF service to be async</a>, and use the <a href="http://msdn.microsoft.com/en-us/magazine/jj991977.aspx">async/await from top to bottom as is best practice</a>. In my case it was too complex and would have required touching code developer by others and already working, so I simply avoided starting the “async chain”:</p>
<div class="dropshadow code">
<div class="innerbox">
<pre class="csharpcode">HttpResponseMessage response = client.PostAsJsonAsync(GetUpdateUri(), payload).Result;</pre>
</div>
</div>
<h3>Async/Await resources</h3>
<p>On the other end I realized I don’t know enough about the async way of coding, and I spent some time reading some good references, mostly by “async-guru” <a href="http://stephencleary.com/">Stephen Cleary</a>.</p>
<ul>
<li><a href="http://blog.stephencleary.com/2012/02/async-and-await.html">Async and Await</a>: introductory and basic article</li>
<li><a href="http://stackoverflow.com/questions/10343632/httpclient-getasync-never-returns-when-using-await-async">HttpClient.GetAsync(…) never returns when using await/async</a>: question on StackOverflow and good answer that explains the problem I experienced above</li>
<li><a href="http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html">Don't Block on Async Code</a>: a better explanation of the same concept answered in the question above</li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/jj991977.aspx">Best Practices in Asynchronous Programming</a>: a list of best practices in async programming (Avoid Async void, Async all the way, Configure Context)</li>
<li><a href="http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx">Await, and UI, and deadlocks! Oh my!</a>: more about locking and deadlocks</li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/gg598924.aspx">It's All About the SynchronizationContext</a>: longer and more theoretical article on context and synchronization of threads</li>
</ul>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e224a919-f1c2-4c23-9bfd-09573cd5a0b3" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/async/default.aspx" rel="tag">async</a>, <a href="http://codeclimber.net.nz/tags/webapi/default.aspx" rel="tag">webapi</a>, <a href="http://codeclimber.net.nz/tags/deadlock/default.aspx" rel="tag">deadlock</a>, <a href="http://codeclimber.net.nz/tags/parallel+programming/default.aspx" rel="tag">parallel programming</a></div><img src="http://codeclimber.net.nz/aggbug/1020.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=p5DNLMXziGs:QRk2LeUhUYo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=p5DNLMXziGs:QRk2LeUhUYo:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=p5DNLMXziGs:QRk2LeUhUYo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=p5DNLMXziGs:QRk2LeUhUYo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=p5DNLMXziGs:QRk2LeUhUYo:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=p5DNLMXziGs:QRk2LeUhUYo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=p5DNLMXziGs:QRk2LeUhUYo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=p5DNLMXziGs:QRk2LeUhUYo:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/p5DNLMXziGs" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2014/12/12/Using-web-api-client-in-synchronous-methods-and-some-good.aspxFri, 12 Dec 2014 11:05:27 GMThttp://codeclimber.net.nz/archive/2014/12/12/Using-web-api-client-in-synchronous-methods-and-some-good.aspx#feedback3http://codeclimber.net.nz/comments/commentRss/1020.aspxhttp://codeclimber.net.nz/archive/2014/12/12/Using-web-api-client-in-synchronous-methods-and-some-good.aspxHow to roll log files at the beginning of the day using Enterprise Library logging block.NEThttp://feedproxy.google.com/~r/Codeclimber/~3/TeGTwVZ5mzQ/How-to-roll-log-files-at-the-beginning-of-the.aspx
<p>It took me a while to find out the (very simple) solution to my problem, so I thought it would have been a good idea to create a post explaining it.</p> <h3>The problem</h3> <p>I’m logging from my application using <a href="http://msdn.microsoft.com/en-us/library/ff648951.aspx">Enterprise Library</a> <a href="http://msdn.microsoft.com/en-us/library/dn440731(v=pandp.60).aspx">Logging component</a>, and I wanted to have a new file every day. So I configured the logger with the <a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.logging.tracelisteners.rollingflatfiletracelistener(v=pandp.60).aspx">RollingFlatFileTraceListener</a>. One of the properties you can specify during the registration is the <font face="Courier New"><strong>rollInterval</strong></font> attibute, which configures the log to roll every minute, hour, day, week, month, year.</p> <p>I wanted to have a new file every day, so I specified “day”: I got a new file per day, but the rolling was happening at “random” times during the day. Actually it was not really random: the rolling time was moving forward by a few minutes every day.</p> <h3>The solution</h3> <p>After looking around and finding nothing I looked by mistake at the docs of v5. They said:</p> <blockquote> <p><strong>Remarks:</strong></p> <p>Logging always occurs to the configured file name, and when roll occurs a new rolled file name is calculated by adding the timestamp pattern to the configured file name.</p> <p>The need of rolling is calculated before performing a logging operation, so even if the thresholds are exceeded roll will not occur until a new entry is logged.</p> <p>Both time and size thresholds can be configured, and when the first of them occurs both will be reset.</p> <p>The elapsed time is calculated from the creation date of the logging file.</p> </blockquote> <p>Here everything is explained: the elapsed time is a day from the creation of the file, and the actual moment in which the new file is created is the next log entry after that 24 hours. </p> <p>I also found out that the <font face="Courier New"><strong>rollInterval</strong></font> property is based on an enum, <a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.logging.tracelisteners.rollinterval(v=pandp.50).aspx">RollInterval</a>, which contains also another element that I had previously overlooked: <font face="Courier New"><strong>Midnight</strong></font>. This makes the file to roll at the beginning of each day, instead of every 24 hours.</p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ec0fb40a-c9f2-4a0d-8897-62085f076afe" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/enterprise+library/default.aspx" rel="tag">enterprise library</a>, <a href="http://codeclimber.net.nz/tags/logging/default.aspx" rel="tag">logging</a>, <a href="http://codeclimber.net.nz/tags/RollingFlatFileTraceListener/default.aspx" rel="tag">RollingFlatFileTraceListener</a></div><img src="http://codeclimber.net.nz/aggbug/1019.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=TeGTwVZ5mzQ:eHmsut0f9rs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=TeGTwVZ5mzQ:eHmsut0f9rs:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=TeGTwVZ5mzQ:eHmsut0f9rs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=TeGTwVZ5mzQ:eHmsut0f9rs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=TeGTwVZ5mzQ:eHmsut0f9rs:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=TeGTwVZ5mzQ:eHmsut0f9rs:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=TeGTwVZ5mzQ:eHmsut0f9rs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=TeGTwVZ5mzQ:eHmsut0f9rs:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/TeGTwVZ5mzQ" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2014/11/14/How-to-roll-log-files-at-the-beginning-of-the.aspxFri, 14 Nov 2014 17:55:57 GMThttp://codeclimber.net.nz/archive/2014/11/14/How-to-roll-log-files-at-the-beginning-of-the.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1019.aspxhttp://codeclimber.net.nz/archive/2014/11/14/How-to-roll-log-files-at-the-beginning-of-the.aspxDon&rsquo;t miss Connect(); a virtual conference about Visual Studio vNextASP.NETASP.NET MVC.NETSoftware Developmenthttp://feedproxy.google.com/~r/Codeclimber/~3/UEAOMc9yIAQ/Donrsquot-miss-Connect-a-virtual-conference-about-Visual-Studio-vNext.aspx
<p align="center"><a href="http://www.visualstudio.com/en-us/connect-event-vs"><img src="http://i.microsoft.com/visualstudio/et/connect/header_full.png" /></a></p> <p>I just came back from the Microsoft MVP summit, where they announced (to MVPs) lots of interesting news about the future of web development with .NET: many were already well known like the new ASP.NET vNext and ASP.NET MVC 6, but other were pretty new also for us MVPs. Unfortunately, despite being super-excited about them, I cannot tell you anything as everything is under NDA.</p> <p>I can tell you though that this Wednesday and Thursday, there will be a virtual developer conference, <a href="http://www.visualstudio.com/en-us/connect-event-vs"><strong>Connect();</strong></a>, where many of the news will be revealed to the World.</p> <p>Specifically, on Wednesday 12th November, Scott Guthrie, “Soma” and Scott Hanselman will give their keynotes. The following day will be a more technical day, with sessions with product team members.</p> <p>Hopefully there will be recordings for people that due to the time zone differences could not attend.</p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4f7b410a-bbe0-4c58-a0fe-7ca938e937de" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/aspnet+vNext/default.aspx" rel="tag">aspnet vNext</a>, <a href="http://codeclimber.net.nz/tags/visual+studio+14/default.aspx" rel="tag">visual studio 14</a>, <a href="http://codeclimber.net.nz/tags/azure/default.aspx" rel="tag">azure</a>, <a href="http://codeclimber.net.nz/tags/conference/default.aspx" rel="tag">conference</a></div><img src="http://codeclimber.net.nz/aggbug/1018.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=UEAOMc9yIAQ:_gHNZI-Nu0I:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=UEAOMc9yIAQ:_gHNZI-Nu0I:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=UEAOMc9yIAQ:_gHNZI-Nu0I:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=UEAOMc9yIAQ:_gHNZI-Nu0I:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=UEAOMc9yIAQ:_gHNZI-Nu0I:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=UEAOMc9yIAQ:_gHNZI-Nu0I:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=UEAOMc9yIAQ:_gHNZI-Nu0I:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=UEAOMc9yIAQ:_gHNZI-Nu0I:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/UEAOMc9yIAQ" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2014/11/10/Donrsquot-miss-Connect-a-virtual-conference-about-Visual-Studio-vNext.aspxMon, 10 Nov 2014 13:52:51 GMThttp://codeclimber.net.nz/archive/2014/11/10/Donrsquot-miss-Connect-a-virtual-conference-about-Visual-Studio-vNext.aspx#feedback1http://codeclimber.net.nz/comments/commentRss/1018.aspxhttp://codeclimber.net.nz/archive/2014/11/10/Donrsquot-miss-Connect-a-virtual-conference-about-Visual-Studio-vNext.aspxHow to get integrated debugging in Visual Studio with OwinHost in Owin-based Katana web applicationsASP.NETASP.NET MVChttp://feedproxy.google.com/~r/Codeclimber/~3/inHcHXpZRyU/How-to-get-integrated-debugging-in-Visual-Studio-with-OwinHost.aspx
<p>In this blog post I want to share with you an hidden feature of Visual Studio 2013 that enables an integrated debugging experience with OwinHost and other custom hosts.</p> <h3>Options when building Owin-based apps</h3> <p>When you build an Owin-based web application with Katana you have 3 hosting options:</p> <ul> <li>Use the System.Web Host, build your app as <strong>Web Application</strong> and <em>run/debug</em> it inside IIS Express from within Visual Studio; </li> <li>Build your own custom host, build your app as <strong>Console Application</strong> and <em>run/de</em>bug it as custom console application; </li> <li>Use the <strong>OwinHost</strong> host that is part of the Katana suite, and build your app as <strong>Class Library</strong> and <em>run</em> it by manually launching the OwinHost.exe app from within the current project folder. </li> </ul> <h3>How to debug an Owin-based app running within OwinHost</h3> <p>In the third option I left out <em>debug</em> on purpose, it was not a mistake. This is because debugging an Owin app that is running in OwinHost is not as straightforward as the other 2 options:</p> <ul> <li>First you have to make sure the project is always built into the <font face="Courier New">\bin</font> folder instead of <font face="Courier New">\bin\Debug</font> or <font face="Courier New">\bin\Release</font> as otherwise OwinHost will not work (by default it looks for classes inside the <font face="Courier New">\bin</font> folder); </li> <li>Then you have to manually launch the OwinHost executable pointing to the folder in which it was installed by Nuget when you downloaded it (typically it would be <font face="Courier New">..\packages\OwinHost.(version)\tools\OwinHost.exe</font>, and with <a href="http://blogs.msdn.com/b/webdev/archive/2014/08/20/announcing-rtm-of-katana-3.aspx">the just released version</a>, <font face="Courier New">..\packages\OwinHost.3.0.0\tools\OwinHost.exe</font>) </li> <li>And finally, if you want to debug the application, you have to attach the debugger to the process , and launch the browser manually. </li> </ul> <p>Not a complicate procedure, but time consuming.</p> <h3>Introducing Visual Studio integration for external hosts</h3> <p>Visual Studio 2013 adds the possibility, in addition to the usual IIS Express and Local IIS, to launch a Web Application with a external url or by specifying an external hosting process. And the OwinHost nuget package takes advantage of this and when you install it within a Web Application project it also registers itself as additional custom host (here below the important part of the powershell install script in the nuget package):</p> <div class="innerbox">
<pre class="csharpcode"><pre class="csharpcode">$serverProvider = $dte.GetObject(<span class="str">"CustomWebServerProvider"</span>)
$servers = $serverProvider.GetCustomServers($project.Name)
$servers.AddWebServer(<span class="str">'OwinHost'</span>, $exeDir, <span class="str">'-u {url}'</span>, <span class="str">'http://localhost:12345/'</span>, <span class="str">'{projectdir}'</span>)</pre></pre>
</div> <p>This adds the following line to the .csproj file:</p> <div class="innerbox">
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">servers</span> <span class="attr">defaultServer</span><span class="kwrd">="OwinHost"</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">server</span> <span class="attr">name</span><span class="kwrd">="OwinHost"</span>
<span class="attr">exePath</span><span class="kwrd">="{solutiondir}\packages\OwinHost.3.0.0\tools\OwinHost.exe"</span>
<span class="attr">cmdArgs</span><span class="kwrd">="-u {url}"</span>
<span class="attr">url</span><span class="kwrd">="http://localhost:12345/"</span>
<span class="attr">workingDir</span><span class="kwrd">="{projectdir}"</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">servers</span><span class="kwrd">&gt;</span></pre>
</div> <p>In concrete what you get is a new entry in the <b>Servers</b> dropdown list in the <b>Web</b> tab of the <b>Server Properties</b> window of your web application project.</p> <p><a href="http://codeclimber.net.nz/images/codeclimber_net_nz/Windows-Live-Writer/bf1e0bfecb6d_EA26/008_2.png" rel="lightbox"><img title="Project Properties Window, Web tab" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; border-top-width: 0px; margin-right: auto" border="0" alt="Project Properties Window, Web tab" src="http://codeclimber.net.nz/images/codeclimber_net_nz/Windows-Live-Writer/bf1e0bfecb6d_EA26/008_thumb.png" width="452" height="343" /></a></p> <p>But since this option is only available inside a Web Application project, you have to create your application using the <strong>Empty</strong> template of a Web Application project and remove all the unneeded project references that come with Web Application projects, like System.Web for example.</p> <p>But once the references are cleaned up (and you have to do it only once), you can just hit <strong>F5</strong> or press the “Debug” button and OwinHost will fire-up loading your Owin startup class, your browser will start to the right url, and the debugger will be already attached to the process, just like with IIS hosted apps.</p> <h3>Compatibility issues</h3> <p>This new feature only works with Visual Studio 2013, so if you want to open the same project also in VS 2012 do not install it otherwise the project will not load (the Nuget Manager will ask you if you want to install the server extension or not).</p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ba4e9386-97e7-4743-a3e1-d455e4ed8c13" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/owin/default.aspx" rel="tag">owin</a>, <a href="http://codeclimber.net.nz/tags/katana/default.aspx" rel="tag">katana</a>, <a href="http://codeclimber.net.nz/tags/owinhost/default.aspx" rel="tag">owinhost</a>, <a href="http://codeclimber.net.nz/tags/VS2013/default.aspx" rel="tag">VS2013</a></div><img src="http://codeclimber.net.nz/aggbug/1017.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=inHcHXpZRyU:ql7ttM1Sp3E:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=inHcHXpZRyU:ql7ttM1Sp3E:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=inHcHXpZRyU:ql7ttM1Sp3E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=inHcHXpZRyU:ql7ttM1Sp3E:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=inHcHXpZRyU:ql7ttM1Sp3E:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=inHcHXpZRyU:ql7ttM1Sp3E:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=inHcHXpZRyU:ql7ttM1Sp3E:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=inHcHXpZRyU:ql7ttM1Sp3E:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/inHcHXpZRyU" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2014/08/22/How-to-get-integrated-debugging-in-Visual-Studio-with-OwinHost.aspxFri, 22 Aug 2014 14:55:49 GMThttp://codeclimber.net.nz/archive/2014/08/22/How-to-get-integrated-debugging-in-Visual-Studio-with-OwinHost.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1017.aspxhttp://codeclimber.net.nz/archive/2014/08/22/How-to-get-integrated-debugging-in-Visual-Studio-with-OwinHost.aspxAnnouncing the 2nd Web European Conference, next Spring, in ItalyCommunity Lifehttp://feedproxy.google.com/~r/Codeclimber/~3/aOQOyAL5AN0/Announcing-the-2nd-Web-European-Conference-next-Spring-in-Italy.aspx
<p>We did it in <a href="http://2012.webnextconf.eu/">October 2012</a>, and we are <a href="http://webnextconf.eu/">doing it again</a>: we are organizing the <a href="http://webnextconf.eu/">2nd Web European Conference</a> for Spring 2015, somewhere in Italy.</p> <p>The conference will be about <strong>Modern Web Development</strong>, no matter which platform: .NET, Node.js, Ruby, JavaScript.</p> <h3>Our Manifesto</h3> <p><strong>Modern web development</strong> is moving away from all the <em>enterprisey</em> features that used to rule the world of development in the past years, and is going toward a more light-weight and simple approach. </p> <ul> <li><strong>Code Craftsmanship</strong>: Developers are taking back the control, of the code they write, on how they write and on which tools make them productive. </li> <li><strong>Tiny assemblable frameworks</strong>: Gone are the huge monolithic frameworks from one vendor: Modern Web Apps are a mix and match of different frameworks, technologies and languages. </li> <li><strong>BYOT</strong>: Bring Your Own Tool: Modern Web Development is about productivity the way you want it, not the way the vendor wants it to be. </li> <li><strong>Mobile First</strong>: Web sites are now mostly viewed on mobile devices: web sites and apps must be built with that in mind. </li> </ul> <h3>Call for presenters</h3> <p>To make an awesome conference we need awesome speakers, and today we are also launching the call for presenters: if you want to propose a talk that matches the ideas of our Manifest, you can already submit your proposal. Go on our <a href="https://github.com/Web-European-Conference">Github account</a>, fork the <a href="https://github.com/Web-European-Conference/c4p">c4p repository</a>, add your proposal and submit a pull request.</p> <h3>Call for sponsors</h3> <p>And we also need awesome partners and sponsors: if your company embraces our manifesto, and want to be part of this conference, please contact us via the contact form available on our <a href="http://webnextconf.eu">website</a>.</p> <h3>Subscribe to get more info</h3> <p>We don’t have much more to share at the moment apart from the timeframe, Spring 2015, possibly April, and the location, possibly Milano. But if you want to be the first to know about the conference, and to have the possibility to pre-register before the official registration opens, go to our website</p> <p align="center"><a title="http://webnextconf.eu/" href="http://webnextconf.eu/"><font size="6">http://webnextconf.eu/</font></a></p> <p>and subscribe to the mailing list.</p> <div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:926d06b9-cc81-4b80-85f7-c502a304c419" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px">Tags: <a href="http://codeclimber.net.nz/tags/webnextconf/default.aspx" rel="tag">webnextconf</a>, <a href="http://codeclimber.net.nz/tags/conference/default.aspx" rel="tag">conference</a>, <a href="http://codeclimber.net.nz/tags/web/default.aspx" rel="tag">web</a></div><img src="http://codeclimber.net.nz/aggbug/1016.aspx" width="1" height="1" /><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Codeclimber?a=aOQOyAL5AN0:990P5Xxdf1o:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=aOQOyAL5AN0:990P5Xxdf1o:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=aOQOyAL5AN0:990P5Xxdf1o:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=aOQOyAL5AN0:990P5Xxdf1o:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=aOQOyAL5AN0:990P5Xxdf1o:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=aOQOyAL5AN0:990P5Xxdf1o:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/Codeclimber?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Codeclimber?a=aOQOyAL5AN0:990P5Xxdf1o:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Codeclimber?i=aOQOyAL5AN0:990P5Xxdf1o:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Codeclimber/~4/aOQOyAL5AN0" height="1" width="1" alt=""/>Simone Chiarettahttp://codeclimber.net.nz/archive/2014/07/25/Announcing-the-2nd-Web-European-Conference-next-Spring-in-Italy.aspxFri, 25 Jul 2014 10:16:00 GMThttp://codeclimber.net.nz/archive/2014/07/25/Announcing-the-2nd-Web-European-Conference-next-Spring-in-Italy.aspx#feedbackhttp://codeclimber.net.nz/comments/commentRss/1016.aspxhttp://codeclimber.net.nz/archive/2014/07/25/Announcing-the-2nd-Web-European-Conference-next-Spring-in-Italy.aspx