Posts

Using Scrutor for Dependency Injection in ASP.NET Core API Applications

Image
What is Scrutor? Scrutor is a NuGet package that extends the built-in Dependency Injection (DI) container of ASP.NET Core with assembly scanning and decoration capabilities. While ASP.NET Core provides a simple and effective DI container out of the box, it requires every service to be registered manually — one line of code per interface-to-implementation mapping. In large enterprise applications with dozens or hundreds of services, this manual registration becomes repetitive, error-prone, and difficult to maintain. Scrutor solves this problem by allowing developers to scan assemblies at startup and automatically discover and register all concrete classes that implement specific interfaces. Instead of writing individual AddScoped , AddTransient , or AddSingleton lines for each service, Scrutor enables a single builder.Services.Scan() call that handles all registrations from one or more assemblies. Scrutor vs. Built-in ASP.NET Core DI Aspect ...

Building an Employee CRUD Application with React and TanStack Query

Image
Introduction Managing server state in a React application can quickly become complex. You need to handle loading indicators, error states, caching, background refetching, and cache invalidation after mutations. TanStack Query (formerly React Query) solves all of these problems with a declarative, hook-based API. In this article, we will walk through a complete Employee CRUD application that demonstrates how to: Read a list of employees and individual employee details using useQuery . Create a new employee using useMutation and navigate to the new record. Update an existing employee and refresh the cache automatically. Delete an employee and remove it from the cache. The project is built with React 19 , TypeScript , Vite , React Router v7 , React Hook Form , and Zod for schema validation. Application Architecture The diagram below illustrates how TanStack Query sits between the React UI and the backend APIs. Read operations flow through useQuer...