<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Simple can be harder than complex]]></title><description><![CDATA[Simple can be harder than complex]]></description><link>https://jens.gheerardyn.be/</link><image><url>https://jens.gheerardyn.be/favicon.png</url><title>Simple can be harder than complex</title><link>https://jens.gheerardyn.be/</link></image><generator>Ghost 2.8</generator><lastBuildDate>Mon, 02 Sep 2024 05:17:26 GMT</lastBuildDate><atom:link href="https://jens.gheerardyn.be/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Your .NET application is not responding, now what?]]></title><description><![CDATA[<p>If your .NET application is no longer responding on production you might want to urgently restart the process. However, if you do that you will lose valuable information into why it got unresponsive.</p><p>Let's collect that valuable information and after that restart the application.</p><p>First of all download a tool</p>]]></description><link>https://jens.gheerardyn.be/your-net-application-is-not-responding-now-what/</link><guid isPermaLink="false">66d43fba81311004abaed903</guid><category><![CDATA[.NET]]></category><category><![CDATA[ProcDump]]></category><category><![CDATA[Crash]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sun, 01 Sep 2024 10:36:12 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2024/09/unresponsive-app.png" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2024/09/unresponsive-app.png" alt="Your .NET application is not responding, now what?"><p>If your .NET application is no longer responding on production you might want to urgently restart the process. However, if you do that you will lose valuable information into why it got unresponsive.</p><p>Let's collect that valuable information and after that restart the application.</p><p>First of all download a tool called <strong>procdump.exe</strong> (you can find it here: <a href="https://learn.microsoft.com/en-us/sysinternals/downloads/procdump">https://learn.microsoft.com/en-us/sysinternals/downloads/procdump</a>) It is a small executable, without installation, that you can use via commandline. <em><strong>Copy the tool to the server. </strong></em></p><p>Before we start: there are some things that you will need: </p><ul><li>Dump Type</li><li>Process ID</li></ul><h2 id="figuring-out-the-dump-type">Figuring out the Dump Type</h2><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2024/09/image.png" class="kg-image" alt="Your .NET application is not responding, now what?"></figure><p>Since you have an unresponsive application and you plan to restart it, and thus don't have a second chance to capture the data, you want a <strong>full dump</strong>.</p><h2 id="figuring-out-the-process-id-">Figuring out the Process ID:</h2><p><em>There are multiple ways to figure out the Process ID, I will leave that up to you.</em></p><h2 id="now-the-command-that-you-want-">Now the command that you want:</h2><blockquote>procdump &lt;dumptype&gt; &lt;process id&gt;</blockquote><p>Example:</p><blockquote>procdump -ma 18228</blockquote><p>The result will look like this: </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2024/09/image-1.png" class="kg-image" alt="Your .NET application is not responding, now what?"></figure>]]></content:encoded></item><item><title><![CDATA[How to configure Entity Framework?]]></title><description><![CDATA[<p>When you are introducing an <a href="https://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> to communicate with your database. You will need to know upfront where in your application your objects will be placed and where the configuration belongs. The objects are represented in the domain layer in the following drawing.</p>
<figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/IMG_1595-2.jpg" class="kg-image" alt="IMG_1595-2"></figure><p>As you can see in the above</p>]]></description><link>https://jens.gheerardyn.be/how-to-configure-entity-framework/</link><guid isPermaLink="false">5c1401f4cb0aac0c3b234111</guid><category><![CDATA[Entity Framework]]></category><category><![CDATA[Domain-Driven Design]]></category><category><![CDATA[DDD]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sun, 12 Aug 2018 13:07:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/entity-framework.png" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/entity-framework.png" alt="How to configure Entity Framework?"><p>When you are introducing an <a href="https://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> to communicate with your database. You will need to know upfront where in your application your objects will be placed and where the configuration belongs. The objects are represented in the domain layer in the following drawing.</p>
<figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/IMG_1595-2.jpg" class="kg-image" alt="How to configure Entity Framework?"></figure><p>As you can see in the above drawing the domain layer is the heart of the application. It should have as few dependencies as possible. This also means that the domain layer should be storage agnostic and have no knowledge about the storage medium or ORM used. Concrete: your domain layer should not know Entity Framework.</p><h4 id="convention">Convention</h4><p>If you just started using Entity Framework you might have noticed that it just seems to work out of the box. That's a good and a bad thing. This means that you can get started pretty fast as everything is configured via conventions. Entity Framework does this by looking at the name of properties and it will try to figure out what you are doing.</p><p>The <strong>risk of using conventions</strong> is that they are <strong>not explicit</strong> and that you have no guarantee that with the next version everything will be working exactly the same. It might be that due to a bug fix something works a little bit different. If you work with conventions you are also not able to rename any property as you have no mapping configured with the database column names. If you give a property a wrong name it will also silently fail as Entity Framework cannot figure out if you wanted it to do something.</p><h4 id="attributes">Attributes</h4><p>Working with the Domain Model is already hard enough. Developers should not be overwhelmed with irrelevant things like the configuration between the ORM and the actual database. When you are working with Domain-Driven Design you are focussing on delivering business value by automating existing processes. This is the only thing you want to focus on in the domain layer.</p><p>Another downside of using attributes is that you cannot combine multiple properties as the attribute is placed above 1 property (if property A has value X than property B cannot have value Y). On top of that your domain layer now has a vendor lock to a specific ORM and/or database technology.</p><h4 id="entitytypeconfiguration-explicit-configuration">EntityTypeConfiguration - Explicit configuration</h4><p>The last and <strong>preferred way</strong> is to use explicit configuration. You know very well what property is mapped to what column and table in your database.</p><p>Entity Framework configurations have an order in which configurations are applied. At first there are conventions for when you do not configure anything, after that you can work with attributes but these have limitations. The final way is to use Entity Type Configurations that also overrules all the previous configurations.</p><p>You only have 1 place to look if you <strong>only</strong> use explicit configuration. If you use attributes you will always have to verify that they are not overridden.</p><p>The place to configure this is the infrastructure code that glues the domain layer and the domain layer together. This might also be the same place where your repositories are located.</p><pre><code>public class StudentEntityConfiguration : EntityTypeConfiguration&lt;Student&gt;
{
      public StudentEntityConfiguration()
      {
      ToTable("StudentInfo");
      HasKey&lt;int&gt;(s =&gt; s.StudentKey);
      Property(p =&gt; p.DateOfBirth)
         .HasColumnName("DoB")
         .HasColumnOrder(3)
         .HasColumnType("datetime2");
      Property(p =&gt; p.StudentName)
         .HasMaxLength(50);
      Property(p =&gt; p.Version)
         .IsConcurrencyToken();
      HasMany&lt;Course&gt;(s =&gt; s.Courses)
         .WithMany(c =&gt; c.Students)
         .Map(cs =&gt;
         {
            cs.MapLeftKey("StudentId");
            cs.MapRightKey("CourseId");
            cs.ToTable("StudentCourse");
         });
   }
}
</code></pre><p>Now you need to tell Entity Framework where to look for these explicit configurations. You do this by adding the configurations to the model builder.</p><pre><code>public class SchoolDBContext: DbContext 
{
   public SchoolDBContext(): base() 
   {
   }

   public DbSet&lt;Student&gt; Students { get; set; }
    
   protected override void OnModelCreating(DbModelBuilder modelBuilder)
   {
      // Moved all Student related configuration to StudentEntityConfiguration class
      modelBuilder.Configurations.Add(new StudentEntityConfiguration());
   }
}</code></pre>]]></content:encoded></item><item><title><![CDATA[When not to use interfaces]]></title><description><![CDATA[<p>Inversion of control was in part introduced to fix the problem of writing tests. How can we write tests, focussed on a small part of our application, if every dependency is instantiated inside the part we are trying to test? Simple. We introduced interfaces so that we were in control</p>]]></description><link>https://jens.gheerardyn.be/when-not-to-use-interfaces/</link><guid isPermaLink="false">5c1400dacb0aac0c3b234102</guid><category><![CDATA[DDD]]></category><category><![CDATA[Testing]]></category><category><![CDATA[Domain-Driven Design]]></category><category><![CDATA[Domain Layer]]></category><category><![CDATA[Application Layer]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sun, 22 Jul 2018 14:02:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/middleman.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/middleman.jpg" alt="When not to use interfaces"><p>Inversion of control was in part introduced to fix the problem of writing tests. How can we write tests, focussed on a small part of our application, if every dependency is instantiated inside the part we are trying to test? Simple. We introduced interfaces so that we were in control of the implementation.</p><p>The goal of writing tests is to ensure your code remains stable when you add or change existing features. In order to reduce the costs of writing tests we started to use interfaces. This enabled us to ignore other, irrelevant parts of the application within a test.</p><p>So an interface is just a contract that contains the signature of methods, properties, events or indexers. It does not contain any implementation. This gives us the freedom to choose the implementation that fits our test the best.</p><h4 id="interfaces-and-domain-driven-design">Interfaces and Domain-Driven Design</h4><p>In an application that is Domain-Driven Design centric you have a domain layer. This part is the heart of your application. It contains state and behaviour and makes sure it remains consistent at all times. It should be storage agnostic and have the least dependencies in your application. The domain does not know about the application layer, it goes inwards. The UI knows the application layer and the application layer knows the domain layer.</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/IMG_1595.jpg" class="kg-image" alt="When not to use interfaces"></figure><p><em><em>Domain is the heart of the application</em></em></p><p>When you are writing tests that involve the heart of your application it makes no sense to fake it. You could ask yourself the question: What am I actually testing? You should be testing your implementation.</p><p>Thus, you shouldn't use any interface inside your domain model. Although any interfaces is maybe a bit exorbitant. What I really mean is: you do not want interfaces like <code>IEntity</code> or <code>IAggregateRoot</code>. As you would give the opportunity for the wrong part of your application to be faked.</p><h4 id="semantically">Semantically</h4><p>An interface defines signatures but no implementations. If a class (or struct) implements an interface it is a can-do relationship. <code>Order : IAggregateRoot</code> An Order can-do IAggregateRoot is meaningless. Inheritance on the other hand defines an is-a relationship. <code>Order : AggregateRoot</code> An Order is-an AggregateRoot.</p><p>As interfaces do not contain any implementation details it would be difficult to reuse certain methods or even properties. What if you want to use a private setter for a property and define it in an interface? It is not possible. As a result the property would be really read-only. <a href="https://docs.microsoft.com/nl-nl/ef/core/modeling/constructors">Entity Framework Core up until version 2.1</a> did not support writing to a property when it only had a getter available.</p><h4 id="attributes-on-interfaces">Attributes on interfaces</h4><p>Another problem with interfaces, although it is not a good idea, is that attributes are not inherited when you implement an interface. If you use a RequiredAttribute to indicate its value is required it will silently fail in your classes.</p><h4 id="application-service">Application Service</h4><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/IMG_1595-1.jpg" class="kg-image" alt="When not to use interfaces"></figure><p><em><em>The yellow circle indicates the boundary of the application service</em></em></p><p>Let's focus on this last part: orchestrating. What would be the consequence of faking this part? You would lose one of the main responsibilities. What you really want to test is the orchestration logic. So that you can fetch the needed information, manipulate it and that your unit of work completes its action successfully. If an email needs to be send you want to be sure the correct code is called the right amount of times with the correct parameters. You don't want to be able to fake this part. What you really want is to fake all its dependencies and verify that these dependencies were all called with the right parameters. So interfaces between layers do make sense, but inside the application layer you might want to avoid them.</p><p><strong>In conclusion:</strong> think about the impact of using interfaces. Are you using them on the right class? Do you want this class to have another implementation via inversion of control? And if tests are not one of your concerns, think about reusability because properties defined on an interface need to be re-implemented all the time...</p>]]></content:encoded></item><item><title><![CDATA[Connecting to SQL Server on macOS using SQL Operations Studio]]></title><description><![CDATA[<p>A new tool emerged and, while it is still in beta, it is already quite handy. When we take a look at the <a href="https://www.microsoft.com/en-us/sql-server/developer-tools">SQL developer tools</a> we will see that Microsoft placed a new tool on the top</p>
<p><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-21-03-35.png" alt="SQL Developer Tools"> <em>Screenshot in case the page is edited.</em></p>
<p><a href="https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is">SQL Operations Studio</a> (preview) is</p>]]></description><link>https://jens.gheerardyn.be/connecting-to-sql-server-on-macos-using-sql-operations-studio/</link><guid isPermaLink="false">5c13ffa5cb0aac0c3b2340f2</guid><category><![CDATA[SQL Operations Studio]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Thu, 07 Dec 2017 20:27:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-21-02-15.png" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-21-02-15.png" alt="Connecting to SQL Server on macOS using SQL Operations Studio"><p>A new tool emerged and, while it is still in beta, it is already quite handy. When we take a look at the <a href="https://www.microsoft.com/en-us/sql-server/developer-tools">SQL developer tools</a> we will see that Microsoft placed a new tool on the top</p>
<p><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-21-03-35.png" alt="Connecting to SQL Server on macOS using SQL Operations Studio"> <em>Screenshot in case the page is edited.</em></p>
<p><a href="https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is">SQL Operations Studio</a> (preview) is a free tool that runs on Windows, macOS, and Linux, for managing SQL Server, Azure SQL Database, and Azure SQL Data Warehouse; wherever they're running. It is open source and you can find it on <a href="https://github.com/Microsoft/sqlopsstudio">Github</a>. Although the current version 0.23 it is already promising and useful.</p><p>If you have read <a href="https://jens.gheerardyn.be/installing-sql-on-macos-without-using-the-command-line/">Installing SQL on macOS without using the command line!</a> you will be able to continue this post and connect to your new database.</p><p>The server name is <code>localhost</code>, since we did not change or specify a username it is still <code>sa</code> and our password is <code>Passw0rd!</code>. Click on <code>Connect</code>.</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-21-14-09.png" class="kg-image" alt="Connecting to SQL Server on macOS using SQL Operations Studio"></figure><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-21-02-15-1.png" class="kg-image" alt="Connecting to SQL Server on macOS using SQL Operations Studio"></figure>]]></content:encoded></item><item><title><![CDATA[Installing SQL on macOS without using the command line!]]></title><description><![CDATA[<p>Let us explore how easy it is to install <a href="https://hub.docker.com/r/microsoft/mssql-server-linux/">SQL Server 2017 on macOS</a> by using <a href="https://docs.docker.com/docker-for-mac/">Docker</a>. Let me prove to you how easy it is to install SQL Server 2017 on macOS by prohibiting myself from using the command line. We will use <strong>Docker</strong> and <strong>Kitematic</strong>.</p><p><strong>The first step</strong></p>]]></description><link>https://jens.gheerardyn.be/installing-sql-on-macos-without-using-the-command-line/</link><guid isPermaLink="false">5c13fe6bcb0aac0c3b2340e4</guid><category><![CDATA[SQL Server on Mac]]></category><category><![CDATA[SQL]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Thu, 07 Dec 2017 20:24:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-20-03-09.png" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-20-03-09.png" alt="Installing SQL on macOS without using the command line!"><p>Let us explore how easy it is to install <a href="https://hub.docker.com/r/microsoft/mssql-server-linux/">SQL Server 2017 on macOS</a> by using <a href="https://docs.docker.com/docker-for-mac/">Docker</a>. Let me prove to you how easy it is to install SQL Server 2017 on macOS by prohibiting myself from using the command line. We will use <strong>Docker</strong> and <strong>Kitematic</strong>.</p><p><strong>The first step</strong> is to <a href="https://docs.docker.com/docker-for-mac/install/">install Docker</a>, once you have finished that step we need to increase the memory. SQL Server 2017 needs at least 2 GB of RAM (3.25 GB prior to 2017-CU2).</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-19-53-38.png" class="kg-image" alt="Installing SQL on macOS without using the command line!"></figure><p><br><em>To be in the clear and to avoid having issues increase the memory to something like 4 GB, although the default value of 2 GB should be sufficient.</em></p><p><strong>Step 2</strong> is to pull and install the Docker Image.<br>Pulling the <a href="https://hub.docker.com/r/microsoft/mssql-server-linux/">Docker image</a> is something we can do by using Kitematic. When you click on the Docker icon in the menu bar you should see Kitematic, click on it and it should download the Kitematic app.</p><p>Click on <code>New</code> next to Containers in the left hand corner and search for <code>microsoft/mssql-for-linux</code> and click on <code>create</code>. </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-20-19-04.png" class="kg-image" alt="Installing SQL on macOS without using the command line!"></figure><p>After that the image should start to download:</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-19-57-50.png" class="kg-image" alt="Installing SQL on macOS without using the command line!"></figure><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-20-00-55.png" class="kg-image" alt="Installing SQL on macOS without using the command line!"></figure><p>The output window is not accepting user input so we need to put some environment flags in place. Set the following <code>environment variables</code>:<br>ACCEPT_EULA = Y</p><p>SA_PASSWORD = Passw0rd!</p><p>MSSQL_PID = Developer</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-20-39-23.png" class="kg-image" alt="Installing SQL on macOS without using the command line!"></figure><p> click on <code>save</code> and hit back to the <code>Home</code> tab.</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-12-07-at-20-52-20.png" class="kg-image" alt="Installing SQL on macOS without using the command line!"></figure><p><strong>Step 4</strong> Profit!</p><p>You are finished, nothing else to do. It is even easier than installing the default windows version.</p><p><strong>Step 5</strong> <a href="https://jens.gheerardyn.be/connecting-to-sql-server-on-macos-using-sql-operations-studio/">Connect to your database</a></p>]]></content:encoded></item><item><title><![CDATA[Getting started: ASP.NET Core 2.0 with Visual Studio for Mac]]></title><description><![CDATA[<h2 id="installing-prerequisites">Installing prerequisites</h2><p>Microsoft made it very easy to get started. We need 2 prerequisites to get it up and running. Download the following installers:</p><ul><li><a href="https://dot.net/core">https://dot.net/core</a></li><li><a href="https://www.visualstudio.com/vs/visual-studio-mac/">https://www.visualstudio.com/vs/visual-studio-mac/</a></li></ul><h3 id="installing-net-core">Installing .NET Core</h3><h4 id="introduction">Introduction</h4><p>Click 'Continue' </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-50-08.png" class="kg-image"></figure><h4 id="destination-select">Destination select</h4><p>Select your preferred Hard Drive  </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-52-10.png" class="kg-image"></figure><h4 id="installation-type">Installation type</h4><p>Click</p>]]></description><link>https://jens.gheerardyn.be/getting-started-asp-net-core-2-0-with-visual-studio-for-mac/</link><guid isPermaLink="false">5c13fb44cb0aac0c3b2340bd</guid><category><![CDATA[ASP.NET Core]]></category><category><![CDATA[.NET Core]]></category><category><![CDATA[Installation]]></category><category><![CDATA[Visual Studio for Mac]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sat, 23 Sep 2017 13:36:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/developMac2.png" medium="image"/><content:encoded><![CDATA[<h2 id="installing-prerequisites">Installing prerequisites</h2><img src="https://jens.gheerardyn.be/content/images/2018/12/developMac2.png" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"><p>Microsoft made it very easy to get started. We need 2 prerequisites to get it up and running. Download the following installers:</p><ul><li><a href="https://dot.net/core">https://dot.net/core</a></li><li><a href="https://www.visualstudio.com/vs/visual-studio-mac/">https://www.visualstudio.com/vs/visual-studio-mac/</a></li></ul><h3 id="installing-net-core">Installing .NET Core</h3><h4 id="introduction">Introduction</h4><p>Click 'Continue' </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-50-08.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h4 id="destination-select">Destination select</h4><p>Select your preferred Hard Drive  </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-52-10.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h4 id="installation-type">Installation type</h4><p>Click 'Install'</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-51-15.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h4 id="installation">Installation</h4><p>Enter your password</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-54-39.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h4 id="summary">Summary</h4><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-14-57-42.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="installing-visual-studio-for-mac">Installing Visual Studio for mac</h3><p>Click on the big circle</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-22-13.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="accept-warning-application-downloaded-from-the-internet">Accept warning "application downloaded from the internet"</h3><p>Click "Open"</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-23-08.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="thank-you-for-downloading-visual-studio">Thank you for downloading Visual Studio</h3><p>Press "Continue" </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-24-23.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="some-features-require-xcode">Some features require Xcode</h3><p>These features are related to Xamarin and building iOS apps. You can  safely skip this. If you do need them you can rerun the installer and  select them afterwards.  </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-26-24.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="what-would-you-like-to-install">What would you like to install</h3><p>We only need <strong>Visual Studio</strong> and the tools. I already installed Android and iOS on my machine.  </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-29-30.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="downloading-and-installing-">Downloading and installing...</h3><p>Enter your credentials  </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-31-39.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="installation-successful">Installation successful</h3><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-33-09.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h2 id="getting-started">Getting started</h2><h3 id="start-visual-studio-for-mac">Start Visual Studio for mac</h3><p>Click the purple "New Project..." button underneath Recent. </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-22-at-15-45-46-1.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="choose-a-template-for-your-new-project">Choose a template for your new project</h3><p>Select .NET Core followed by the project type you prefer. In this example "ASP.NET Core Web App"  </p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-22-at-15-59-30-1.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="configure-your-new-asp-net-core-web-app">Configure your new ASP.NET Core Web App</h3><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-16-39.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="start-the-application">Start the application</h3><p>Just press the 'Play' button next to Debug at the top left.</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-18-46.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h3 id="watch-the-result-in-your-browser">Watch the result in your browser</h3><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/Screen-Shot-2017-09-23-at-15-20-19.png" class="kg-image" alt="Getting started: ASP.NET Core 2.0 with Visual Studio for Mac"></figure><h2 id="enjoy">Enjoy</h2>]]></content:encoded></item><item><title><![CDATA[ASP.NET Core SignalR - what has changed?]]></title><description><![CDATA[<h2 id="what-is-signalr">What is SignalR?</h2><p>It is a <a href="https://github.com/aspnet/SignalR">library</a> for <a href="https://github.com/aspnet/home">ASP.NET Core</a> developers to send realtime messages from server to the client and vice versa. <a href="https://en.wikipedia.org/wiki/Duplex_(telecommunications)#Full_duplex">Full duplex</a> communication with 2 parties performing <a href="https://en.wikipedia.org/wiki/Remote_procedure_call">RPC</a> operations on each other.</p><h2 id="what-changed">What changed?</h2><ul><li>jQuery is removed as a dependency, a new javascript client is created</li></ul>]]></description><link>https://jens.gheerardyn.be/asp-net-core-signalr-what-has-changed/</link><guid isPermaLink="false">5c13fad0cb0aac0c3b2340b5</guid><category><![CDATA[ASP.NET Core]]></category><category><![CDATA[SignalR]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Fri, 22 Sep 2017 19:00:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/signalr-logopng.png" medium="image"/><content:encoded><![CDATA[<h2 id="what-is-signalr">What is SignalR?</h2><img src="https://jens.gheerardyn.be/content/images/2018/12/signalr-logopng.png" alt="ASP.NET Core SignalR - what has changed?"><p>It is a <a href="https://github.com/aspnet/SignalR">library</a> for <a href="https://github.com/aspnet/home">ASP.NET Core</a> developers to send realtime messages from server to the client and vice versa. <a href="https://en.wikipedia.org/wiki/Duplex_(telecommunications)#Full_duplex">Full duplex</a> communication with 2 parties performing <a href="https://en.wikipedia.org/wiki/Remote_procedure_call">RPC</a> operations on each other.</p><h2 id="what-changed">What changed?</h2><ul><li>jQuery is removed as a dependency, a new javascript client is created and can be found on npm;</li><li>SignalR no longer supports auto-reconnect and is no longer durable as these were features for long polling;</li><li>There is no longer hub state, the hub state needed to be passed around when something changed;</li><li>No more multiple hubs per endpoint. In earlier versions SignalR they used long polling from the ground up because web sockets were not as widely supported as now;</li><li>No more single-model, scale-out. This made scaling harder when you have clients directly communicating with each other, resulting in you not having control over the model;</li><li>No more multi-server ping-pong. Earlier when you had multiple servers every message was send to every server so that they could dispatch it. Now you need a sticky sessions.</li></ul><h2 id="what-is-new">What is new?</h2><ul><li>Binary data support, e.g. send/receive binary data;</li><li>Host-agnostic (enables non-HTTP transport);</li><li>All-new connection-level “Endpoints” API;</li><li>Multiple protocols/formats support, e.g. JSON, ProtoBuf, custom;</li><li>Support “pure” WebSocket clients, you can use any WebSocket client without having to use the SignalR client;</li><li>Return results from client method invocations;</li><li>TypeScript client;</li><li>Flexible scale-out extensibility.</li></ul><h3 id="durable-vs-persisted-vs-realtime">Durable vs Persisted vs Realtime</h3><p>SingalR now only supports realtime messaging and has dropped support for durable subscriptions.</p><h4 id="durable">Durable</h4><p>When you have 1 producer and several consumers, you typically let the producer send a message to a topic. That topic then has multiple queues (1 queue per consumer) subscribed. Durable here means that the messages are stored when a consumer is offline. Once the consumer is back online it continues processing the messages.</p><h4 id="persisted">Persisted</h4><p>When a server restart is required the messages are stored on disk. For durable messages to survive a server restart they need to be persisted as well.</p><h4 id="realtime">Realtime</h4><p>Durable and persisted messages come with a heavy I/O cost. SignalR does in contrast with previous versions not work with durable subscriptions. The focus is shifted towards being light weight and realtime.</p><h2 id="getting-started">Getting started</h2><p>Read: "ASP.NET Core SignalR - Getting started on macOS"</p>]]></content:encoded></item><item><title><![CDATA[How do you protect your company against known vulnerabilities?]]></title><description><![CDATA[<p>How do you protect your company against known vulnerabilities? It starts by having an inventory of all the software, client-side and server-side, that you are using (including plugins) and its dependencies and having it continuously updated. Make sure there is a centralized list that has the knowledge of all software</p>]]></description><link>https://jens.gheerardyn.be/how-do-you-protect-your-company-against-known-vulnerabilities/</link><guid isPermaLink="false">5c13fa37cb0aac0c3b2340ad</guid><category><![CDATA[Security]]></category><category><![CDATA[Applications]]></category><category><![CDATA[Automation]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Mon, 17 Apr 2017 16:19:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/DHS_Seal_Hi-Res.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/DHS_Seal_Hi-Res.jpg" alt="How do you protect your company against known vulnerabilities?"><p>How do you protect your company against known vulnerabilities? It starts by having an inventory of all the software, client-side and server-side, that you are using (including plugins) and its dependencies and having it continuously updated. Make sure there is a centralized list that has the knowledge of all software and the versions installed. The list should be updated autonomously and automatically. Otherwise, you might get the chance of having an outdated list. If somebody is unavailable and somebody else updates something or forgets to update something then that's the beginning of a problem. Make sure the list can update itself otherwise you have no guarantee that your list is up-to-date.</p><p>Now that you have a list and know what to look out for you can be on the lookout. Use software composition analysis tools to automate the process of continuously monitoring sources like the <a href="https://nvd.nist.gov/">National Vulnerability Database</a>. This way you prevent your company from being dependent on a person or team that reads the latest vulnerabilities. What if they miss something? What if they unexpectedly unavailable? What if...? You have an automated solution that notifies you the moment a vulnerability sees the daylight.</p>]]></content:encoded></item><item><title><![CDATA[Virtual patch - Protect yourself against a zero-day vulnerability]]></title><description><![CDATA[<p>How will you handle a security problem that is reported to you, will you wait for the fix (internal or external) or do you want to immediately protect yourself from the issue? What if you know there is a zero-day exploit out there? What if it takes a couple of</p>]]></description><link>https://jens.gheerardyn.be/virtual-patch-protect-yourself-against-a-zero-day-vulnerability/</link><guid isPermaLink="false">5c13f9a9cb0aac0c3b2340a5</guid><category><![CDATA[Security]]></category><category><![CDATA[Developing]]></category><category><![CDATA[Applications]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Mon, 17 Apr 2017 15:54:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/BAND-AID.png" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/BAND-AID.png" alt="Virtual patch - Protect yourself against a zero-day vulnerability"><p>How will you handle a security problem that is reported to you, will you wait for the fix (internal or external) or do you want to immediately protect yourself from the issue? What if you know there is a zero-day exploit out there? What if it takes a couple of days to fix a security problem?</p><p>To be able to respond to security issues add an extra layer in front of your web application. This means that your web application does not accept direct connections. It does not accept machine to machine connections, it accepts process to process connections. By installing an additional layer you<br>can filter the requests that come in and prevent them from reaching your application directly. You have the possibility to protect yourself against a known vulnerability while the problem itself is not patched yet. You can do this by installing a <a href="https://www.owasp.org/index.php/Virtual_Patching_Best_Practices">virtual patch</a>. In short, you install an active filter that blocks known vulnerabilities until a permanent solution is available.</p><p>Pay attention when you are using virtual patches:</p><ul><li> There is a risk that you are addressing some parts of the vulnerability but not all of them. </li><li> There is a risk that you forgot to implement the virtual patch on all the places that needed it. </li><li> The company loses the incentive to update to the permanent solution, thinking it is safe. It is possible that the vulnerability gets wider while it is in the open, for example by combining multiple exploits/vulnerabilities. </li><li> A virtual patch is a temporary solution, make sure there is a protocol in place to follow up when a permanent solution is in place. There is a chance that it might be forgotten. </li></ul>]]></content:encoded></item><item><title><![CDATA[ValueObjects as a security solution]]></title><description><![CDATA[<p>If you need to validate data it might be a good idea to keep the validation as close as possible to the data. If a string comes in that represents a VIN number, wrap it inside a class and only use one entry point to make it easier to validate.</p>]]></description><link>https://jens.gheerardyn.be/valueobjects-as-a-security-solution/</link><guid isPermaLink="false">5c13f91dcb0aac0c3b23409e</guid><category><![CDATA[Security]]></category><category><![CDATA[Value Objects]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Wed, 05 Apr 2017 13:13:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/e5a7ca3d1b9367d321544f663b586abb_L.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/e5a7ca3d1b9367d321544f663b586abb_L.jpg" alt="ValueObjects as a security solution"><p>If you need to validate data it might be a good idea to keep the validation as close as possible to the data. If a string comes in that represents a VIN number, wrap it inside a class and only use one entry point to make it easier to validate.</p><p>Let's say you are working for a car brand. In this case it might not be unreasonable to think that you are using the VIN number from the car as an identifier for the car. There might be several parts of our application interested in the VIN number, maybe for different reasons, for example: aftercare, dealers, insurance, ... The first thing that a part of our application will do is validate that the VIN number is valid. Why should we repeat ourselves in every part of the application and have the chance of forgetting to implement this check somewhere? We could create a VIN number value object with the validation built-in and pass it around in our application. Now let's say there comes an extension to how a VIN number looks like, this will cause you to have to search through the code for every occurrence and modify it. If it was already validated (and not forgotten to be implemented) and if we happen to find every occurrence (nothing says that it was implemented in the same way everywhere). By centralizing it you have less maintenance costs.</p><p>The previous sample was not really related to security (although it covered a bit of data security). It just showed that it could be handy to keep the validation as close as possible to the data. Time for another example: suppose you are working for a webshop now. Some parts might seem very trivial but might have a tricky outcome if they are implemented wrong. The flow for an order might be that an order with order items comes in. The order items might have an amount and an identifier for the product. Now let's zoom in on the amount. People should never be able to order a negative amount of order items. This would mean that we would owe the customer money and the customer would owe us a product. This was not foreseen in our business plan so we want to avoid it from ever happening. It might be a good idea to use an amount value object where you validate that the amount is a positive and natural number. This might seem weird to do for something trivial but the same amount that came into the system will be passed onto the stock management system, to the billing department and maybe to a customer care system, ... These systems could be part of our application. To be able to be consistent we would need to repeat ourselves on all these places and it is very easy to skip one place. Working with value objects makes it so much easier for everybody developing on the system because it is something less to actively think about.</p>]]></content:encoded></item><item><title><![CDATA[Traditional security approach when developing applications]]></title><description><![CDATA[<p>In a traditional approach, we think of security as something very explicit. Think of tasks that would be prioritized and implemented. We then probably look at the following list: attack vectors, 0-day exploits, web vulnerabilities, OWASP to create our backlog. Afterwards we would prioritize the backlog.</p><p>This way of working</p>]]></description><link>https://jens.gheerardyn.be/traditional-security-approach-when-developing-applications/</link><guid isPermaLink="false">5c13f8aacb0aac0c3b234097</guid><category><![CDATA[Security]]></category><category><![CDATA[Applications]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sun, 02 Apr 2017 17:47:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/IoT_Security_BlogPost-01-640x314.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/IoT_Security_BlogPost-01-640x314.jpg" alt="Traditional security approach when developing applications"><p>In a traditional approach, we think of security as something very explicit. Think of tasks that would be prioritized and implemented. We then probably look at the following list: attack vectors, 0-day exploits, web vulnerabilities, OWASP to create our backlog. Afterwards we would prioritize the backlog.</p><p>This way of working has the shortcoming of not being future proof. We focus our attention to known security problems and we try to mitigate them today. It also has the disadvantage of having your developers and everybody involved actively and explicitly thinking about security. Sometimes a problem is so difficult that it is very hard to actively think about security, somebody might forget something. Everybody involved in the project also needs to be a security specialist, everything we do has an impact on security. If we would change something in the project you would need to know what the security impact is for that particular change. This also means that we need to be aware of every concept into the application.</p>]]></content:encoded></item><item><title><![CDATA[Why using AutoMapper for DTO to Entity mapping is a bad idea]]></title><description><![CDATA[<h5 id="conceptualview">Conceptual view</h5>
<p>Why is using AutoMapper for DTO to Entity mapping a bad idea? AutoMapper does its job by using reflection. When you use reflection you divert from the normal path and you manipulate data that you potentially shouldn't. In other words: we enable our domain model to be mutable</p>]]></description><link>https://jens.gheerardyn.be/why-using-automapper-for-dto-to-entity-mapping-is-a-bad-idea/</link><guid isPermaLink="false">5c13f66bcb0aac0c3b234080</guid><category><![CDATA[Consistency]]></category><category><![CDATA[AutoMapper]]></category><category><![CDATA[DDD]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sun, 02 Apr 2017 17:27:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/consistently-inconsistent.jpg" medium="image"/><content:encoded><![CDATA[<h5 id="conceptualview">Conceptual view</h5>
<img src="https://jens.gheerardyn.be/content/images/2018/12/consistently-inconsistent.jpg" alt="Why using AutoMapper for DTO to Entity mapping is a bad idea"><p>Why is using AutoMapper for DTO to Entity mapping a bad idea? AutoMapper does its job by using reflection. When you use reflection you divert from the normal path and you manipulate data that you potentially shouldn't. In other words: we enable our domain model to be mutable from everywhere. This makes it very hard to track down from where in the code a certain property can be modified. This drills down to how will you write tests if anything from anywhere can modify properties? Which part of your application will be responsible for enforcing the business rules. How can we ensure that we are in a consistent state?</p>
<h5 id="inconsistentstate">Inconsistent state</h5>
<p>If every part of your application can change properties directly in your domain model you lose the possibility to validate domain logic. Let's say we are working with triangles. When we receive an instance of a TriangeDto class we want to be sure that the values are consistent. We know that our triangle is valid if the sum of all the angles is 180°. How can we be 100% that the sum will always be 180? We can't. Because we allowed AutoMapper to make changes in such a way that they are invisible.</p>
<p>Another example is conditional logic. When you set the value of a property you don't have the value of other properties available (in the setter of a property). You cannot enforce that when property X has value A that property Y cannot/should/could have value B.</p>
<p>Thirdly, when you want to reuse domain logic inside a class (e.g. value object) you can never be sure that the logic in the class was used and not bypassed by AutoMapper (by directly setting the value of a property, while the property used a private setter). For example, when you place an order you want to be sure that the amount is a positive or natural number.<br>
If you use a value object with validation then you are always sure that when you get an instance of that class, the values are correct. E.g. The amount is non-negative, correct ISBN number or a correct VIN number. See: <a href="https://jens.gheerardyn.be/valueobjects-as-a-security-solution/">ValueObjects as a security solution</a></p>
<p>Fourth, all your access paths are visible if you use constructors or factory methods (method on the same class, calling a private constructor), it also makes it easier to test. You can trace down from where the domain was called. It all comes down to: preventing the domain from becoming inconsistent.</p>
<h5 id="technicalview">Technical view</h5>
<p>If you use an ORM like Entity Framework you will lose change tracking. Instead of using a tracked instance you are forcefully creating a new instance via reflection. This will become a real issue when you have relationships between entities. Your ORM will recreate all the navigation properties and the primary keys will collide (if you are lucky: meaning your problem becomes visible). It will always add a new child instead of updating it.</p>
<h5 id="authorsopinion">Author's opinion</h5>
<h6 id="whatistheopinionofjimmybogardtheauthorofautomapper">What is the <a href="https://lostechies.com/jimmybogard/2009/09/18/the-case-for-two-way-mapping-in-automapper/">opinion</a> of Jimmy Bogard (the author of AutoMapper)?</h6>
<blockquote>
<p>There is no two-way mapping because we never need two-way mapping.  There was a point very early on where we were at a critical junction, and could decide to do two-way mapping.  But we didn’t.  Why?  Because then our mapping layer would influence our domain model.  I strongly believe in POCOs, and a very writeable domain model meant that POCOs were out.  What exactly would two-way mapping do to our domain layer?</p>
<ul>
<li>Force mutable, public collection , like “public EntitySet<category> Categories { get; }” &lt;- NO.</category></li>
<li>Make testing much, much harder, as we only ever wanted to update a portion of a domain model</li>
<li>Force our domain model to be mutable everywhere<br>
So my question to those wanting two-way mapping:</li>
<li>What scenarios are you looking at doing two-way mapping?</li>
<li>What impact would two-way mapping have on the originating source type?</li>
<li>How would you test two-way mappings?</li>
</ul>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Security is a concern, not a feature]]></title><description><![CDATA[<p>Security is way too often seen as a feature instead of a concern. We should <strong>not</strong> put security on the backlog as features.</p><p>Although if we take a look at the backlog we might see some items that are actually security features, these are security features addressing a specific security</p>]]></description><link>https://jens.gheerardyn.be/security-is-a-concern-not-a-feature/</link><guid isPermaLink="false">5c13f60dcb0aac0c3b234078</guid><category><![CDATA[Security]]></category><category><![CDATA[Concern]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sat, 01 Apr 2017 14:10:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/concern-fial.png" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/concern-fial.png" alt="Security is a concern, not a feature"><p>Security is way too often seen as a feature instead of a concern. We should <strong>not</strong> put security on the backlog as features.</p><p>Although if we take a look at the backlog we might see some items that are actually security features, these are security features addressing a specific security problem. A login page is used because of a concern that people should only see their own data. "We are concerned that people should only see their data."</p><p>Looking at security as a feature might also introduce the following problem: What if added to the previous feature: "we also want the customer to be able to download his data, instead of only seeing it. We also want this to be fast". The result of this extension can be that the team choses to work with physical files. Nobody in the team thought about the security impact and they forgot the lock the physical files away and if a filename pattern emerges people might start to guess and download the data of others.</p><p>If we translate this into the real world outside of an IT context we could say that in order to be burglarproof we need a good (expensive) lock. We could add this as a product backlog item and once installed we are good. Or are we? Did we upgrade the hinges as well? No? How did we miss this? Because we described adding the lock as a feature and were lost into thinking about features. We started in a good way, we wanted to be burglarproof and then decided to implement a feature that was not adequate. The concern for security was not met. If we kept looking at it as a concern we could have seen that the hinges also needed to be replaced. We could question who would need a new key and make an inventory of the keys.</p><p>Additionally, another reason why we should not look at security as features: Features are prioritized and unfortunately security is often not seen as adding direct business value and therefore it gets lowered in priority for another item.</p>]]></content:encoded></item><item><title><![CDATA[Debug commands in the Package Manager Console]]></title><description><![CDATA[<p>When you are using Entity Framework migrations you will probably use the <a href="https://docs.microsoft.com/nl-nl/nuget/tools/package-manager-console">Package Manager Console</a> to execute commands like <a href="http://www.mortenanderson.net/code-first-migrations-for-entity-framework">update-database</a>.</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/pmc.PNG" class="kg-image" alt="Package Manager Console in Visual Studio"></figure><p>Now the question arises: how can I debug my code if I am not debugging it via Visual Studio. Add the following line to your code and you will get</p>]]></description><link>https://jens.gheerardyn.be/debug-commands-in-the-package-manager-console/</link><guid isPermaLink="false">5c13f537cb0aac0c3b23406c</guid><category><![CDATA[.NET]]></category><category><![CDATA[Debugging]]></category><category><![CDATA[Package Manager Console]]></category><category><![CDATA[Entity Framework]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Wed, 01 Mar 2017 17:24:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/Consumer-Packaging.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/Consumer-Packaging.jpg" alt="Debug commands in the Package Manager Console"><p>When you are using Entity Framework migrations you will probably use the <a href="https://docs.microsoft.com/nl-nl/nuget/tools/package-manager-console">Package Manager Console</a> to execute commands like <a href="http://www.mortenanderson.net/code-first-migrations-for-entity-framework">update-database</a>.</p><figure class="kg-card kg-image-card"><img src="https://jens.gheerardyn.be/content/images/2018/12/pmc.PNG" class="kg-image" alt="Debug commands in the Package Manager Console"></figure><p>Now the question arises: how can I debug my code if I am not debugging it via Visual Studio. Add the following line to your code and you will get asked which visual studio instance you would like to use to debug.</p><pre><code>Debugger.Launch();</code></pre>]]></content:encoded></item><item><title><![CDATA[DateTime is nondeterministic  - make DateTime testable]]></title><description><![CDATA[<p>How do you make DateTime testable in .NET? Once you use <code>DateTime.UtcNow</code> in the body of a method and you did not pass it as a parameter you no longer have control over DateTime.</p><p>In order to gain control you should wrap DateTime.UtcNow inside an implementation of an</p>]]></description><link>https://jens.gheerardyn.be/datetime-is-nondeterministic-make-datetime-testable/</link><guid isPermaLink="false">5c13f459cb0aac0c3b234062</guid><category><![CDATA[.NET]]></category><category><![CDATA[Unit Tests]]></category><category><![CDATA[DateTime]]></category><dc:creator><![CDATA[Jens Gheerardyn]]></dc:creator><pubDate>Sun, 26 Feb 2017 16:51:00 GMT</pubDate><media:content url="https://jens.gheerardyn.be/content/images/2018/12/112117_EC_arrow-of-time_main_FREE.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://jens.gheerardyn.be/content/images/2018/12/112117_EC_arrow-of-time_main_FREE.jpg" alt="DateTime is nondeterministic  - make DateTime testable"><p>How do you make DateTime testable in .NET? Once you use <code>DateTime.UtcNow</code> in the body of a method and you did not pass it as a parameter you no longer have control over DateTime.</p><p>In order to gain control you should wrap DateTime.UtcNow inside an implementation of an interface.</p><pre><code>public interface IUtcDateTime
{
   DateTime UtcNow { get;  }
}

public class UtcDateTime : IUtcDateTime
{
    public DateTime UtcNow { get; } =&gt; DateTime.UtcNow;
}
</code></pre><p>Now you can let IUtcDateTime be injected by your Depency Injection framework of your choice and write unit tests. An additional benefit is that you are sure that the right usage of DateTime is used. In larger projects it becomes harder to spot mistakes like <code>DateTime.Now</code> vs <code>DateTime.UtcNow</code>.</p>]]></content:encoded></item></channel></rss>