Category: .NET Core

  • TILT- Tests- part 12

    First,it is a decision between NUnit and XUnit. I took this time NUnit. Also,I take LightBDD to show data. Let’s say I want to verify the rule that the user cannot make more than 1 TILT per day. In order to do 1 TILT per day User must be authenticated and have have an URL…

  • TILT–Telemetry–part 11

    I want to see what is happening in my application – i.e. having the Stack Trace for any kind of errors. I have add with [AutoMethods(CustomTemplateFileName = “../AutoMethod.txt”,MethodPrefix = “auto”,template = TemplateMethod.CustomTemplateFile)] [AutoGenerateInterface] public partial class AuthUrl : IAuthUrl { [AOPMarkerMethod] private async Task<string?> privateLogin(string url,string secret) { //code And inside the method var act=Activity.Current;…

  • TILT- BlocklyScenario–part 10

    Scenario for adding and retrieving the own TILTs I needed a way to show to the front-end programmer how he should call the API. One is to retrieve all the TILTS urls and the other is to add a new TILT,once authenticated I have used NetCore2Blockly nuget package and configured with demoBlocks ( wwwroot\BlocklyAutomation\assets\showUsage\demoBlocks )…

  • TILT–Authentication and Authorization–part 9

    This is the difficult part. I decide that,for the moment,I do not need in the application any fancy authorization – just a simple url + secret ( a.k.a password). I decided also to use JWT – it is a simple way to add authentication + authorization to the application. Let’s see the login code var…

  • TILT–HealthCheck–part 8

    Read about https://docs.microsoft.com/en-us/azure/architecture/patterns/health-endpoint-monitoring In ASP.NET Core it is easy to add health checks to your web application. I have added for Sqlite in the release and for SqlServer in the Azure. This is the code bool IsBuildFromCI = new XAboutMySoftware_78102118871091131225395110108769286().IsInCI; //more code builder.Services .AddHealthChecksUI(setup => { var health = “/healthz”; if (IsBuildFromCI) { health =…

  • TILT- ConnectionSecrets in Azure–part 7

    There is relatively easy to use – just go to your web app in Azure,Configuration,ConnectionStrings and add your data. This tutorial is based on the following article: https://docs.microsoft.com/en-us/azure/app-service/tutorial-dotnetcore-sqldb-app The .NET Core code is simple: services.AddDbContext<MyDatabaseContext>(options =>         options.UseSqlServer(Configuration.GetConnectionString(“AZURE_SQL_CONNECTIONSTRING”))); Tools used: https://portal.azure.com/

  • TILT–CRUD API–part 5

    It is true that usually you should not create CRUD API. In this case I was thinking that is faster just to have those already created and making the application later. More,the CRUD was created automatically – sgtarting from database. Install the generator https://marketplace.visualstudio.com/items?itemName=ignatandrei.databasetocode in VS2022,create a new solution and then edit the connectionDetails.txt with…

  • TILT–specifications –part 2

    This is an application to store what I have learned today / each day . It will be one note string per day,note will be no more than 140 characters. It has tags – programming,life,and so on. Can add one link to the note. Can be saved on local ( desktop,mobile )or on cloud (…

  • NetCoreUsefullEndpoints-4 Nuget package

    or NugetPackages there is a simple .NET Pack CLI command  and many configurations However,it is not so simple . See https://docs.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices . In practice,I have a readme.md file ( for showing on nuget.org ) and a readme.txt file( for the programmer to show help after installing the package) THis is what I have in the…

  • NetCoreUsefullEndpoints-2–MVP

    So let’s start the implementation for user / error / environment. The only difficulty resides in the fact that IEndpointRouteBuilder is not defined into a usual library,but the dll csproj must contain <ItemGroup> <FrameworkReference Include=”Microsoft.AspNetCore.App” /> </ItemGroup> Otherwise,it is work as usual. For example,for seeing a user public static void MapUser(this IEndpointRouteBuilder route) { ArgumentNullException.ThrowIfNull(route);…