Category: .NET Core

  • [NuGet]: Transplator

    This is a Nuget that it is what Razor should have been. It is a Roslyn Source Code Generator that transforms template into code. Link: https://www.nuget.org/packages/Transplator  Site: https://github.com/atifaziz/Transplator What it does:  Takes a template and generates source code for outputting anything inside. Usage: Somewhere in the csproj: <ItemGroup>   <CompilerVisibleProperty Include=”DebugTransplator” />   <CompilerVisibleItemMetadata Include=”AdditionalFiles” MetadataName=”SourceItemType” />  …

  • [RSCG]–About My Software

    I have made a new improvement to my Roslyn Source Code Generator,AMS . Until now it just said the time and the commit date in a CI scenario  ( Git ( GitLab,GitHub),Azure …) Now –  what if it can list all the merge requests between 2 dates ,so you can see what is new ?  Now…

  • EventId in logging

    Finally I have realized why it is necessary to have EventId logged and it is not the same life without him – especially in the microservices context. So why it is not enough public static void LogError (this Microsoft.Extensions.Logging.ILogger logger,Exception? exception,string? message,params object?[] args); and I strongly recommend public static void LogError (this Microsoft.Extensions.Logging.ILogger logger,Microsoft.Extensions.Logging.EventId…

  • [NuGet]: HealthCheck

    This is a Nuget that I use in all projects when I am making any ASP.NET Core prohect Link: https://www.nuget.org/packages/AspNetCore.HealthChecks.UI/ Site: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks  What it does:  Implements health checks for your site and/or dependencies Usage: public void ConfigureServices(IServiceCollection services) { //code     services.AddHealthChecks()         .AddSqlServer(myConnectionString)  }

  • [NuGet]: Polly

    This is a Nuget that I use in all projects when I am making HTTP calls.. Link: https://www.nuget.org/packages/polly Site: https://github.com/App-vNext/Polly What it does:  Implements all kind of policies for retrying – see https://github.com/App-vNext/Polly/wiki/Transient-fault-handling-and-proactive-resilience-engineering Usage: – copied from https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/implement-http-call-retries-exponential-backoff-polly static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy() {     return HttpPolicyExtensions         .HandleTransientHttpError()         .OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)         .WaitAndRetryAsync(6,retryAttempt => TimeSpan.FromSeconds(Math.Pow(2,                                                                     retryAttempt))); }

  • Dependent Framework Versioning

    There are multiple ways to version a software . I have used SemanticVersioning ( https://semver.org/ ) and Calendar Versioning (  https://calver.org/ ) Of course,there are others  – please read https://en.wikipedia.org/wiki/Software_versioning   – interesting versioning based on e or PI . However,I want to propose a new standard : Dependent Framework Versioning The major version of a …

  • [NuGet]:Scriban

    This is a Nuget that I use in almost every .NET Core project to get the error details ( 500) Link: https://www.nuget.org/packages/Scriban/ Site: https://github.com/scriban/scriban What it does:  Like Razor –  a template intepreter Usage: var template = Template.Parse(@” <ul id=’products’> {{ for product in products }} <li> <h2>{{ product.name }}</h2> Price: {{ product.price }} {{…

  • Using files in a ASP.NET Core nuget package

    To use static (html) files in a NUGET ASP.NET Core package to be displayed I have used the following solution 1. Put the files in a folder ( in my case,blocklyAutomation ) 2. Put in the .csproj to embed the files <ItemGroup>   <EmbeddedResource Include=”BlocklyAutomation\**\*”>     <CopyToOutputDirectory>Never</CopyToOutputDirectory>   </EmbeddedResource> </ItemGroup> 3.  Create an extension to use it ;…

  • Windows terminal + Powershell to run IDE,Angular,.NET Core

    I work at http://github.com/ignatandrei/BlocklyAutomation – and every time I need to run Angular,Visual Studio Code IDE and .NET Core run ( and Visual Studio  sometimes  – it is more web based) Also,sometimes I need to run in a container – to install globally something that I do not want to have in my PC. So …

  • Python vs C#

    I have read the article https://www.red-gate.com/simple-talk/development/dotnet-development/10-reasons-python-better-than-c-sharp I think that deserves an answer –  so I take all points to answer to them. You can replicate the code in C# 10 / .NET 6 with a globalusings.cs with the following content: So let’s start: Point 1 – Indented code blocks Also,when I want to comment something,with C#…