Posted by Anuraj on Friday, October 28, 2016 Reading time :1 minute
C# ASP.NET Core Middleware filter Middleware
This post is about a new feature in ASP.NET MVC, Middleware filter. Middleware typically sits in the global request handling pipeline. If you want to apply middleware to a specific controller or action method, you can use this feature. This feature only available with ASP.NET Core MVC 1.1. Long back I created a middleware (HTML Minification Middleware), which helps to minify generated HTML of an action. After few days I got a request to implement configuration options, which helps to exclude certain actions from minification. Now I can use Middleware filters instead of configuring the options.
Posted by Anuraj on Wednesday, October 26, 2016 Reading time :1 minute
C# ASP.NET Core Compression Middleware
This post is about using Response Compression Middleware in ASP.NET Core. Long back I wrote blog post on Enabling GZip Compression in ASP.NET5. It was a custom middleware I implemented in DNX days. Now as part of ASP.NET Core 1.1 Preview 1, Microsoft introduced Response Compression Middleware in ASP.NET Core.
Posted by Anuraj on Tuesday, October 25, 2016 Reading time :1 minute
C# ASP.NET Core WebListener
This post is about using WebListener server in ASP.NET Core. WebListener is a web server for ASP.NET Core based on the Windows Http Server API. WebListener is a Windows-only HTTP server for ASP.NET Core. It runs directly on the Http.Sys kernel driver, and has very little overhead. WebListener cannot be used with the ASP.NET Core Module for IIS. It can only be used independently. Kestrel is designed to be run behind a proxy (for example IIS or Nginx) and should not be deployed directly facing the Internet.
Posted by Anuraj on Thursday, October 13, 2016 Reading time :1 minute
C# ASP.NET Core MySql EF Migrations
This post is about implementing dotnet ef database update command with MySql connector (MySql.Data.EntityFrameworkCore). Few days back I did a post on using MySql in ASP.NET Core. But one problem I found was when calling dotnet ef database update command, the lib was throwing not implemented exception. I had a discussion with @RuAnt, and I found the github repo - https://github.com/mysql/mysql-connector-net. As I got some time today, I thought of exploring the source and implementing the same, if it is not complex. :) So as a first step, I looked into the Sqlite and SqlServer implementations, and from the exception stack, I come to know about the method, which is not implemented.
Posted by Anuraj on Tuesday, October 11, 2016 Reading time :1 minute
C# ASP.NET Core dotnet core StyleCop
This post is about enabling stylecop code analysis on ASP.NET Core applications. StyleCop is an open source static code analysis tool from Microsoft that checks C# code for conformance to StyleCop’s recommended coding styles and a subset of Microsoft’s .NET Framework Design Guidelines. StyleCop analyzes the source code, allowing it to enforce a different set of rules from FxCop (which, instead of source code, checks .NET managed code assemblies). StyleCop Analyzers can be used in dotnet cli projects, including asp.net core. The tooling support is currently not great and the analyzers only run when the project is compiled, and there is currently no way to invoke the code fixes. Stylecop Analyzers will work in ubuntu on coreclr and OSX (probably).
Posted by Anuraj on Saturday, October 1, 2016 Reading time :1 minute
C# ASP.NET Core Scaffolding
This post is about using scaffolding to create ASP.NET Core applications. Scaffolding is a technique supported by some model–view–controller frameworks, in which the programmer can specify how the application database may be used. The compiler or framework uses this specification, together with pre-defined code templates, to generate the final code that the application can use to create, read, update and delete database entries, effectively treating the templates as a scaffold on which to build a more powerful application.
Posted by Anuraj on Sunday, September 25, 2016 Reading time :1 minute
C# ASP.NET Core VSCode dotnet-watch
This post is about integrating Visual Studio Code with dotnet watch to develop ASP.NET Core applications. Visual Studio code is a free-cross platform editor supports development and debugging of ASP.NET Core applications. You can download the VS Code from http://code.visualstudio.com. dotnet watch is .NET Core tool, which helps to developers to compile the code automatically when they save the code. It is the default behaviour of VS2015. To use this feature, first you need to install dotnet-watch tool. Here is my project.json file’s tools section.