Skip to main content


Blazor Server Form Validation

Introduction: Blazor Server Form validation can be achieved by using the 'System.ComponentModel.DataAnnotations' . Blazor Sever is a component-based application, and it provides some default key components for validation like 'EditForm' , 'DataAnnotationsValidator' , 'ValidationSummary' , etc. Overview On Validation Process: Blazor Server opts for two kinds of validation like: Validation Type 1 - Field Validation, like when the user focuses out of a particular field of a form(eg like user types something and then clicks cursor out of text box), then 'DataAnnotationValidator' component report the validation error message for the particular field by sending the field data to the server for validation. Validation Type 2 - On Submitting the form, the form gets validated by the Model level where the 'DataAnnotationValidator' helps to show error messages report from server to the respective fields on UI. Create Blazor Se

Dependency Injection In Controller Action Methods

What Is Dependency Injection? : A container or an object which creates and passes the dependant object in an application is called Dependency Injection. In simple words instead of creating dependant objects manually by a programmer, objects are get created by library container which normally handles both the creation and garbage handling. Normally the objects are injected by a mechanism like Property Injection and Constructor Injection(constructor inject most widely used mechanism). From .NET Core, we are getting Dependency Injection as a default feature. With the evolution of .NET Core Microsoft has implemented much more efficient ways of injecting approaches like Constructor Injection, Razor Page Injection(.cshml), and Controller Action Methods Injection(Using Microsoft.AspNetCore.Mvc.FromServices Attribute class). Here I'm going to explain about Controller Action Methods Injection working mechanism comparing with traditional Constructor Injection. A Brief Look

Blazor Server CRUD Operations

Introduction: Blazor Server is a web framework to develop server-side single-page applications. Blazor is made up of components with the combinations on C#, Html, CSS.  Blazor Server is production-ready from the .Net Core 3.0.  Blazor Server Working Mechanism: Blazor Server is a very light-weight web development framework.  In Blazor Server, not all code gets downloaded to the client browsers. Blazor Server made of components these components can be a block of code or page with respective navigation.  Blazor server application communicates with the server with a SignalR background connection which is inbuilt functionality. Application click,  form submission, change events, application page navigation every operation is carried out by the SignalR connection by communicating with the server.  Blazor updates the Html DOM very gently on every data update without any overhead. Blazor Server application maintains a nice intelligent tree structure to update the required inform

.NET Core MVC Application File Upload To Physical Location With Buffered Technique

Buffering Technique In File Upload: The server will use its Memory(RAM) or Disk Storage to save the files on receiving a file upload request from the client.  Usage of Memory(RAM) or Disk depends on the number of file requests and the size of the file.  Any single buffered file exceeding 64KB is moved from Memory to a temp file on disk.  If an application receives heavy traffic of uploading files there might be a chance of out of Disk or RAM memory which leads to crash application. So this Buffer technique used for small files uploading. In the following article, we create a sample for the file uploading using .NET Core MVC application. Create The .NET Core MVC Project: Let's create a .NET Core MVC project, here for this sample I'm using Visual Studio Code as below.   Check the link to use the Visual Studio Code for .NET Core Application . IFormFile: Microsoft.AspNetCore.Http.IFormFile used for file upload with buffered technique. On uploading files f