Skip to main content

Posts

Showing posts from March, 2020

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