Writing C# Code Like a Klingon

Developers aim for clean, maintainable, and readable code, but sometimes readability drifts into verbosity and methods start sounding like bureaucratic procedures instead of executable instructions. What if, instead, you wrote code like a Klingon war...

Designing a SOLID, Layered ASP.NET Core Solution for Patient Lookup

A simple patient lookup might not sound exciting, but it is a perfect chance to show how clean code and solid architecture make all the difference. This example uses ASP.NET Core and stored procedures to do just that. While the use case is straightfo...

Refactoring Repetitive Model Validation in ASP.NET Core

In one of my ASP.NET Core APIs, I was working with [FromBody] models that had a number of required fields, some were nullable integers, others were strings that needed to be non-empty. Initially, I handled validation directly in the controller action...

Transitioning to JSON: Supporting Both Body and Query Parameters in ASP.NET Core

Recently, I was tasked with updating older POST endpoints to support [FromBody] input instead of the traditional [FromQuery] model. As part of this transition, I needed to support both [FromQuery] and [FromBody] inputs for backward compatibility unti...

SQL Server Stored Procedure Design for Flexible Record Lookup

When working with data I often run into situations where the available information varies. Sometimes I get a clean patientid, which makes the lookup easy. Other times, all I have is a date of birth and ZIP code or even just an invoice number from bil...

Dynamic API Dispatching in C#

When building an API, one of the first things you need to figure out is how to route incoming requests to the right piece of code. This is usually done by checking which fields are present in the request and deciding which method to run. For simple A...

Identifying Stored Procedures Created or Modified Within a Date Range in SQL Server

As part of rewriting the documentation for my custom API, I needed to test each endpoint to ensure it behaved as expected, including validating both input and output. During this process, I discovered that several existing stored procedures required ...

Customizing Output Caching in ASP.NET Web Forms and C# APIs

Efficient performance is essential for responsive, scalable web applications and one way to achieve that and boost performance is through caching. By avoiding repetitive data processing and rendering, caching allows applications to serve content more...

Filtering and Exporting SQL Stored Procedures with PowerShell

When managing SQL Server stored procedures, there are times when I need to quickly generate scripts for them, usually for backups, migrations, a specific client or functionality, or documentation. In this document, I show how I use T-SQL and PowerShe...

Some Random SQL Error Handling Techniques for Reliability and Transactional Integrity

Error handling is an important part of writing SQL code. Whether working with stored procedures, triggers, or transactions, proper error handling ensures that database operations remain reliable, maintainable, and capable of handling unexpected situa...

Centralizing SQL Connection Handling with a DatabaseHelper Class

For applications that rely on SQL Server connectivity for real-time data processing and high-volume data operations, transient connection failures can occur due to network issues, server load, timeouts, etc. Implementing a custom SQL connection retry...

Launching Executables and Switching Focus in Delphi

I am currently using Delphi to provide support, implement enhancements, and resolve bugs in legacy monolithic Windows applications. One key enhancement involved creating a launch pad to manage multiple pre-existing external executables, requiring sea...

Automating Multi-Channel Client Notifications with a Custom Windows Service

My development of this Windows service stemmed from the need to automate and simplify client notifications, such as a notification about a prescription being ready for pickup, while ensuring both reliability and flexibility by seamlessly integrating ...

Dynamically Extracting Endpoint Names and Attributes from a Custom C# MVC API

Recently, I was asked whether a specific custom API endpoint functionality existed for a client. Unfortunately, I realized that I had been a bit lax in documenting the API endpoints as I added new functionality. In fact, more than a bit lax as the en...

File Comparison Made Easy: Detecting New and Changed Files with PowerShell

Recently, I was tasked with comparing two directory structures of two different project versions and to identify 'new files' and 'changed files' between the most current version of the project and the prior version of the project. The idea was to pro...

DevExpress - Simplifying Server-to-Client Data Transfer with ASPxCallback JSProperties

