Lazy Sunday with .NET 5

Lazy Sunday with .NET 5

It was a Sunday afternoon and I wanted to play with some of the new features of .NET 5 and learn something. I had a small irritation with bit.ly. When I customized a short-URL, I could never go back and update the link. That was enough for me to want to make something.

It was a Sunday afternoon and I wanted to play with some of the new features of .NET 5 and learn something. I had a small irritation with bit.ly. When I customized a short-URL, I could never go back and update the link. That was enough for me to want to make something.

I also had a couple of things I wanted to learn, so two birds...one stone:

  • Use VS Code for C## project from scratch.
  • Play with C## 9's top-level statements.
  • Use Cosmos's Table storage.
  • Do something simple without invoking MVC, Razor Pages or anything.

First thing I did was start a new .NET Core project from the command-line:

> dotnet new web

Opening up Visual Studio Code told me I had the minimal ASP.NET Core project. I deleted the Startup.cs entirely. I opened up the Program.cs and deleted everything again. I started with the basics:

Host.CreateDefaultBuilder(args)
  .ConfigureWebHostDefaults()
  .Start();

I had to add a using statement, but now I had a completely active project (though it didn't do anything but return 404's):

using Microsoft.AspNetCore.Hosting;

Host.CreateDefaultBuilder(args)
  .ConfigureWebHostDefaults()
  .Start();

I created a simple class called LinkManager to deal with the actual work. But to get it to work, I had to configure much of what I would normally do in Startup.cs by hand (this isn't what you should do, just what I did):

Host.CreateDefaultBuilder(args)
  .ConfigureWebHostDefaults(bldr =>
  {

    bldr.ConfigureServices(svc =>
    {
      svc.AddTransient<LinkManager>();
    });

    bldr.Configure(app =>
    {
      app.Run(async context =>
        {
          var manager = app.ApplicationServices.GetService<LinkManager>();
          await manager.HandleRedirection(context);
        });
    });

  })
  .Start();

For something this small, this was nice. I have to say at this point, Visual Studio Code was doing really well with the project. I had zero reasons to go to Visual Studio, but we'll get there soon...

.net 5 c#

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Microsoft .NET Conf 2020: .NET 5, C# 9.0, F# 5.0, and More

At the 2020 edition of .NET Conf, streamed online last week, Microsoft released the much-awaited .NET 5, along with new major .NET language versions (C# 9 and F# 5), ASP.NET 5, and EF Core 5.0. New versions of Visual Studio 2019 were also released, with support for .NET 5 and improved Git tooling. The event also featured sessions covering tools and frameworks such as Blazor and Project Tye.

C# 10 - Top 5 New Features in the Upcoming C# Version

C# has been around for a while. Since January 2002, to be more precise. As we wait for the 20th birthday of this popular programming language, we are expecting its new version as well. C# 10 doesn’t have an official release date yet, although it will probably be released in November along with the .NET 6. If you follow its GitHub page, you can find a lot of features and ideas that are suggested for the new version of the language.

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

.NET Conf 2020 Demos & Sessions for .NET 5 + Virtual Events!

This year’s .NET Conf was the largest one yet, with over 80 live sessions across three days that were co-organized and presented by the .NET community and Microsoft.

Microsoft .NET 5 arrives with C# 9, F# 5

After more than a year in development, Microsoft released its .NET 5 software development platform on Tuesday, November 10, emphasizing unification of the platform and introducing the C# 9 and F# 5 programming languages.