<feed xml:base="https://hudosvibe.net/" xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Hudo's vibe</title>
  <subtitle type="text">Latest blog posts</subtitle>
  <id>uuid:f5d0eb87-dcc7-4752-9d64-ed38a029b610;id=7</id>
  <updated>2026-04-05T10:37:08Z</updated>
  <link href="https://hudosvibe.net/" />
  <entry>
    <id>https://hudosvibe.net/post/tips-model-validation-filter-in-mvc-core</id>
    <title type="text">Tips: model validation filter in MVC Core</title>
    <published>2018-02-09T12:06:35Z</published>
    <updated>2018-02-12T10:44:38Z</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/tips-model-validation-filter-in-mvc-core" />
    <content type="text">&lt;p&gt;How many times did you write a code like this:
&lt;script src="https://gist.github.com/hudo/4637a0daf14c1818c9c2e9c873652cf0.js"&gt;&lt;/script&gt;

&lt;p&gt;Workflow is usually this:&amp;nbsp; &lt;ul&gt;&lt;li&gt;&lt;p&gt;Try to validate user input&lt;ul&gt;&lt;li&gt;&lt;p&gt;If error, return same view with error messages&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p&gt;Invoke business logic, map data to persistence model&lt;/p&gt;&lt;li&gt;&lt;p&gt;Try to save data&lt;ul&gt;&lt;li&gt;&lt;p&gt;If error, log to db, return view with user-readable error message (this is generic approach, true, in real app we would probably try to check what kind of error was returned and then do something specific)&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p&gt;Redirect somewhere (we are in &lt;a href="https://en.wikipedia.org/wiki/Post/Redirect/Get"&gt;Post-Redirect-Get&lt;/a&gt; loop)&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;To avoid of repetition of some steps there we can decorate Save actions with our special attribute! &lt;p&gt;Here's the whole filter, with all the code comments which hopefully explains how it works. &lt;/p&gt;&lt;script src="https://gist.github.com/hudo/fa0da9405d3ab68d00d56a645acbf4b6.js"&gt;&lt;/script&gt;Usage is simple, just decorate your POST action with [ValidateModel] attribute, and then you can remove if(!ModelState.IsValid) checks, and also exception catch if there's any. &lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/decorator-pattern-in-pagination-ui-component</id>
    <title type="text">Decorator pattern in Pagination UI component</title>
    <published>2017-12-07T16:43:57Z</published>
    <updated>2017-12-07T16:43:57Z</updated>
    <author>
      <name>hudo</name>
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/decorator-pattern-in-pagination-ui-component" />
    <content type="text">&lt;p&gt;About a year a go I released &lt;a href="https://www.nuget.org/packages/JA.Pagination.MVC6/"&gt;nuget package for creating simple pager HTML&lt;/a&gt;, specifically designed to work nicely with bootstrap, since, well, the whole damn world is using that CSS framework. Until next better framework arrives ...   &lt;br /&gt;&lt;img src="/upload/pager.png" /&gt; &lt;/p&gt;&lt;p&gt;It's a simple code, but to "calculate" which pages have to displayed in the pager (e.g.: 1 ... 2 3 [4] 5 6 ... 50), there's some logic behind it, so worth of packaging it into a nuget, IMHO.   &lt;/p&gt;&lt;p&gt;There are 3 packages released, depending how high or low somebody wants to go with abstraction   &lt;/p&gt;&lt;p&gt;- JA.Pagination - no dependency on any framework, API is just one Render() method with returns a string. Suitable for Nancy framework and similar ...   &lt;/p&gt;&lt;p&gt;- JA.Pagination.MVC5 - extension method for MVC 5 HTML helper   &lt;/p&gt;&lt;p&gt;- JA.Pagination.MVC6 - extension method for MVC Core (MVC 6, or now called v1 and v2)   &lt;/p&gt;&lt;p&gt;Usage from MVC:  &lt;/p&gt;&lt;p&gt;@Html.RenderPager(Model.CurrentPage, Model.TotalPages)  &lt;/p&gt; &lt;p&gt;But, there's one more thing worth mentioning here - usage of &lt;strong&gt;Decorator design pattern&lt;/strong&gt;. If you're just learning &lt;a href="http://www.dofactory.com/net/decorator-design-pattern"&gt;GoF Design Patterns&lt;/a&gt; and looking for a real world example, this could be useful!  &lt;/p&gt;&lt;p&gt;Pager consists of several elements, like list item, link, content, etc. If you take a look at HTML code:&lt;/p&gt; &lt;script src="https://gist.github.com/hudo/7c8b5c9e5a18b8aa8aeb5cdb3d7d1f4d.js"&gt;&lt;/script&gt; &lt;p&gt;you’ll notice how text content, for example page “2” is inside &amp;lt;a&amp;gt; tag, which is inside &amp;lt;li&amp;gt; tag, which is inside &amp;lt;ul&amp;gt; tag! So we can say text “2” is decorated with link, list item and unordered list elements. That can be modelled nicely with code:&lt;/p&gt; &lt;script src="https://gist.github.com/hudo/ccb7f80cfddff64e541385d239a89af8.js"&gt;&lt;/script&gt; &lt;p&gt;each of those classes inherit from interface:&lt;/p&gt; &lt;script src="https://gist.github.com/hudo/c023aee20ca9e6a868406f838d975f90.js"&gt;&lt;/script&gt; &lt;p&gt;meaning, each items needs to know how to render itself! But to get “decoration” pattern working, trick is to insert another IRenderable into constructor, and that will make one IRenderable decorator of another IRenderable:&lt;/p&gt; &lt;script src="https://gist.github.com/hudo/8ea171e14d5d4f2502f1c6b9d5b5d1a6.js"&gt;&lt;/script&gt; &lt;p&gt;Here LinkDecorator doesn’t really care what it is decorating with &amp;lt;a&amp;gt; and &amp;lt;/a&amp;gt;, it just needs to invoke that _inner.Render()!&lt;/p&gt; &lt;p&gt;When some top level object calls Render() method of an object, that method will call inner.Render(), that then calls its own inner.Render(), and so on, depending how many decorators we definded. &lt;/p&gt; &lt;p&gt;Simple, right?&lt;/p&gt; &lt;p&gt;Check full &lt;a href="https://github.com/hudo/JustAnotherPager"&gt;source code at Github&lt;/a&gt;.  &lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/mock-user-identity-in-asp.net-mvc-core-controller-tests</id>
    <title type="text">Set User identity and IsAuthenticated in ASP.NET MVC Core controller tests</title>
    <published>2017-07-17T13:55:47+01:00</published>
    <updated>2017-07-17T13:55:47+01:00</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/mock-user-identity-in-asp.net-mvc-core-controller-tests" />
    <content type="text">&lt;p&gt;Small reminder how to fake &lt;strong&gt;User.Identity.IsAuthenticated&amp;nbsp; &lt;/strong&gt;and &lt;strong&gt;User.Identity.Name&amp;nbsp; &lt;/strong&gt;inside unit tests, while testing controller code. It’s not so obvious and I often forget this small trick, which is also important when writing user authentication code (login). &lt;/p&gt; &lt;p&gt;Our simple controller returns a model, where one property depends on authenticated user state:&lt;/p&gt;