When building interactive ASP.NET web applications with DevExpress controls, it is common to encounter scenarios where you need to transfer data from the server to the client dynamically. The "JSProperties" property of the "ASPxCallback" control prov...

DevExpress - Enhancing ASP.NET Web Forms with the ASPxGridView Control

The DevExpress "ASPxGridView" control is a server-side control that allows you to display data from a data source in a grid within an ASP.NET web form application. It displays data source fields and records as columns and rows in a table-based layout...

Working with Matter Team Membership Using the IntApp Walls API

The IntApp Walls API is a powerful tool for managing ethical walls and securely controlling access to sensitive data. By leveraging its operations, developers can efficiently interact with matter teams, manage memberships, and ensure compliance with ...

Understanding SQL Transactions: Implicit vs Explicit

In SQL, transactions are essential for ensuring data integrity, consistency, and reliability during database operations. They provide a way to group multiple actions into a single unit of work, ensuring that either all changes are committed or none a...

Gathering Keypad Input in Voice Calls with Twilio and .NET

Twilio, a cloud communications platform, enables developers to integrate communication features such as SMS, voice, video, and email into applications effortlessly. Among its many capabilities is the ability to gather user keypad input (DTMF tones) d...

Consuming and Processing JSON Stream Data in an API Webhook using C#

Recently, I was tasked with developing a custom webhook for our API that would consume a specific client-supplied point-of-sale (POS) JSON stream, parse the data, and write it to a series of custom SQL tables. The provided POS JSON stream includes de...

Understanding the Dictionary<TKey, TValue> Class at a Glance

Dictionary<TKey, TValue> is a collection in C# and a class that derives from the System.Object, as all classes in .NET do. The Dictionary<TKey, TValue> class in C# is a collection designed for storing key-value pairs, where each unique key maps to a ...

Mastering List<KeyValuePair<TKey, TValue>> in C#

In C#, List<KeyValuePair<TKey, TValue>> is a versatile collection type used to store pairs of related data in a sequential manner. Unlike a dictionary, which enforces unique keys and provides fast lookups, this structure retains the flexibility of du...

PowerShell Script Collection

Over the years, PowerShell has proven to be an invaluable tool in simplifying complex administrative tasks, automating repetitive operations, and bridging the gap between system management and development. During my journey, I have created some scrip...

SQL Admin Scripts

Effective database management relies on having the right tools to streamline tasks and ensure optimal performance. Over time, I have created a set of SQL scripts designed to simplify routine administrative duties, enhance visibility into database env...

A Brief Guide to Implementing Pagination in a C# Endpoint

Pagination is a crucial feature in APIs that deal with large datasets, ensuring efficient data delivery by dividing it into smaller, manageable chunks. This is a brief guide to implementing pagination in a C# API endpoint. Understand the Pagination B...

From Chaos to Clarity: A Journey Through Random SQL Code

In SQL development, I often encounter recurring challenges that can be addressed with small, reusable pieces of code. Here, I've put together a few random yet handy SQL snippets that tackle common scenarios—from formatting output to managing permissi...

Simplifying Multiple Condition Checks in C# ForEach Loops

Occasionally, you may need to iterate over collections and evaluate various conditions for each element. Often, you need to check multiple conditions for each item, whether those conditions involve the same or different data types. Below are a couple...

Boosting SQL Query Flexibility with CROSS APPLY

CROSS APPLY is useful SQL operator that lets you look up related information for each row in a table. It is especially useful when you want to get extra details that depend on each specific row. It is especially handy when you need to perform row-by-...

Transforming Nested JSON into Usable Data with SQL CROSS APPLY

JSON is a popular format for data interchange due to its flexibility and readability. One effective method for transforming nested JSON into a more accessible structure is by utilizing the CROSS APPLY operator. The SQL nested JSON arrayA SQL nested J...

Easily Display Record Counts in SQL Server Using COUNT(*) OVER()

