How the ASP.NET team made the web framework I have always wanted
.NET 4x is the current generation of the application model. Made over 15 years ago, it makes a lot of assumptions about development that are not true today. No builtin dependency injection, and the ASP.NET pipeline being baked into IIS, it is less than fun to work with.
So the first huge gripe for me in asp 4.x land is when I go file->New I get a project that has bootstrap from nuget. The first time I saw this I was fine with it, however as bower got more mature I really started to hate it. You can’t delete the js file and restore it at build time so you have to add toxicity to your git repo by holding onto the file.
I’m not going to go into too much detail on this, but if you have worked in .net at all you know the pains of webapi and MVC. Webapi was a separate framework that looked really similar as MVC to host rest APIs. They had similar functionality with action filters, but when you would try to use a webapi actionfilter for MVC you wouldn’t be able to without your class inheriting from both interfaces and thus requiring additional work. They had very similar models but ultimately different implementations and namespaces making working with them both a pain.
I am a long time Linux guy. I love having tail, grep, awk, sed, and the various other tools that come by default in the bourne shell. I often enjoy using zsh. I really wanted to love .NET, because I really do enjoy writing C#, but not supporting linux was a huge bummer for a long time. My coworker and I had a site about mono and how to get started. We were self hosting Nancy in Nginx and it was awesome, but we couldn’t use anything that didn’t have great support at work. When containers started to get big, all my colleagues writing Java were showing me their ECS clusters while I was (and still am) over here hoping that IIS would install under 2 minutes in EC2. I have many problems with windows, beyond those gripes, but I won’t go into them here. To say the least I will be keeping ubuntu on my machine from now on.
.NET 5 is a huge reboot over the existing application model. Self hosting on a web server called Kestrel This application model has many distinctions which I always wanted.
The whole thing is built on one simple philosophy, and this philosophy I LOVE. This is that if you want something you can include it, if you don’t want something you can exclude it. For example if you really want static files then include the static files package, if you don’t then don’t include it. This approach allows people to really juice the performance of their application, and was the basis for NodeJS development. Also with MacOS and Linux support, your choice has now extended past Windows.
The Application Model has a built in dependency injector that works very well. If you need something get it from the DI container. If you controllers need things just have a constructor that requires those types, the DI container will take care of it for you. No more downloading Autofac and messing around trying to set that kind of thing up.
So its 5pm on a friday. I have just added a file to my project, git committed, and the build failed. I go and realize that I forgot to save my csproj file and thus the build is missing a file. This happens to me more than I dare to admit. In the future everything works off the local disk, no more csproj xml, thus no more failed builds for ceremonious xml files.
Overall the future looks really bright for .NET I really hope they can escape the mentality of .NET == windows and hopefully get some more traditional Linux people on the stack.