Posts

Showing posts from June 16, 2025

Getting Started with Blazor: Build Web Apps Using C#

Getting Started with Blazor: Build Web Apps Using C# Blazor  is a web framework created by Microsoft that lets you build interactive websites using  C# instead of JavaScript . It’s part of ASP.NET Core and uses  Razor syntax  (a mix of HTML and C#) to create rich user interfaces. If you're a .NET developer, Blazor lets you use your existing skills to build both the backend and frontend of web apps—all in one language.   Two Ways to Run Blazor Blazor offers two hosting models: 1. Blazor WebAssembly (WASM) Runs directly in the browser. Doesn’t need a server for every UI update. Great for apps that work mostly on the client side. 2. Blazor Server Runs on the server and updates the UI in real time using SignalR. Light load on the browser but requires a constant internet connection.   Why Use Blazor? Here’s why many developers are choosing Blazor: Use C# Everywhere No need to learn JavaScript or fra...

C# OOP Essentials: Concepts, Examples, and Benefits

1. Class A  class  is a blueprint for creating objects that encapsulate both data and behavior. Access Modifiers:  public, internal, abstract, sealed control visibility and inheritance. Static Classes:  Cannot be instantiated, contain only static members. Partial Classes:  Split across files using partial keyword for better organization. Example public class Car {     public string Model;       public void Drive() => Console.WriteLine($"{Model} is driving."); } Analogy A  car blueprint  used to build many actual cars. Benefits Reusability Encapsulation of data and logic Supports abstraction and inheritance   2. Object An  object  is an instance of a class. Managed by  Garbage Collector  for automatic memory cleanup.  Boxing/Unboxing  allows value types to be treated as objects (with some performance cost). E...

How to Find Long-Running Queries in SQL Server

How to Find Long-Running Queries in SQL Server Identifying long-running queries is a crucial aspect of performance tuning and diagnostics in SQL Server. With the right tools and techniques, it's possible to detect both currently executing slow queries and those that have historically consumed excessive resources. This guide covers multiple approaches using built-in Dynamic Management Views (DMVs), the Query Store, and external tools.   1. Identifying Currently Executing Long Queries The sys.dm_exec_requests DMV reveals real-time insights into executing queries. SELECT     session_id,     start_time,     status,     command,     blocking_session_id,     wait_type,     wait_time,     last_wait_type,     cpu_time,     total_elapsed_time AS duration_ms, ...