The SQL COUNT(*) OVER () analytic function is a powerful tool that allows you to include a total record count within each row of your query results. This feature is especially valuable when you want a quick, overall count alongside detailed row data ...

Enhancing Time Zone-Sensitive Business Engagement: SQL Logic for Business Hour Validation by Time Zone

In the context of Patient SMS, Voice, and Email engagement, I was responsible for ensuring that engagement notifications are only sent to patients during designated business hours (9 AM to 5 PM) in their local time zone. This proactive approach preve...

Efficient Temporary Storage in SQL

(A Limited-Scope Solution to Replace SQL Cursors) Using a table variable is an excellent alternative to using a SQL cursor, especially when you need a temporary storage mechanism that has a limited scope. Table variables are defined using the DECLARE...

Simplifying Workflow Execution with Action Mapping in C#

Efficiently managing workflows in code is essential for maintainability and readability, particularly in complex systems. This shows how to use a "Dictionary" to map keys to corresponding methods for streamlined execution, avoiding repetitive conditi...

Sending Voice Messages with Twilio in .NET

Twilio is a powerful cloud communications platform that allows developers to easily integrate communication services like SMS messaging, voice calls, video conferencing, and email into their applications. By providing developer-friendly APIs, Twilio ...

Handling Recipient SMS Replies with Twilio and .NET

Twilio’s robust cloud communications platform allows developers to integrate messaging, voice, video, and email services into their applications with ease. Among its many features, Twilio enables applications to receive and process replies to SMS mes...

Sending SMS with Twilio in .NET

Twilio is a powerful cloud communications platform that allows developers to easily integrate communication services like SMS messaging, voice calls, video conferencing, and email into their applications. By providing developer-friendly APIs, Twilio ...

Defining and Using Classes in C#: A Simple Guide to Object Collections

In C#, a "class" is a blueprint for creating objects that can represent real-world entities by defining (encapsulating) their attributes and behaviors. When you need to handle multiple objects of the same type, such as a list of team members, combini...

Efficient Data Exchange: Leveraging SQL JSON Results with C#

In my custom API development, I have found that utilizing SQL JSON results for read-only operations - especially within the pharmacy operations and patient prescription management domain - offers significant flexibility in data structuring and facili...

Securing Data in SQL Tables Using Master Key, Asymmetric Key, and Symmetric Key

In today's data-driven world, securing sensitive information in databases is of utmost importance. SQL Server provides various encryption mechanisms that can help protect data at rest. In this article, I will explain how to secure data in a SQL table...

Securing a REST API with JWT Authentication in C# Using AES-Encrypted Keys

JWT (JSON Web Token) authentication is a popular method for securing REST API access, but by integrating AES encryption, you can add an additional layer of secure key security to protect sensitive information within the token itself. AES is a symmetr...

Redirects Made Simple in ASP.NET MVC: Using RedirectToAction

In ASP.NET MVC, efficiently redirecting user requests between actions and controllers is crucial for maintaining clear and concise workflows. The "RedirectToAction" method offers a flexible way to navigate users to different parts of your application...

Handling URL Parameters in C# Across Application Types

Handling URL parameters is a common task in web and console applications, as they often carry essential data for processing user requests. Here I show how I typically read URL parameters in different C# application types, including ASP.NET Core MVC/W...

Asynchronous Data Retrieval with SQL Stored Procedures in C#

Introduction Asynchronous programming is essential for ensuring responsiveness and efficient resource utilization, particularly in I/O-bound or high-latency scenarios like database interactions. Leveraging async and await with SQL stored procedures c...

Passing an Array of Items to a SQL Stored Procedure Using XML from C#

In SQL Server, a common challenge is passing multiple values to a stored procedure. One effective way to achieve this is by passing an array or list of items as a parameter allowing you to compactly represent an array of items as a single parameter, ...

Fetched at: 8/30/2025 7:18:31 PM