• .Net Core,  Microsoft

    Dotnet Core Templates – The Revisit

    So a while back I penned an article (Dotnet new Magic), but now with the latest VS 2019 and Dotnet Core 3.x release… it’s time to revisit. In case we forgot – the command is: dotnet new -i “–The Template Reference Name Here–”  The list of templates can be found in the old place but also here – Dotnet New Templates What ones do I add: dotnet new –install “Microsoft.AspNetCore.SpaTemplates” dotnet new –install “Microsoft.Azure.WebJobs.ProjectTemplates” dotnet new –install “Microsoft.Azure.WebJobs.ItemTemplates” dotnet new –install “NUnit3.DotNetNew.Template” dotnet new –install “Microsoft.AspNetCore.Blazor.Templates”   **Some of these already exist, but this one adds the webassembly type. dotnet new –install “Microsoft.Azure.IoT.Edge.Module” dotnet new –install “Microsoft.Azure.IoT.Edge.Function” dotnet new –install “RaspberryPi.Template”…

  • ASP.NET Core,  Microsoft

    ASP .Net Core Razor SPA vs. MVC Taghelpers Navigation

    As I mess about with deciding- do I want to do Razor SPA pages or do a full on ASP.Core MVC pages for my latest Web App? I noticed something when- Yes I put both in a solution- it comes to the ASP tag helper for navigation links… So here’s the thing. For a regular ASP.Core MVC we see tag helper navigations look like this: <a class="nav-link" asp-controller="Home" asp-action="Index">Home</span></a> Simple enough… “asp-controller”  has the simple controller name, and  “asp-action” the action within the controller… no problem Now consider Razor SPA or just simple razor pages:   <a class="nav-link text-dark btn btn-outline-info" asp-page="/Index" data-toggle="tooltip" data-placement="top" title="Always Takes you back Home">Home</a> Here…

  • .Net Core,  Microsoft

    .Net Core ASP Tag Helpers

    I has to be one of the most useful things added… You got Tag Helps… Consider the simplest example… <img src="/images/somePng.png" /> Not hard and very common. But consider the task of versioning your images for a web page… Enter Tag Helpers <img src="/images/somePng.png" asp-append-version = "true"/> This gives us a Hash version appended, so if an image changes? Indeed yes the hash value changes and this will trigger a cached page to update the image.  Wow, Tag Helpers… very handy. ScottGeek  

  • ASP.NET Core,  Microsoft

    Using Kestrel for ASP Core Apps

    As I was looking about with some of the Core 2.2 notes, I came across some interesting notes on how to tweak about with Kestrel settings…. I’m not sure I like putting Kestrel options up the in the Main Program builder. I tend to prefer these to collect in the startup class, but I get point of why Kestrel needs to be handled close to the Builder (it is after all the html service handling web calls). Shall we begin… So up in program.cs we do our normal Web Host Builder: public class Program { public static void Main(string[] args) { var host = CreateWebHostBuilder(args).Build(); MigrateDatabase(host); host.Run(); //CreateWebHostBuilder(args).Build().Run(); } private…

  • ASP.NET Core

    EF Migration tasks in the Program.cs – The good and the Ugly

    Program.cs of any core project (especially ASP.Net Core) is our first starting point to get some necessary work out of the wrong. In this case EF DB Migrations. You know that EF thing where you keep your attached DB tables in sync with your data models? (or in some cases… mess up your existing database). Life in program.cs normally starts here: public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup&lt;Startup>(); } But let’s consider this:   public class Program { public static async Task Main(string[] args) { IWebHost webHost = CreateWebHostBuilder(args).Build(); // Create a new scope using (var scope…