How To

How to convert GUID to Integer in C#
By FoxLearn Published on Nov 10, 2024  597

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 FoxLearn Published on Mar 07, 2025  124

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 FoxLearn Published on Mar 07, 2025  114

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 FoxLearn Published on Mar 07, 2025  107

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 FoxLearn Published on Mar 07, 2025  45

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 FoxLearn Published on Feb 06, 2025  93

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 FoxLearn Published on Feb 06, 2025  78

In Entity Framework (EF) Core, creating a database and a table involves a few steps.

Database Schema Modifications in EF Core
By FoxLearn Published on Feb 06, 2025  62

Whenever a database’s structure changes, whether you’re renaming a column or adding a new table, it’s called a database schema modification. With EF Core, these changes are managed through migrations.

Adding a Computed Column in EF Core
By FoxLearn Published on Feb 06, 2025  96

To add a computed column in EF Core, override DbContext.OnModelCreating() and use the ModelBuilder to define the computed column.

Inheritance Mapping in EF Core
By FoxLearn Published on Feb 06, 2025  94

In EF Core, inheritance can be mapped in two main ways:

Adding a Foreign Key in EF Core
By FoxLearn Published on Feb 06, 2025  127

In Entity Framework Core (EF Core), adding a foreign key involves creating a relationship between two entities (tables). You can define the foreign key either through data annotations in your model class or by using the Fluent API in your DbContext.

How to create a composite primary key in EF Core
By FoxLearn Published on Mar 07, 2025  41

A composite primary key is a primary key consisting of more than one column.