Category: .NET Core

  • ASP.NET Core WebAPI should/ (must?) have

    I am trying to have an extensive list about what an ASP.NET Core WebAPI project should / must have . After al,can be easy integrated into a VS project – or a wizard. I have put into 3 categories: Development – you need at development time. Testing – needed at testing time Production – needed…

  • ASP.NET Core : Add controllers at runtime and detecting changes done by others

    Part 1 Adding controllers at runtime Adding controllers at runtime in ASP.NET Core involves the ApplicationPartManager and IActionDescriptorChangeProvider. Let’s say that we hardcode the creation of the controller     Then we will load into ApplicationParts and the code for is and it is added to the DI services by Usually,you do not need Part…

  • Integrating SPA ( Angular,React,Vue) with .NET Core for production

    If you have a .NET Core WebAPI application ( that only serves data ) and  a SPA application ( Angular,Vue,  React) you can have just one application following this 2 steps: 1.  In .NET Core add in Startup.cs ( with using Microsoft.AspNetCore.Builder from Microsoft.AspNetCore.StaticFiles ) app.UseDefaultFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints =>             {                             // If…

  • HCV- Postmortem–part 8

    As I look below,the code is a small part of what has been done – documentation,test,CI /CD The src folder has this number of lines / words ( obtained with Powershell Get-ChildItem -r “src” |?{!$_.PSIsContainer} | Select-Object { Get-Content $_.FullName  | Measure-Object -Line -Word  | Select-Object  -Property Lines,Words }   @{Lines=6; Words=6} @{Lines=20; Words=112} @{Lines=36;…

  • HCV–preparing for NuGet–part 7

    Preparing a dll to be deployed to NuGet mneans to me: 1. XML documentation 2. Treat Warnings as errors 3. Adding sources to the nuget package 4. Versioning the package,adding description,licence and so on 5. Generating CD in artifacts 6. Deploying to NuGet 7. Adding Badge with Nuget and Licence to the readme   Where…

  • HCV–automatic CI–part 6

    I want the tests to be run automatically . And have a code coverage report. So Docker will be generating the report ( with coverlet.console and dotnet-reportgenerator-globaltool ). The GitHub Actions will be responsible with running this every time. The docs folder will be responsible of hosting it . The code for docker resides in …

  • HCV–adding test application–part 5

    Now it is time to see a test application. For this I create a new .NET Core 3.1 ASP.NET application,add Xabaril ( to see the end result ) and add reference to my project. The Startup is:     And so I figure out the fact that I should not hardcode the name of the…

  • HCV- adding code–part 4

    Now it is time to write some code .  However,the implementation should be in a different class than the health check itself – to can be tested. The code is as follows: The internals visible to is for running tests successfully. The code for getting the real Health Check is You will find the code…

  • HCV- adding tests–part 3

    Now it is time to add tests . Even if will not compile,the tests should show how the application behaves. Here are the tests:   The code ( again,even if not compile ) it is at https://github.com/ignatandrei/HealthCheckVersion/releases/tag/addingTests  

  • HealthCheckVersion–documentation- part 2

    Written the documentation at https://github.com/ignatandrei/HealthCheckVersion . Put also here to have it. HealthCheckVersion What it is This NuGet package will report via Health Check the version of the starting assembly . Also,it should report his own version – but not direct . It will be easy to demo via Xabaril Why To know from first…