Backend Development
A Brief Discussion on C# Property Syntax Sugar and the Evolution of NRT Mechanisms
An overview of the evolution of C# Property syntax from backing fields to the 'field' keyword, and the practical improvements in NRT mechanisms following the introduction of 'init' and 'required' syntax.
A Brief Discussion on SQL Server Date/Time Queries and Precision Rounding Pitfalls
Exploring the precision differences between SQL Server time types (datetime vs datetime2), considerations for choosing time sources (DateTime.Now vs GETDATE()), and analyzing rounding pitfalls in time range queries.
Introduction to RCSI and Improved Entity Framework Locking Hint Interceptor
An introduction to the differences between RCSI and NOLOCK, along with an improved implementation of an EF Core locking hint interceptor based on TagWith.
Using MQTT in .NET: Implementation with MQTTnet and Mosquitto
An introduction to using the MQTT protocol in .NET. This tutorial covers setting up a Mosquitto Broker using Docker and the complete workflow for implementing Publishers and Subscribers with the MQTTnet package, suitable for IoT beginners.
The Hidden Trap of Excel Column Widths
Exploring the hidden reasons behind inconsistent column widths when exporting Excel files using NPOI and EPPlus. This article uncovers the impact of the Excel Default Font on column width calculations and provides solutions for correctly configuring the default font via code.
A Brief Discussion on the Differences Between throw and throw ex
An analysis of the key differences between `throw` and `throw ex` in C#. Emphasizes that `throw` preserves the original Stack Trace, which aids in debugging, while `throw ex` resets stack information and should be avoided.
A Brief Discussion on Default Value Behavior in Entity Framework
Exploring how EF Core handles database default values. This article analyzes whether EF ignores fields or explicitly writes `null` when an entity property is `null`, and how to configure the correct behavior using `ValueGeneratedOnAdd`.
Introduction to EF Core Power Tools
An introduction to the essential Visual Studio extension, EF Core Power Tools. This article explains how to perform reverse engineering via a GUI, supports .NET 8 DateOnly/TimeOnly type mapping, and addresses the complexities of native EF Core command-line operations.
Quickly Convert JSON to C# Classes in Visual Studio
Introduces the built-in 'Paste Special' feature in Visual Studio, which allows for quickly converting JSON strings into C# class structures, and provides reminders on property naming and type validation when using them as DTOs.
A Brief Discussion on .NET Default Logger and Optimization Techniques
An introduction to the Log Level (Trace to Critical) definitions in the built-in .NET Core Logging mechanism. Analyzes the default Logger Providers loaded by `WebApplication.CreateBuilder` and shares strategies for optimizing logging.
An Exploration of Best Practices for File Uploads in ASP.NET Core Web API
An exploration of two common patterns for backend file upload handling (Form vs Base64), proposing a recommended architecture that separates file uploads from business logic to resolve frontend-backend collaboration pain points and improve API consistency.
Common Issues When Using Microsoft.Office.Interop.Excel in .NET Projects
Explores common issues when using Microsoft.Office.Interop.Excel for ODS conversion in .NET projects, including troubleshooting steps for `dotnet publish` compilation errors (MSB4803) and DCOM permission issues (0x80070005).
Implementing Optional Update Functionality in ASP.NET Core Web API
Explores how to distinguish between 'do not update field' and 'update to null' in RESTful PATCH APIs. Proposes a solution based on a custom `OptionalValue<T>` struct combined with JsonConverter and ModelBinder, allowing the backend to precisely determine which fields were provided by the frontend.
Simplifying Parameter Validation with CallerArgumentExpression
Introduces the C# 10 `[CallerArgumentExpression]` attribute and explains how to apply it to an `ExceptionUtils` utility class to automatically capture parameter names when throwing ArgumentExceptions, simplifying parameter validation code.
On the Evolution of .NET Technical Documentation and Naming Conventions
Observing the changes in the .NET technical ecosystem, documenting the transition from MSDN to Microsoft Learn, and exploring the evolution and discrepancies of C# naming conventions (such as the `_` prefix for private fields) in official documentation and StyleCop rules.
A Brief Discussion on C#'s GetHashCode()
Exploring the implementation principles of C#'s `GetHashCode()` and its role in Dictionary and HashSet. Emphasizes that when overriding `Equals()`, one must also override `GetHashCode()` to avoid hash collisions or object comparison errors.
A Brief Discussion on Exception Handling and State Restoration for SaveChanges() in Entity Framework
A guide to handling common EF Core exceptions (DbUpdateException, DbUpdateConcurrencyException). Explains how to restore the ChangeTracker state using `Reload()` or by resetting the Entity State when an error occurs, preventing subsequent write operations from being blocked.
DateTime Time Zone Issues and Solutions in Entity Framework
Solve common issues with `DateTime` time zones (UTC) in Entity Framework. Explore time offsets caused by `DateTimeKind.Unspecified`, and learn how to use `ValueConverter` to automatically handle UTC conversion during database read/write operations to ensure consistency between the frontend and backend.
A Brief Discussion on Synchronizing Navigation Properties and Foreign Keys in Entity Framework
Verifying whether modifying a Foreign Key (e.g., `MainId`) in EF Core automatically synchronizes the Navigation Property (e.g., `Main` object), and vice versa, to understand the behavioral differences.
A Brief Discussion on the Dispose Pattern and the using Statement
An in-depth analysis of the .NET `IDisposable` interface and the Dispose Pattern. This article explains the underlying mechanics of the `using` syntax and how to correctly implement a Finalizer to ensure that Unmanaged Resources are safely released.
