Category: .NET Core

  • HealthCheckVersion–- idea – part 1

    The health Check from Microsoft ( https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks ) and from Xabaril ( https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks ) are pretty impressive. ( I have done this before with a simple ping action  – but this is better) I was thinking about making a simple HealthCheck – that reports the version of executing  starting assembly ( And his own version…

  • Generating outdated,licenses and thanks with .NET Core tools

    Last time (http://msprogrammer.serviciipeweb.ro/2020/06/08/net-core-local-tools/) I have discussed about local tools . Now it is time to show something in practice,beside code coverage ( detailed http://msprogrammer.serviciipeweb.ro/2019/12/09/code-coveragepart-25/ and video https://youtu.be/JvahoA0WWms  ), Let’ make something simple: generate outdated packages list,licenses and thanks. I will use this packages “dotnet-project-licenses”: { “version”: “2.1.0”, “commands”: [ “dotnet-project-licenses” ] }, “dotnetthx”: { “version”:…

  • .NET Core local tools

    ( Video at https://youtu.be/iHLRBxi4S7c ) .NET Core has the concept of “local tools”  – that means,tools for a solution / project. That is different from “global tools”  by the fact that you can have it registered for the solution in a \.config\dotnet-tools.json file. You can read about those at https://docs.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use But I want to show you my…

  • Embed files for a Nuget ASP.NET Core package

    For NetCoreBlockly I have the need to embed some files in the NUGET package (https://www.nuget.org/packages/NetCore2Blockly ) to display a GUI. After unsuccessful trying to deploy,I  have read https://weblog.west-wind.com/posts/2018/Jan/29/Distributing-Content-and-Showing-a-ReadMe-file-in-a-NET-Core-Nuget-Package . So I must learn from the experts: e.g.,swagger : https://github.com/domaindrivendev/Swashbuckle.AspNetCore it is displaying the HTML UI.  How it does ? By embedding into the .csproj the…

  • Passing a WebAPI application from .NET Core 2 to .NET Core 3 in 5 +1 (EF) steps

    Simple steps: 1. Modiffy in the .csproj  <TargetFramework>netcoreapp2.0</TargetFramework> to <TargetFramework>netcoreapp3.1</TargetFramework>  2.Delete <PackageReference Include=”Microsoft.AspNetCore.All” Version=”2.0.8″ /> 3. Modify public static IWebHost BuildWebHost(string[] args) =>public static IHostBuilder CreateHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args)Host.CreateDefaultBuilder(args) .UseStartup<Startup>() .ConfigureWebHostDefaults(webBuilder => .Build(); to public static IHostBuilder CreateHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args)Host.CreateDefaultBuilder(args) .UseStartup<Startup>() .ConfigureWebHostDefaults(webBuilder => .Build(); { webBuilder.UseStartup<Startup>(); }); 3.  Modify BuildWebHost(args).Run();  to CreateHostBuilder(args).Build().Run(); 4. Modify…

  • Zip the whole ASP.NET Core application

    I realized that I should have somehow let the user play with the application from his PC. How can I do that,if the application is on some site  ? Answer: download the whole site as a zip file. It should be relatively easy  for the user– so an endpoint routing should be used – something…

  • Retarder–Fixed and Random strategy and Tests-part 4

    Now I want to make a second strategy : the random strategy between a min and a max value. This is only to minimize the impact on the extension that uses the Random – it is good to be hidden inside. For Random Strategy it is better to re-use the Fixed Strategy – and this…

  • Retarder – Making a strategy to wait–part 3

    Now I want to make the await configurable. To remind,first is just a random delay ( or static delay). The others are Delay execution of some endpoints,based on how frequent are their uses Delay execution based on headers / query string /  routes Delay execution based on client IP Delay execution based on the response…

  • Retarder- reorganizing the project to easy use- part 2

    Now it is the moment to start reorganizing the project to be easy to use by other programmers. I want,instead of registering the services manually,to can use .AddRetarder and .UseRetarder. So I create a new project,NetCoreRetarderCore.csproj,and move there the RetarderMiddleware . The only new thing is the extension class RetarderExtensions     This let’s me…

  • Retarder- idea and POC–part 1

    I was thinking about a new project in .NET Core  – Retarder ( Delayer  seems to be better,but I digress ). What about a middleware in .NET Core,that delays execution of any request with 1 second ( or something between 1 millisecond and 1 second )? That way,if someone wants to improve the project,just remove…