Muhammad Shahid
← All articles

Blog topic

C# Design Patterns

Practical C# design patterns for real ASP.NET Core products — Factory, Strategy, and patterns that reduce switch-statement sprawl without ceremony.

I reach for a named design pattern when a product already has a repeating decision — pricing rules, export formats, catalog filters — and the if-else tree is about to become the feature. This hub is not a catalog of every Gang of Four name. It is the subset I actually use on ASP.NET Core APIs that Angular teams consume: Factory when construction logic keeps growing, Strategy when behavior must swap without editing callers, Repository when query shape deserves a name, and SOLID as a review lens rather than a folder religion. Each article walks a production-shaped example, then says when the pattern is ceremony. If you are studying for interviews, start with SOLID and Factory; if you are refactoring a live API, start with Strategy or Repository and skip anything that does not match a change you can point at in source control.

6 min read

Repository Pattern in .NET — Useful vs Overkill

When the repository pattern earns its place in .NET with EF Core, when it becomes ceremony, and how I structure data access on healthcare SaaS and eCommerce products without lying about LINQ.