&lt;script src="https://gist.github.com/hudo/0b8c933725f3c752412caecfafc6dbf0.js"&gt;&lt;/script&gt;
&lt;p&gt;In unit test we want to validate model properties, specially CanWriteStory which has to be True if user is authenticated. &lt;/p&gt;&lt;p&gt;Simple unit test for this controller:&lt;br&gt;&lt;script src="https://gist.github.com/hudo/b80ba41ea54f451986b07736bdf4d665.js"&gt;&lt;/script&gt;&lt;p&gt;This test will pass (User.Identity.IsAuthenticated will be True) because we configured &lt;strong&gt;authentication type &lt;/strong&gt;“someAuthTypeName”&amp;nbsp; (&lt;a href="https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/security/claims/ClaimsIdentity.cs#L271"&gt;here&lt;/a&gt; and &lt;a href="https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/security/claims/ClaimsIdentity.cs#L461"&gt;here&lt;/a&gt;)! Without looking at MVC source code it would take me a long time to figure that out, and to be honest correlation between IsAuthenticated and AuthenticationType is still little bit confusing.&amp;nbsp; &lt;/p&gt;&lt;p&gt;The test also shows how simple it is to set HttpContext to controller, without need of using some mocking framework. If I’m brave enough, I would try to write similar test for WebForms and Page class, but I’m not&lt;img class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://hudosvibe.net/posts/files/41ec8d5f-3a66-4ac9-8b1a-5c8175bed41b.png"&gt;&lt;/p&gt;&lt;p&gt;Same rule, with setting of authentication type applies when writing custom login code, which looks probably something like this:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;var claims = new List&amp;lt;Claim&amp;gt; { new Claim(ClaimTypes.Name, user.Result.Username) };&lt;/p&gt;
&lt;p&gt;await _httpContext.HttpContext.Authentication.SignInAsync(Application.AuthScheme, new ClaimsPrincipal(new ClaimsIdentity(claims, "form")));&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;if we forget to set auth type “form” (can be whatever), user will not be authenticated!&lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/install-.net-core-on-mint-18-or-elementary-os</id>
    <title type="text">Install .NET Core on Mint 18 or Elementary OS</title>
    <published>2016-11-02T17:43:01Z</published>
    <updated>2016-11-03T17:05:06Z</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/install-.net-core-on-mint-18-or-elementary-os" />
    <content type="text">&lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/a462ce4d-8b9e-4a2f-9178-6493d1c7364b.png"&gt;&lt;img title="image" 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="image" src="http://hudosvibe.net/posts/files/e1d9d04e-94d4-4539-8a7f-b4303481d7a1.png" width="900" height="563"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you try to install latest .NET Core SDK 1.0.1 on &lt;strong&gt;Mint 18 or Elementary OS Loki&lt;/strong&gt; (based on Ubuntu 14.04 and 16.04 LTS) by following instructions on &lt;a href="http://get.asp.net"&gt;http://get.asp.net&lt;/a&gt;, you might see this error:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font size="2"&gt;mint-vbox hudo # sudo apt-get install dotnet-dev-1.0.0-preview2-003131&lt;br&gt;Reading package lists... Done&lt;br&gt;Building dependency tree&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;Reading state information... Done&lt;br&gt;Some packages could not be installed. This may mean that you have&lt;br&gt;requested an impossible situation or if you are using the unstable&lt;br&gt;distribution that some required packages have not yet been created&lt;br&gt;or been moved out of Incoming.&lt;br&gt;The following information may help to resolve the situation:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;The following packages have unmet dependencies:&lt;br&gt;dotnet-dev-1.0.0-preview2-003131 : Depends: dotnet-sharedframework-microsoft.netcore.app-1.0.1 but it is not going to be installed&lt;br&gt;E: Unable to correct problems, you have held broken packages.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;em&gt;dotnet-sharedframework-microsoft.netcore.app-1.0.1&lt;/em&gt; is missing, but if you try to apt-get that, then dependent &lt;strong&gt;libicu52 is missing&lt;/strong&gt;, only libicu55 is in Ubuntu repository. &lt;/p&gt; &lt;p&gt;We can get it from this Url, by downloading .deb file: &lt;a title="https://launchpad.net/ubuntu/wily/amd64/libicu52/52.1-8" href="https://launchpad.net/ubuntu/wily/amd64/libicu52/52.1-8"&gt;https://launchpad.net/ubuntu/wily/amd64/libicu52/52.1-8&lt;/a&gt; (you’ll probably choose Arm64 release binary)&lt;/p&gt; &lt;p&gt;Since we can’t just execute this .deb by double-clicking on it (at least on Elementary OS), we have to move it to repo cache and use apt-get install, or better, use &lt;strong&gt;gdebi&lt;/strong&gt; utility (Mint 18 already includes it):&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font size="2"&gt;sudo apt-get install gdebi&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;If we double-click to downloaded .deb file now, a window will appear offering:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/6b46cf3d-95a7-4713-aca1-bc989e3a1ff3.png"&gt;&lt;img title="image" 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="image" src="http://hudosvibe.net/posts/files/fea19234-ed1b-4360-8588-90b82c234dea.png" width="400" height="315"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;After that, executing last .net core installation step takes us to the happy place &lt;img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Smile" src="http://hudosvibe.net/posts/files/a2a8a576-ad10-4124-8d5c-eb58f8bfc199.png"&gt; :&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font size="2"&gt;mint-vbox hudo # sudo apt-get install dotnet-dev-1.0.0-preview2-003131&lt;br&gt;Reading package lists... Done&lt;br&gt;….&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Setting up dotnet-sharedframework-microsoft.netcore.app-1.0.1 (1.0.1-1) ...&lt;br&gt;Setting up dotnet-dev-1.0.0-preview2-003131 (1.0.0-preview2-003131-1) ...&lt;br&gt;This software may collect information about you and your use of the software, and send that to Microsoft.&lt;br&gt;Please visit &lt;/font&gt;&lt;a href="http://aka.ms/dotnet-cli-eula"&gt;&lt;font size="2"&gt;http://aka.ms/dotnet-cli-eula&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; for more information.&lt;br&gt;Processing triggers for libc-bin (2.23-0ubuntu4) ...&lt;br&gt;hudo-VirtualBox hudo # dotnet&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Microsoft .NET Core Shared Framework Host&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&amp;nbsp; Version&amp;nbsp; : 1.0.1&lt;br&gt;&amp;nbsp; Build&amp;nbsp;&amp;nbsp;&amp;nbsp; : cee57bf6c981237d80aa1631cfe83cb9ba329f12&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Usage: dotnet [common-options] [[options] path-to-application]&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Common Options:&lt;br&gt;&amp;nbsp; --help&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Display .NET Core Shared Framework Host help.&lt;br&gt;&amp;nbsp; --version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Display .NET Core Shared Framework Host version.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Options:&lt;br&gt;&amp;nbsp; --fx-version &amp;lt;version&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Version of the installed Shared Framework to use to run the application.&lt;br&gt;&amp;nbsp; --additionalprobingpath &amp;lt;path&amp;gt;&amp;nbsp;&amp;nbsp; Path containing probing policy and assemblies to probe for.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;Path to Application:&lt;br&gt;&amp;nbsp; The path to a .NET Core managed application, dll or exe file to execute.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;If you are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;To get started on developing applications for .NET Core, install .NET SDK from:&lt;br&gt;&amp;nbsp; &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=798306&amp;amp;clcid=0x409"&gt;&lt;font size="2"&gt;http://go.microsoft.com/fwlink/?LinkID=798306&amp;amp;clcid=0x409&lt;/font&gt;&lt;/a&gt;&lt;br&gt;&lt;font size="2"&gt;mint-vbox hudo # &lt;br&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;h3&gt;Visual Studio Code and Omnisharp support&lt;/h3&gt; &lt;p&gt;Since &lt;strong&gt;elementary OS 0.4 Loki&lt;/strong&gt;, platform Id changed from “elementary OS” to “elementary”. To fix Omnisharp problem of not recognizing&amp;nbsp; this version of OS, &lt;strong&gt;edit platform.js&amp;nbsp; &lt;/strong&gt;file in&lt;strong&gt; /home/username/.vscode/extensions/ms-vscode.csharp-1.4.1/out/&amp;nbsp; &lt;/strong&gt;by changing line (I removed “OS” in line 76):&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;case 'elementary':&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;on mint, this case branch needs to be added to the end of switch statement:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font size="3"&gt;case 'linuxmint':&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var versionId = getValue("VERSION_ID");&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (versionId.startsWith("17")) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This also works for Linux Mint&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Platform.Ubuntu14;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (versionId.startsWith("18")) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Platform.Ubuntu16;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;font size="3"&gt;Don’t forget to restart VS Code after changing platform.js. Hopefully, VS Code and Omnisharp will be able to recognize the project, install necessary files, like build tasks and debugger support! &lt;/font&gt;&lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/mvc-core-workshop-in-dublin</id>
    <title type="text">MVC Core Workshop in Dublin</title>
    <published>2016-10-31T21:49:49Z</published>
    <updated>2016-10-31T21:49:49Z</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/mvc-core-workshop-in-dublin" />
    <content type="text">&lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/a5f91e5b-d29e-44d9-97be-49f1c8a27e9d.jpg"&gt;&lt;img title="2016-10-26-PHOTO-00000133[1493]" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: left; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px" border="0" alt="2016-10-26-PHOTO-00000133[1493]" src="http://hudosvibe.net/posts/files/551a177d-676e-45ae-8a08-008657734476.jpg" width="502" align="left" height="377"&gt;&lt;/a&gt;Last week I started new meetup user group in Dublin: "ASP.NET Workshop Dublin" (yes, very imaginative title…), aimed to everyone who wants to learn about new MVC Core by building real end-to-end application. Its here: &lt;a href="https://www.meetup.com/ASP-NET-Workshop-Dublin"&gt;https://www.meetup.com/ASP-NET-Workshop-Dublin&lt;/a&gt; &lt;p&gt;But, to get even more value from this and not just list the features of new framework, the idea is to build some useful application, deploy it to the production and release the source code on Github.  &lt;p&gt;On the first meetup we agreed on the topic (no title yet, that's usually the most difficult part anyway!), and it will be about sharing positive news and random acts of kindness. While every news portal is bombarding us with depressing and negative articles, reading or sharing some positive stores can help every one of use. Small things, like paying coffee to someone, helping change the tire or noticing kind person… There's even some medical science behind this!  &lt;p&gt;While building this app the group will learn how to start with empty .NET Core project, add MVC frameworks, middlewares, render views, model data, store data to database, use Git and deploy app to web server. &lt;p&gt;Plan is to have around 5 to 10 meetups and to have working version of application with basic UI, authentication, database, that people can use. Further improvements can be made by contributing to the project repository.  &lt;p&gt;Source code will be available of Github (link will be updated here, as soon as I find some title for the app). </content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/using-core-class-library-from-.net-4.6-project</id>
    <title type="text">Using Core class library from .NET 4.6 project</title>
    <published>2016-10-11T14:44:02+01:00</published>
    <updated>2016-10-27T13:55:40+01:00</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/using-core-class-library-from-.net-4.6-project" />
    <content type="text">&lt;p&gt;It started as a quick evening project (&lt;a href="https://github.com/hudo/JustAnotherPager"&gt;HTML Pager for Bootstrap&lt;/a&gt;), one class library I needed for some web projects to generate Bootstrap-happy pager HTML, and it ended up in hours of chasing weird VS2015 project configuration issues. I just wanted to package Core project into nuget and use it from MVC6 Core projects and also "old" full .NET 4.6 web projects (MVC5). Soon after I started splitting projects and importing DLLs, Visual Studio complained and I just couldn't reference Core project from my MVC 5 web app!  &lt;p&gt;Scott Hanselman explained similar &lt;a href="http://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCore10WebApp.aspx"&gt;in his blog post&lt;/a&gt;, but I needed the exact opposite thing!  &lt;p&gt;Maybe .NET Core is in RTM, but it reminded me that tooling support is still in deep Preview 2 state where half of things just doesn't work, meaning there's no UI support for them.  &lt;p&gt;Plan is to have 3 packages:  &lt;ol&gt; &lt;li&gt; &lt;p&gt;Core class library, with no special dependencies to MVC, but just pager renderer class (xproj)&lt;/p&gt; &lt;li&gt; &lt;p&gt;MVC 5 html helper wrapper (full .net 4.6, csproj), dependency to MVC 5 &lt;/p&gt; &lt;li&gt; &lt;p&gt;MVC 6 html helper wrapper (core, netstandard1.6, xproj), dependency to MVC 6&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;For 3), its easy since xproj can be referenced from another xproj, &lt;strong&gt;but Core project can't be referenced from 4.6 (csproj) project!&lt;/strong&gt; The trick is to package core bits into nuget and then import that into csproj.  &lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/f2eb5e3b-22e2-433b-843d-af559e44ed2a.png"&gt;&lt;img title="projectstructure" 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="projectstructure" src="http://hudosvibe.net/posts/files/2aca5726-8dff-4645-bd7b-8f9fa1b6ef5c.png" width="758" height="476"&gt;&lt;/a&gt; &lt;p&gt;Core class library needs to specify both frameworks in project.json, like this:&lt;/p&gt; &lt;code&gt;"frameworks": {&lt;br&gt;&amp;nbsp;&amp;nbsp; "netstandard1.3": {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "dependencies": {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "NETStandard.Library": "1.3.0" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp; },&lt;br&gt;&amp;nbsp;&amp;nbsp; "net46": {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "dependencies": { "System.Runtime": "4.0.20" } &lt;br&gt; &amp;nbsp;&amp;nbsp; }&lt;br&gt;} &lt;/code&gt; &lt;p&gt;It has two frameworks, so library can be used from .net 4.6 and Core. I'm using Func&amp;lt;,&amp;gt; and System.Runtime package has to be added to net46 project.  &lt;p&gt;The problem is, you can Add Project Reference to it from other Core (xproj) project, but not from standard 4.6 project. To use it from 4.6, a package needs to be created and added through nuget. Every time I change something in the Core lib, I have to create the package and re-install it to 4.6 project.  &lt;p&gt;In my case, I added &lt;a href="https://github.com/hudo/JustAnotherPager/blob/master/src/JA.Pagination/Pack.bat"&gt;small .bat&lt;/a&gt; file to the Core project root, which creates package into a common folder:  &lt;p&gt;&lt;code&gt;dotnet pack -o ../../InternalRepository &lt;/code&gt; &lt;p&gt;Dotnet pack command uses information from project.json to create the package, like id, title, dependency libs, etc. Convenient UI tool for managing nupkg and nuspec files is Package Manager Explorer https://github.com/NuGetPackageExplorer/NuGetPackageExplorer  &lt;p&gt;InternaRepository is folder referenced by solution nuget.config, used by all projects in the solution:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;code&gt;&amp;lt;configuration&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;packageSources&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add key="Local" value="InternalRepository" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add key="NugetV3" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/packageSources&amp;gt;&lt;br&gt;&amp;lt;/configuration&amp;gt; &lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you change something in Core project, package needs to be created again and re-installed into 4.6 project. One way is updating build semver (1.0.x) and then update the package, other way is re-installing existing package with (in Package-Manager Console): &lt;br&gt;&lt;code&gt;Update-Package JA.Pagination -reinstall &lt;/code&gt; &lt;p&gt;Why I didn't just pack Core package into nuget and used that? I wanted to have extension methods for Razor, so pager can be called with just &lt;strong&gt;Html.RenderPager(...), instead of Html.Raw(Pager.Build(...).Render()). &lt;/strong&gt; &lt;p&gt;Since MVC5 and MVC6 have different HtmlHelper classes, I needed two additional projects, each one targeting different version of MVC and adding extension method to specific HtmlHelper class.  &lt;p&gt;To be honest, I’m still not sure if this is the best way of managing 4.6 and Core projects in the same solution, but it’s the only thing that worked! In case somebody knows better way, I would be happy to hear about it, so please post the comment!  &lt;p&gt;Full source code is available on &lt;a href="https://github.com/hudo/JustAnotherPager"&gt;Github&lt;/a&gt;. &lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/ubuntu-with-xfce-aspnet-core-and-nginx-part-2</id>
    <title type="text">Ubuntu with XFCE, ASP.NET Core and Nginx, part II</title>
    <published>2016-06-29T11:39:23+01:00</published>
    <updated>2016-06-29T11:39:23+01:00</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/ubuntu-with-xfce-aspnet-core-and-nginx-part-2" />
    <content type="text">&lt;p&gt;After we successfully installed and configured XFCE on Ubuntu 14.04 and ASP.NET Core 1.0 in &lt;a href="http://hudosvibe.net/post/ubuntu-with-xfce-aspnet-core-and-nginx-part-1"&gt;part 1&lt;/a&gt; of this tutorial, we have to add NGINX to expose our great Hello World app to the internet. As I mentioned in part I, it’s not advisable to expose Kestrel directly, since it’s not meant to be used like that and has lot of limitation as a front-end web server: handling of multiple host names, authentication, HTTPS offloading, caching, just to mention few. &lt;/p&gt; &lt;p&gt;Nginx will receive requests for specific host name (we’ll point subdomain or domain to our Azure VM) and route them to internal Kestrel URL (localhost:5000 in this example). This configuration is called Reverse Proxy. Same thing can be done also with IIS Application Request and Routing module on Windows. &lt;/p&gt; &lt;h2&gt;Point DNS to Azure VM&lt;/h2&gt; &lt;p&gt;Let’s start with updating our DNS records. Open your DNS provider-of-choice and add &lt;strong&gt;CNAME&lt;/strong&gt; record that points to Azure VM DNS name. Azure usually creates name like myvmname.westeurope.cloudapp.azure.com. Here, I created subdomain on this blog domain: &lt;a href="http://coretest.hudosvibe.net"&gt;http://coretest.hudosvibe.net&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/30f273ce-b95a-4120-af9b-6ab5a4b7e56c.png"&gt;&lt;img title="image" 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="image" src="http://hudosvibe.net/posts/files/dc4d3991-de87-4409-9ef5-e80c4dc510d5.png" width="880" height="293"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you don’t want to update DNS records, then just edit you OS hosts file and point subdomain.domain.com to IP address of this Azure server!&lt;/p&gt; &lt;h2&gt;NGINX installation&lt;/h2&gt; &lt;p&gt;SSH into your VM or RDP into XFCE, and open bash. To install nginx type:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;sudo apt-get update&lt;br&gt;sudo apt-get install nginx&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;If you open your browser and type Azure DNS name or subdomain into address bar, nginx welcome page should open! From within VM, you can try to open (with Midori) &lt;a href="http://localhost"&gt;http://localhost&lt;/a&gt;, the same welcome page should open (the same web opened from my dev machine and from Ubuntu with Midori):&amp;nbsp; &lt;/p&gt; &lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/3caf9035-396c-4d99-a967-56179eee5509.png"&gt;&lt;img title="image" 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="image" src="http://hudosvibe.net/posts/files/9fcdad82-68f1-45cf-8a02-d55fab22f8e5.png" width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/515bcf51-cb37-4946-898c-e1c9341f0c0f.png"&gt;&lt;img title="image" 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="image" src="http://hudosvibe.net/posts/files/023ac004-bae0-4d84-9433-432530521510.png" width="640" height="322"&gt;&lt;/a&gt;&lt;/p&gt; &lt;h2&gt;NGINX Reverse proxy to Kestrel server configuration&lt;/h2&gt; &lt;p&gt;Open your favorite editor (nano, geany) as sudo, create a new file with the content (again, change sub/domain name):&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;server {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; listen 80;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; listen [::]:80;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; server_name &lt;em&gt;subdomain.domain.com&lt;/em&gt;;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; location / {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proxy_pass http://localhost:5000;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This will forward all requests to internal Kestrel web server that’s listening on the port 5000 (it’s started with &lt;em&gt;dotnet run&lt;/em&gt;, right?).&lt;/p&gt; &lt;p&gt;Save the file as /&lt;font face="Courier New"&gt;etc/nginx/sites-available/subdomain.domain.com&lt;/font&gt;&lt;/p&gt; &lt;p&gt;We have to enable this website, and that’s done by creating a link to that file in /etc/nginx/sites-enabled:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;sudo ln -s /etc/nginx/sites-available/subdomain.domain.com /etc/nginx/sites-enabled/&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Now open nginx configuration file&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;sudo nano /etc/nginx/nginx.conf, or&lt;br&gt;sudo geany /etc/nginx/nginx.conf&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;find and uncomment this line: &lt;font face="Courier New"&gt;server_names_hash_bucket_size 64;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;After restarting nginx this reverse proxy configuration should work:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;sudo service nginx restart&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/a7e3d885-e1e3-438c-a87e-79fae71bceba.png"&gt;&lt;img title="image" 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="image" src="http://hudosvibe.net/posts/files/f5ce90ee-429e-4cb4-b403-de34900f3e24.png" width="450" height="212"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;More details on nginx configuration can be found &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts"&gt;here&lt;/a&gt;, and about reverse proxy please visit &lt;a href="https://www.nginx.com/resources/admin-guide/reverse-proxy/"&gt;this link&lt;/a&gt;. &lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/ubuntu-with-xfce-aspnet-core-and-nginx-part-1</id>
    <title type="text">Ubuntu with XFCE, ASP.NET Core and Nginx, part I</title>
    <published>2016-06-28T13:54:24+01:00</published>
    <updated>2016-07-02T21:46:48+01:00</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/ubuntu-with-xfce-aspnet-core-and-nginx-part-1" />
    <content type="text">&lt;p&gt;&lt;a href="http://hudosvibe.net/posts/files/e8898bb5-f909-4628-bf1f-e76cee58983a.png"&gt;&lt;img title="xfce" 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="xfce" src="http://hudosvibe.net/posts/files/e1ad8417-9aa8-432e-93c9-2edb660074dc.png" width="1024" height="593"&gt;&lt;/a&gt; &lt;p&gt;Here are few tips how to create and run ASP.NET Core application under Linux (&lt;strong&gt;Ubuntu 14.04 LTS&lt;/strong&gt;), on a cheap &lt;strong&gt;Azure VM&lt;/strong&gt; (0.75GB RAM, 0.25 CPU cores). Windows Server requires a little bit more memory (way around that is to increase the size while you're configuring the machine, and then lower it while not working in RDP).  &lt;p&gt;Goals of this exercise are: &lt;ul&gt; &lt;li&gt; &lt;p&gt;Cheap Azure VM with Linux (around 10-15$/month). There are other hosting option, for example on &lt;a href="https://www.hetzner.de/en/hosting/produkte_vserver/cx10"&gt;Hetzner&lt;/a&gt;, for ~5€/m&lt;/p&gt; &lt;li&gt; &lt;p&gt;RDP protocol, not VNC (VNC uses Jpegs to transfer screen updates, that's very slow compared to RDP protocol)&lt;/p&gt; &lt;li&gt; &lt;p&gt;Some graphical UI that's not standard Ubuntu Gnome (to save memory) for basic text editing task (since I'm still struggling with linux bash text editors and copy-paste between them)&lt;/p&gt; &lt;li&gt; &lt;p&gt;Dot Net Core installed, ASP.NET Core app &lt;/p&gt; &lt;li&gt; &lt;p&gt;&lt;strong&gt;NGINX&lt;/strong&gt; in front of &lt;strong&gt;kestrel&lt;/strong&gt;, to serve as a &lt;strong&gt;Reverse Proxy &lt;/strong&gt;(similar to Application Request Routing on IIS)&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Luckily, there's a great blog post on how to install UI on top of Ubuntu Server, and uses &lt;strong&gt;XFCE&lt;/strong&gt;: &lt;p&gt;&lt;a href="http://colhountechblog.azurewebsites.net/how-to-setup-remote-rdp-access-on-an-azure-vm-running-linux-ubuntu-14-04-lts/"&gt;http://colhountechblog.azurewebsites.net/how-to-setup-remote-rdp-access-on-an-azure-vm-running-linux-ubuntu-14-04-lts/&lt;/a&gt; &lt;p&gt;&lt;strong&gt;TIP&lt;/strong&gt;: to use bash and ssh from windows, there are few options: new native Bash on Win10, Git bash, or putty. They all have ssh.&lt;br&gt;Open bash and type this to ssh into new linux vm: &lt;em&gt;ssh -l username IP/DNS name&lt;/em&gt;&amp;nbsp; &lt;p&gt;So please, go ahead, follow those simple steps, I'll wait here. &lt;p&gt;If you're running Azure VM, &lt;strong&gt;firewall&lt;/strong&gt; needs to be configured for RDP:&lt;br&gt;open VM blade, Settings, Network Interface, Settings, Network Security Group, Settings, Inbound Security Rules. There, add rule for destination port 3389. &lt;p&gt;Also, it's useful to assign DNS name to that machine, to avoid using dynamic IP address. &lt;p&gt;You should be able to RDP into the machine now! First time I got some error with "connection error", but I tried again immediately, and was able to RDP and log in into XFCE.  &lt;p&gt;We can now install two apps: &lt;ul&gt; &lt;li&gt; &lt;p&gt;&lt;strong&gt;Midori&lt;/strong&gt; web browser (open terminal, type &lt;em&gt;sudo apt-get install midori&lt;/em&gt;)&lt;/p&gt; &lt;li&gt; &lt;p&gt;&lt;strong&gt;Geany&lt;/strong&gt; text editor (in terminal type &lt;em&gt;sudo apt-get install geany&lt;/em&gt;. It will be installed under /usr/bin folder. If you navigate there with file browser, you can right click to it and choose Send To/Desktop Create Link). Btw, don’t expect code completion, it's just syntax highlighting. And if you feel brave enough, there’s always VIM. Purpose of installing text editor is not to develop an app on web server, but just to edit configuration files! &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Now we should able to open Midori and page &lt;a href="https://www.microsoft.com/net/core#ubuntu"&gt;https://www.microsoft.com/net/core#ubuntu&lt;/a&gt;, and follow steps to install dotnet core. Needless to say, that worked fine for me:)  &lt;p&gt;To create new asp.net app, follow this: &lt;a href="https://aspnet-aspnet.readthedocs-hosted.com/en/latest/getting-started.html"&gt;https://aspnet-aspnet.readthedocs-hosted.com/en/latest/getting-started.html&lt;/a&gt; . Geany text editor can be used now to edit project.json and CS files (or Nano from bash). Check for namespaces when copy-pasting from tutorial, it's probably different from the one created by dotnet new.  &lt;p&gt;Executing &lt;em&gt;dotnet run&lt;/em&gt; will start Kestel, and sample page can be opened in Midori! Happy days! &lt;p&gt;XFCE running with Midori, Kestrel, Geany takes around 70% of 0.75GB RAM, which is OK for playing with new dotnet and even running small-medium websites in production.&amp;nbsp;&amp;nbsp; &lt;p&gt;Next blog post will explain how to put Nginx in front of kestrel, since that's recommended production configuration (that's how node and other platforms are exposed to internet, there is always some reverse proxy in front of platform web server – kestrel doesn't know how to cache, authenticate request, handle https, etc) </content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/.net-core-rc2-is-out-and-where-do-we-go-from-here</id>
    <title type="text">.NET Core RC2 is out and where do we go from here</title>
    <published>2016-05-23T16:12:18+01:00</published>
    <updated>2016-05-23T16:12:18+01:00</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/.net-core-rc2-is-out-and-where-do-we-go-from-here" />
    <content type="text">&lt;p&gt;For the last year or even more I've been waiting for "usable" build, beta, release candidate, whatever, of the new Core .NET framework and tooling support.&amp;nbsp; I played with RC1 and betas before, but always had so much trouble in configuring everything, from configuration of project file to producing DLLs and nugets. Specially figuring out various target framework names and standards (dnxcore, net standard, etc – that’s still a mystery too me mostly!).&amp;nbsp; &lt;p&gt;Also, lot of things have changed along the way. Since whole development process is so public now, we can see all the changes, mistakes, proof of concepts, some more changes, which were happening behind closed door before where we would just get final RTM bits. So there's that price we as community had to pay, going from DNX and DNU to CLI,&amp;nbsp;&amp;nbsp; project.json going away soon, who knows what else ... &lt;p&gt;But I guess, important thing is that framework bits are stable and ready for production use! Runtime, web server (Kestrel, RIP Helios btw), MVC and WebAPI are good to start serious development. Also, Visual Studio for RC2 works fine, which is absolutely necessary for any serious work.&amp;nbsp; &lt;p&gt;Lot of blog posts have been written on this topic already, but I would like to point few things which are important now, for us, normal developers working in some company: &lt;ul&gt; &lt;li&gt;whole new platform to learn &amp;amp; explore: we can now develop on &lt;strong&gt;Mac&lt;/strong&gt;, host on &lt;strong&gt;Linux&lt;/strong&gt;, even run Sql Server on linux! I would say it's a big and important change, going from (not always so) easy-to-use point'n'click server interface to bash command line. It's so serious thing that even Win 10 includes full bash support now! &lt;/li&gt; &lt;li&gt; new tools available on linux: things like &lt;strong&gt;nginx, haproxy&lt;/strong&gt;, which are mandatory for ASP.NET on linux - you shouldn't expose Kestrel to public! Then different databases, from awesome PostgreSql (my bets are on that one, combined with &lt;a href="http://jasperfx.github.io/marten/"&gt;Marten&lt;/a&gt; for NoSql story), &lt;strong&gt;Redis, Cassandra&lt;/strong&gt;, and list goes on ... We have to switch from "IIS application server" mindset to docker style of deployment, with chef and puppet0 for configuration management. That leads naturally to bunch of small services instead of few monolithic one, and that involves service discovery tools like &lt;strong&gt;zookeeper&lt;/strong&gt; and &lt;strong&gt;consul&lt;/strong&gt;.&lt;/li&gt; &lt;li&gt;To be honest, as a .NET dev I was really jealous on all linux-platform devs for last few (10?) years! They had &lt;strong&gt;docker&lt;/strong&gt;, bunch of fancy data stores, mezos, big data tools, bunch of analytics and logging tools (Kibana, Kubernetes) ... while we (windows server centric) developers where totally isolated, there's whole brave new world of tools, frameworks and services emerging and we're still fighting with MsBuild and MsDeploy and Sql Server. I will not even mention MSMQ here. I don't want to find myself in "who moved my cheese" position, and it looks I'm awfully close.&lt;/li&gt; &lt;li&gt;actors. Really important concept, not the silver bullet for every use case, but it has it's place. Microsoft is pushing that also with Azure Service Fabric, with statefull and stateless variants of actors and services. Akka in JVM (java and scala) is quite successful, and even though we had &lt;a href="http://getakka.net/"&gt;Akka.net&lt;/a&gt; it really never became "mainstream" framework. Personally, think it's not the problem with akka.net itself, but with regular-Joe-.net developer, who uses only what MS releases.&amp;nbsp; There's Orleans framework, but it's made for specific use case (Halo game on Azure) and should be avoided for general usage IMHO. &lt;/li&gt; &lt;li&gt;&lt;strong&gt;cloudify&lt;/strong&gt; all the things. Most of the companies where i worked are slowly switching to the cloud. That brings scaling, resiliency, failover to the list of non-functional requirements. Application needs to be designed differently to accommodate almost-certain outage and downtime of a service, and also to control overall costs.&amp;nbsp;&amp;nbsp; &lt;/li&gt;&lt;/ul&gt; &lt;p&gt; What I Like: &lt;ul&gt; &lt;li&gt;new domain &lt;a href="http://dot.net/"&gt;http://dot.net&lt;/a&gt; is totally cool&lt;/li&gt; &lt;li&gt;VS Code, since VS Full + Resharper can be unusably slow sometimes. It will force me to learn how to program without Resharper :)&lt;/li&gt; &lt;li&gt;exposure to Linux&lt;/li&gt; &lt;li&gt;new modular and minimal design of .NET, and whole cross-platform support&lt;/li&gt; &lt;li&gt;attention to performance. Just to show off how "my framework is faster than yours" when talking with other devs. Important stuff.&lt;/li&gt; &lt;li&gt;Xamarin will get proper attention now, when it’s part of the same company. &lt;/li&gt; &lt;li&gt;community standups, great way to hear what’s going on and ask questions &lt;/li&gt;&lt;/ul&gt; &lt;p&gt; What I Don't Like: &lt;ul&gt; &lt;li&gt;changes beta -&amp;gt; rc1 -&amp;gt; rc2. RC2 looks like real beta to me. Think it could be communicated better, in form of; what's todays state, how to install nightly builds and use that with VS Code, what's working and what's not, what are all the "net standard" targets and what the hell do they mean, etc. Community standups are great, but I would like to have one up-to-date web page describing how to setup dev environment and how to pick right target framework&lt;/li&gt; &lt;li&gt;Xamarin and .NET Core – I’m guessing some merging will happen, this way it just doesn’t make sense to have 2 frameworks and runtimes doing almost the same job&lt;/li&gt; &lt;li&gt;VS becoming even more slower. Has many problems with Update 2, had to completely reinstall VS on one machine, and even reinstall whole Windows on another!&lt;/li&gt; &lt;li&gt;whole .NET could be released in more "agile" or incremental way: first core bits, then standard library (one nuget at the time!), then app frameworks like MVC, and so on. So not wait until everything is RTM (framework, web server, libs, tooling, EF, Xamarin, ....) but bunch of small RTMs. Until MVC is RTM, we would have many libraries and frameworks already ported and ready. I think MS is here aiming at regular dark-matter developer who wants the whole package of absolutely everything, but this is framework for next 10y, customer shouldn't be a developer from 2006. &lt;/li&gt; &lt;li&gt;like Json.net become a part of official .net, i would like to see more examples like this: for logging (Serilog?), messaging (EasyNetQ?), database (dapper, marten), architecture (akka.net), where MS officially endorse and support some OSS project. I don't mean full SLA where I can call MS in the middle of the night and ask some crazy question, but more from marketing perspective (if that's even possible or makes sense)&amp;nbsp; &lt;/li&gt; &lt;li&gt;Win 10 issues: forced restarts, burned by those several times. Lack of High DPI support. Not related to .net, but I'm just so angry about this. If high DPI doesn't get fixed soon, I'm switching to Mac book.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;RC2 is out, VS Code and VS Full have full debugging support, there's no excuses any more to try new platform! It's &lt;a href="https://blog.rendle.io/net-core-a-call-to-action/"&gt;a call to action&lt;/a&gt;! &lt;p&gt;Looks like 2016 and 2017 will be years of learning new platforms, environments and tools! Maybe it sounds scary, but I can't wait:)&lt;/p&gt;</content>
  </entry>
  <entry>
    <id>https://hudosvibe.net/post/death-by-thousands-partial-views</id>
    <title type="text">Death by thousands partial views</title>
    <published>2015-11-25T11:35:57Z</published>
    <updated>2015-11-25T11:35:57Z</updated>
    <author>
      <name />
    </author>
    <link rel="alternate" href="https://hudosvibe.net/post/death-by-thousands-partial-views" />
    <content type="text">&lt;p&gt;&lt;strong&gt;IMPORTANT UPDATE:&lt;/strong&gt; &lt;p&gt;&lt;u&gt;It seems I was wrong all the time! Lot of partial views WILL NOT slow down page rendering! &lt;/u&gt; &lt;p&gt;&lt;strong&gt;Profiling tools you use can slow down the application&lt;/strong&gt;! After I disabled Glimpse, time-to-first-byte in Chrome was the same, in optimized version with 10 partial views, as in version with 182 partial views! It seems Glimpse injects some code into MVC execution pipeline to measure timings and who-knows-what, which introduces around 5-10ms per view call.  &lt;p&gt;There’s no simple and quick “turbo button” for you application, unfortunately&lt;img class="wlEmoticon wlEmoticon-sadsmile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Sad smile" src="http://www.hudosvibe.net/posts/files/96eb5964-12c5-41d2-be3a-5cc3763bdd79.png"&gt; But you need to learn how to use development tools, and how to read the results. The devil is in details. &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The old blog post, if you’re interested:&lt;/p&gt; &lt;p&gt;Here goes a quick advice how to speed up performance of your website, at least Time-to-first-byte!  &lt;p&gt;I had a performance problem with one e-commerce web site, where visitor needed to &lt;strong&gt;wait at least 5 seconds&amp;nbsp; &lt;/strong&gt;to see the web page. There were some changes with database server, so my first assumption was the speed of new server.&amp;nbsp; &lt;p&gt;But to verify that, I had to profile page rendering pipeline. The easiest way is installation of &lt;a href="http://getglimpse.com/"&gt;Glimpse&lt;/a&gt; plugin, with EF add-on. After doing that, to my surprise, I saw &lt;strong&gt;database takes less than 10ms&lt;/strong&gt; to return the results, so the devil has to be somewhere else! Going through glimpse Tab, I noticed this horror (here's just the part that fitted into my screen):&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.hudosvibe.net/posts/files/b441ca07-d9d6-43e6-88de-9dc2cf781f59.png"&gt;&lt;img title="partialviewsglimpse" 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="partialviewsglimpse" src="http://www.hudosvibe.net/posts/files/d93b7fec-6c47-45cb-b1c3-8e8f242bff72.png" width="999" height="493"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;There were than 180 partial view calls&lt;/strong&gt; from main page (remember, it's an e-commerce web site, each partial view renders one product. There are 9 categories with 9 products each rendered on the home page, and each product partial view calls another partial view to show some additional information – total of 182 views rendered)! And that took at least 80% of the whole rendering time for that page!  &lt;p&gt;Now when I knew what's the problem, solution was easy, refactor of few Razor views, and rendering time &lt;strong&gt;went from 5-10 secs to under 1 second&lt;/strong&gt; (on my local box went from 2+ secs to around 400ms, on remote VM from 5-10 secs to less than 1 sec). All done by simply reducing number of partial view calls from 180 to 10.  &lt;p&gt;Side note; it makes code uglier, since I don’t have nice encapsulation of each partial view, than can be called from different places, but rather duplicated code in few Razor files. But the business value here is obvious! From development perspective, each &lt;strong&gt;duplicated content&amp;nbsp; &lt;/strong&gt;is well marked with &lt;strong&gt;code comments&lt;/strong&gt;, so when someone modifies the code in one place,&amp;nbsp; he/she will know that code needs to be copied to another location.&amp;nbsp;&amp;nbsp; &lt;p&gt;&lt;a href="http://www.hudosvibe.net/posts/files/1ac41332-83e1-41be-853e-04b915b1965e.png"&gt;&lt;img title="partialviewsglimpse2" 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="partialviewsglimpse2" src="http://www.hudosvibe.net/posts/files/45744bca-67b8-43a1-95bd-4352d983d7ef.png" width="993" height="412"&gt;&lt;/a&gt;  &lt;p&gt;Nice, small and quick optimisation! MVC version I’m using is 5.2.3, but in v6 we can expect some major performance improvements of Razor view engine, so can’t wait to revisit this little test in about half year!  &lt;p&gt;Moral point of the story; measure first, then fix! And definitely use Glimpse if doing any ASP.NET MVC work, it can save you hours of investigation!  </content>
  </entry>
</feed>