Blazor Form Validation

Validation with DataAnnotations public class Employee { [Required(ErrorMessage = "Name is required")] public string Name { get; set; } } @page "/employee" @using System.ComponentModel.DataAnnotations @using Microsoft.AspNetCore.Components.Forms <h3>Employee Form</h3> <EditForm Model="@employee" OnValidSubmit="@HandleValidSubmit"> <DataAnnotationsValidator /> <ValidationSummary /> <div class="form-group"> <label for="Name">Name</label> <InputText id="Name" @bind-Value="employee.Name" class="form-control" /> <ValidationMessage For="@(() => employee.Name)" /> </div> <button type="submit" class="btn btn-primary">Submit</button> </EditForm> @code { private Employee employee = new Employee(); } Validation with FluentValidation dotnet add package Blazored.FluentValidation public class EmployeeValidator : AbstractValidator<Employee> { public EmployeeValidator() { RuleFor(x => x.Name).NotEmpty().WithMessage("Name is required"); } } @page "/employee" @using FluentValidation @using FluentValidation.Results <h3>Employee Form</h3> <EditForm Model="@employee" OnValidSubmit="@HandleValidSubmit"> <FluentValidationValidator DisableAssemblyScanning="@true" /> <ValidationSummary /> <div class="form-group"> <label for="Name">Name</label> <InputText id="Name" @bind-Value="employee.Name" class="form-control" /> <ValidationMessage For="@(() => employee.Name)" /> </div> <button type="submit" class="btn btn-primary">Submit</button> </EditForm> Custom Validation

March 10, 2026

Blazor Globalization and Localization

Blazor applications can support multiple languages and cultures by using the globalization and localization features of .NET Core. This article describes how to implement globalization and localization in a Blazor application. Blazor WebAssembly <PropertyGroup> <BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData> </PropertyGroup> dotnet add package Microsoft.Extensions.Localization Blazor Server builder.Services.AddCustomLocalization(); app.UseCustomLocalization();

March 10, 2026

Blazor JavaScript Interoperability

About JavaScript Location Load a script in the <head> tag <head> <script src="js/first.js"></script> <script> window.jsMethod = (methodParameter) => { ... }; </script> </head> Load a script in the <body> tag <body> <script src="js/first.js"></script> <script> window.jsMethod = (methodParameter) => { ... }; </script> </body> Colocate with the component Component: CountComponent.razor Component: CountComponent.razor.cs Style: CountComponent.razor.css Script: CountComponent.razor.js Call JS from .NET Create an app.js file under wwwroot function helloWorld() { alert('Hello World'); } function add(a, b) { return a + b; } Include the JS file in App.razor Script inclusion in the current web project ...

March 10, 2026

Coding with GitHub Copilot

What is GitHub Copilot? GitHub Copilot is an AI-powered coding assistant developed by GitHub and OpenAI. It can generate code snippets based on context, helping developers write code faster. How to use GitHub Copilot GitHub Copilot can be used as an extension in Visual Studio Code and Visual Studio. After installation, suggestions are available while you write code. Is GitHub Copilot paid? GitHub Copilot is a paid product. During its early preview period, it was available for free for a limited time.

March 10, 2026

Configuring Distributed Events with Dapr Pub/Sub

