Category: .NET
-
RSCG – Flaggen
RSCG – Flaggen name Flaggen nuget https://www.nuget.org/packages/Flaggen/ link https://github.com/ricardoboss/Flaggen author Ricardo Boss Explicit operations about flags with enums, and bitwise operations This is how you can use Flaggen . The code that you start with is The code that you will use is namespace EnumDemo; [Flags] public enum Colors { None =…
-
BlazorExtensionsAspire – integrate BlazorWebAssembly with WebAPI via Aspire–code
BlazorExtensionsAspire solves the problem of automatically injecting the URL of WebAPI into Blazor WebAssembly . The code for obtaining writes into appsettings.json of BlazorWebAssembly public static IResourceBuilder<ProjectResource> AddWebAssemblyProject<TProject>( this IDistributedApplicationBuilder builder, string name, IResourceBuilder<ProjectResource> api) where TProject : Aspire.Hosting.IProjectMetadata, new() { var nameOfParameter = api.Resource.Name + "_host"; var projectBuilder = builder.AddProject<TProject>(name); var p = new…
-
BlazorExtensionsAspire – integrate BlazorWebAssembly with WebAPI via Aspire–idea
Any WebAPI application needs an UI – and Blazor is a choice nowadays ( along other SPA , like Angular, React, Svelte … ) For integrating in ASPIRE ,there is a no simple task : Blazor should know the WebAPI url and use it to gather data. But the WebAPI URL could change – so…
-
RSCG – InlineComposition
name InlineComposition nuget https://www.nuget.org/packages/InlineComposition/ link https://github.com/BlackWhiteYoshi/InlineComposition author Black White Yoshi Mixin classes and interfaces together This is how you can use InlineComposition . The code that you start with is <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> </PropertyGroup> <ItemGroup> <PackageReference Include="InlineComposition" Version="1.4.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers;…
-
RSCG – Tortuga.Shipwright
name Tortuga.Shipwright nuget https://www.nuget.org/packages/Tortuga.Shipwright/ link https://github.com/TortugaResearch/Tortuga.Shipwright author Tortuga Research Generate mixin between classes This is how you can use Tortuga.Shipwright . The code that you start with is <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <!– Code Generator –> <ItemGroup> <PackageReference Include="Tortuga.Shipwright" Version="0.9.0" > <PrivateAssets>all</PrivateAssets> </PackageReference> <PackageReference Include="Tortuga.Shipwright.Shared" Version="0.9.0" /> </ItemGroup>…
-
RSCG – jos.enumeration
name jos.enumeration nuget https://www.nuget.org/packages/jos.enumeration/ link https://github.com/joseftw/jos.enumeration author Josef Ottosson Generating enum from static consts This is how you can use jos.enumeration . The code that you start with is <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <PackageReference Include="JOS.Enumeration" Version="4.0.2" /> <PackageReference Include="JOS.Enumeration.SourceGenerator" Version="4.0.2" /> </ItemGroup> <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> </PropertyGroup> </Project>…
-
TestExtensionsAspire- part 2- execution
Now the code mans to create commands about running dotnet <test or run> in the current folder of the csproj test project. Things that needed to be solved: 1. Test Project as NuGet Package The main project (.csproj) , that will be referenced as a NuGet dependency, it’s not an Aspire project, so it doesn’t…
-
TestExtensionsAspire- part 1 – idea
I know that Aspire could be used to perform integration test. And this can be achieved by having a test project that references Aspire – see https://learn.microsoft.com/en-us/dotnet/aspire/testing/write-your-first-test?pivots=xunit . However, how about allowing your test project ( even unit test project ) to run under Aspire Host ? Of course, Aspire will reference the test –…
-
RSCG – Strings.ResourceGenerator
RSCG – Strings.ResourceGenerator name Strings.ResourceGenerator nuget https://www.nuget.org/packages/Strings.ResourceGenerator/ link https://github.com/biggik/Strings.ResourceGenerator author Birgir Kristmannsson Generating strongly typed string resources – with parameter and Localization This is how you can use Strings.ResourceGenerator . The code that you start with is <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <AdditionalFiles Include="TestData\*.json" /> </ItemGroup> <ItemGroup> <PackageReference…
-
RSCG – Figgle
RSCG – Figgle name Figgle nuget https://www.nuget.org/packages/Figgle.Generator/ link https://github.com/drewnoakes/figgle author Drew Noakes Generating ASCII art text for console applications This is how you can use Figgle . The code that you start with is <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <PackageReference Include="Figgle.Generator" Version="0.6.4" PrivateAssets="all" /> </ItemGroup> <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>…