How To
How to retrieve the Downloads Directory Path in C#
By Tan Lee Published on Jun 27, 2024 3.15K
In C#, you can retrieve the path to the user's Downloads directory using the Environment class and the SpecialFolder enumeration.
Retrieve a Single Row with Dapper in C#
By Tan Lee Published on Jan 18, 2025 554
When you need to retrieve a single row from a database using Dapper, the simplest approach is to use the QuerySingleOrDefault() method.
How to Convert string to JSON in C#
By Tan Lee Published on Nov 19, 2024 2.34K
You can convert a string to a JSON object in C# using the `JsonSerializer.Deserialize` method from the `System.Text.Json` namespace.
How to use decimal precision and scale in EF Code First
By Tan Lee Published on Jul 11, 2024 1.08K
In C# Entity Framework, when you want to use the Decimal data type for your entity properties, you can follow these steps.
Ignoring Namespaces in XML when Deserializing in C#
By Tan Lee Published on Jan 10, 2025 1.3K
Namespaces in XML can be tricky to handle, especially when you're working with documents that sometimes include them and sometimes do not.
How to convert GUID to Integer in C#
By Tan Lee Published on Nov 10, 2024 725
Converting a GUID to an integer in C# isn't a straightforward process because a GUID is a 128-bit value, while an integer in C# is only 32-bits.
How to Authenticate HTTP requests with cookies from an embedded WebView2
By Tan Lee Published on Mar 07, 2025 175
Automating HTTP calls to web pages or APIs by bypassing Cloudflare Turnstile or other CAPTCHA systems can be achieved by using authentication cookies from a browser embedded in a Windows Forms application.
How to securely reverse-proxy ASP.NET Core
By Tan Lee Published on Mar 07, 2025 170
ASP.NET Core applications are powered by Kestrel, a fast, solid, and reliable web server. While Kestrel is capable of serving as a front-facing server, it's rarely exposed directly to the internet.
How to Retrieve Client IP in ASP.NET Core Behind a Reverse Proxy
By Tan Lee Published on Mar 07, 2025 184
When deploying a web app with both a front-end and API back-end to Azure App Service, you may encounter an issue where the client IP address returned by your API always shows the Azure outbound IP rather than the real client IP.
How to add a computed column in EF Core
By Tan Lee Published on Mar 07, 2025 113
To add a computed column in EF Core, you need to override the DbContext.OnModelCreating() method and specify the computed column using ModelBuilder, similar to the following example:
Applying Migrations Programmatically in EF Core
By Tan Lee Published on Feb 06, 2025 148
In EF Core, migrations are used to create the database, apply schema changes, and update tables.
Creating a Database and Table in EF Core
By Tan Lee Published on Feb 06, 2025 127
In Entity Framework (EF) Core, creating a database and a table involves a few steps.