Dapr Technical Architecture https://docs.dapr.io/concepts/overview Installing the Dapr CLI Scaffolding Tool https://docs.dapr.io/zh-hans/getting-started/install-dapr-cli Initializing the Dapr Runtime with Containers https://docs.dapr.io/zh-hans/getting-started/install-dapr-selfhost dapr init Initializing the Dapr Runtime Offline Without Containers dapr init -s Initializing the Dapr Runtime from an Offline Bundle https://docs.dapr.io/zh-hans/operations/hosting/self-hosted/self-hosted-airgap/ dapr init --from-dir C:\daprbundle Opening the Default Initialization Directory explorer "$env:USERPROFILE\.dapr" explorer "%USERPROFILE%\.dapr" Viewing Dapr Runtime Status with the Dashboard dapr dashboard Configuring Distributed Events with Pub/Sub /components/redis-pubsub.yaml Redis-Based Pub/Sub Configuration apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: pubsub spec: type: pubsub.redis version: v1 metadata: - name: redisHost value: localhost:6379 - name: redisPassword value: "" RabbitMQ-Based Pub/Sub Configuration /components/rabbitmq-pubsub.yaml apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: pubsub spec: type: pubsub.rabbitmq version: v1 metadata: - name: host value: "amqp://guest:guestpwd@localhost:5672" - name: durable value: "false" - name: deletedWhenUnused value: "false" - name: autoAck value: "false" - name: reconnectWait value: "0" - name: concurrency value: parallel Starting the Sidecar and Application with the Dapr Command dapr run --app-id myapp --dapr-http-port 3500 --dapr-grpc-port 50001 --app-port 5000 --log-level debug --config ./configuration/config.yaml --components-path ./components dotnet run Starting the Sidecar and Application with Aspire dotnet add package Aspire.Hosting.Dapr var pubsub = builder.AddDaprPubSub("pubsub", new DaprComponentOptions { LocalPath = "./DaprComponents/" }); var productService = builder.AddProject<Projects.HelloWorld_ProductService>("productservice") .WithReference(identityService) .WithDaprSidecar() .WithReference(pubsub); RabbitMQ Pub/Sub Configuration var username = builder.AddParameter("username", secret: true); var password = builder.AddParameter("password", secret: true); var messaging = builder.AddRabbitMQ("messaging", username, password); // Service consumption builder.AddProject<Projects.ExampleProject>() .WithReference(messaging);

March 10, 2026

Copyright

Copyright Generally the copyright notice for a project in the .NET Foundation is given as “Copyright (c) .NET Foundation and Contributors. All Rights Reserved”. The copyright notice should be placed in the LICENSE for the project so the beginning of the LICENSE for an MIT Licensed project would be: The MIT License (MIT) Copyright (c) .NET Foundation and Contributors All Rights Reserved Permission is hereby granted... And an Apache 2.0 Licensed project would begin ...

March 10, 2026

Creating Code Repositories

Warehouse naming convention Create a code repository named HelloShop on Github. Regarding the naming convention of the code repository, use the SnakeCaseLower nomenclature. Naming policy Original Converted PascalCase HelloShop HelloShop CamelCase HelloShop helloShop SnakeCaseLower HelloShop hello_shop SnakeCaseUpper HelloShop HELLO_SHOP KebabCaseLower HelloShop hello-shop KebabCaseUpper HelloShop HELLO-SHOP Warehouse folder structure Create a folder named src in the repository to store the source code. Documentation Create a file named README.md in the warehouse to store the warehouse documentation. Of course, each folder should have a documentation if possible. ...

March 10, 2026

Creating Dynamic Flowcharts and Architecture Diagrams

Microsoft Visio Visio is Microsoft’s diagramming tool. It is very powerful, but it is paid, and it only runs on Windows, with no support for Mac or Linux. Although Microsoft has released Visio Online, its features are still fairly limited, and it is also paid. The Open-Source Drawio Tool Drawio is an open-source diagramming tool. It supports both online and desktop use, multiple formats, multiple platforms, multiple languages, many kinds of shapes, many export formats, many plugins, and many integration options. It also supports diagramming in Visual Studio Code via a plugin. ...

March 10, 2026

Database Object Naming Conventions

Different database objects follow different naming conventions. To accommodate different databases, EF Core provides several naming convention configuration options. Common Naming Styles Naming policy Original Converted PascalCase HelloShop HelloShop CamelCase HelloShop helloShop SnakeCaseLower HelloShop hello_shop SnakeCaseUpper HelloShop HELLO_SHOP KebabCaseLower HelloShop hello-shop KebabCaseUpper HelloShop HELLO-SHOP You can use the Humanizr library to convert strings between different naming styles. Singular or Plural Table Names By default, EF Core uses the singular form for table names. You can use a convention-based configurator or manually specify plural table names. The community debate over singular versus plural table names has always existed and there is no unified standard, but Zero recommends the singular form. ...

March 10, 2026

Designing Permission Definitions and Permission Providers

Permission Definitions Each microservice is autonomous, and permission definitions are also the responsibility of each microservice. They each define their own permissions. The permission manager will automatically merge permission definitions. The permission definition context is a collection of permission definitions within the microservice and global permission definitions. The permission provider will provide permission data based on the permission definition context. Permission grouping is to facilitate the management of permission definitions. Permission grouping is part of the permission definition. The permission provider is automatically injected into the container to provide permission query endpoints. ...

March 10, 2026