Skip to main content

Blog Archive

Every post on Dewiride Developer Blogs, newest first. Pick a year or a month to narrow it down, or page through them all.

Posts
1,085
Topics
132
Reading time
130 h
First post
Jun 2025

Posts 721–750 of 1,085 · November 3, 2026

Page 25 of 37

November 2026

802 posts

Tuesday, November 3, 2026

30 of 91 posts

  1. How to Set a Maximum String Length in EF Core (varchar Instead of longtext in MySQL)

    Without a maximum length, EF Core's MySQL provider stores every C# string as longtext, which holds 4 GB and can't be fully indexed. Set lengths with HasMaxLength or [MaxLength], read the migration, check existing data before shrinking a column, and see why an index silently changes an unbounded column. EF Core 10 and MySQL 9.7.

  2. How to Set Table Names in EF Core with ToTable (Lowercase for MySQL)

    EF Core names tables after your DbSet properties, such as Products, and MySQL on Linux and in Docker compares table names case-sensitively. Set lowercase names with ToTable, read the rename migration EF Core generates (and the SQL MySQL actually runs), and avoid ERROR 1146. EF Core 10 and MySQL 9.7.

  3. How to Choose What Happens on Delete in EF Core: Cascade or Restrict

    EF Core makes a required relationship ON DELETE CASCADE by default, so deleting a category silently deletes its products. See it happen in MySQL, switch to Restrict with OnDelete, read the migration, and see both ways EF Core and MySQL then refuse the delete. Real output from EF Core 10 and MySQL 9.7.

  4. How to Configure EF Core Entities in Separate Classes with IEntityTypeConfiguration

    Move each entity's EF Core configuration out of a growing OnModelCreating into its own class with IEntityTypeConfiguration<T>, register them all with ApplyConfigurationsFromAssembly, and prove with dotnet ef migrations has-pending-model-changes that the model didn't change. Plus the one-line mistake that silently drops every rule. EF Core 10, .NET C#.

  5. How to Create a Composite Index on Two Columns with EF Core and MySQL

    Speed up "this product's history, newest first" with a two-column index from EF Core's model: HasIndex(m => new { m.ProductId, m.OccurredAtUtc }). See why column order matters, how the index replaces the foreign key's own index, the migration order MySQL needs, and EXPLAIN proving the index is used. EF Core 10 and MySQL 9.7.

  6. How to Create a Unique Index with EF Core and MySQL

    Stop duplicate values, such as two categories with the same name, with a unique index from EF Core's model: HasIndex(...).IsUnique(), the migration it creates, what MySQL does with a duplicate (including case-insensitive matches), and why an index on an unbounded string changes the column. Real output from EF Core 10 and MySQL 9.7.

  7. How to Add a CHECK Constraint with EF Core and MySQL

    Make MySQL refuse invalid rows, such as a negative price or stock level, with CHECK constraints defined in EF Core's model. Write HasCheckConstraint with MySQL's backtick quoting, read the migration, apply it, confirm MySQL enforces it on insert and update, and list the constraints. Real output from EF Core 10 and MySQL 9.7.

  8. How to Save and Read DateTime as UTC with EF Core and MySQL

    A DateTime saved as UTC comes back from MySQL with DateTimeKind.Unspecified, so your .NET C# API's JSON loses the Z, and a DateTime.Now is stored as local time. Fix both with one value converter, applied to every DateTime with ConfigureConventions. Real output from EF Core 10 and MySQL 9.7.

  9. How to Set Decimal Precision for Money with EF Core and MySQL

    See what MySQL column EF Core creates for a C# decimal without configuration (decimal(18,2) with Oracle's provider), choose a precision for money, and set it with HasPrecision, the [Precision] attribute or one convention for every decimal. Includes MySQL's rounding and range limits, with real output from EF Core 10 and MySQL 9.7.

  10. How to Store an Enum as a String with EF Core and MySQL

    EF Core stores a C# enum as a number by default. Store its name instead, for one property with HasConversion<string>() or for every enum with ConfigureConventions, convert the rows that already hold numbers in the migration, and see what happens when the table holds a name the enum doesn't know. Real output from EF Core 10 and MySQL 9.7.

  11. How to Run a Single C# File with dotnet run (.NET 10 File-Based Apps)

    Since .NET 10, dotnet run runs a single .cs file with no project file. Write a one-line program, add a NuGet package with #:package, see where .NET builds it, and convert it into a normal C# project when it grows, with real output from .NET 10 on macOS.

  12. How to Write a MySQL Connection String for .NET C#

    Build a MySQL connection string for .NET C# with Oracle's MySql.Data driver, key by key: Server, Port, Database, User ID, Password and SslMode, with their documented defaults. Test it with a one-file C# program that reports the user, version and TLS, and keep the password out of your code.

  13. How to Pin the .NET SDK Version with global.json in a .NET C# Project

    Make every developer and build machine use the same .NET SDK for your C# project with a global.json file. Create it with dotnet new globaljson, see which SDK a folder uses, and watch each rollForward value pass or fail against a real installed SDK, including .NET 10's custom errorMessage.

  14. How to Check Which .NET SDKs and Runtimes Are Installed for C# Development

    Find out which .NET SDK and runtime versions your computer has, which one your C# project actually uses, and whether they're up to date: dotnet --version, --list-sdks, --list-runtimes, --info and dotnet sdk check, with real output from .NET 10 on macOS.

  15. How to Install dotnet-ef as a Local Tool in a .NET C# Project

    Install the EF Core command-line tools, dotnet ef, as a local tool pinned to your project's EF Core version, instead of one global copy for the whole computer. See where .NET 10 puts the tool manifest, why dotnet ef picks the local copy, how teammates restore it, and the Design package the tools need. Real output from .NET 10.

  16. How to Show MySQL Query Results Vertically with \G

    Wide MySQL results wrap into an unreadable mess in the terminal. End a statement with \G instead of a semicolon to print each row as a list of column: value lines, or start the mysql client with --vertical. Real output from MySQL 9.7.

  17. How to List the CHECK Constraints in MySQL

    List the CHECK constraints of a MySQL database with their tables, rules and whether they're enforced, by joining INFORMATION_SCHEMA.CHECK_CONSTRAINTS and TABLE_CONSTRAINTS, or see one table's in SHOW CREATE TABLE. Real output from MySQL 9.7, with constraints created by EF Core.

  18. How to List the Foreign Keys of a MySQL Table

    Find every foreign key in a MySQL database: which column points to which table, what happens on delete and update (RESTRICT, CASCADE, NO ACTION), and which tables reference a given table, using SHOW CREATE TABLE and INFORMATION_SCHEMA. Real output from MySQL 9.7.

  19. How to List the Indexes of a MySQL Table

    See every index on a MySQL table with SHOW INDEX, read its columns (Non_unique, Key_name, Seq_in_index, Cardinality), and list all indexes of a database with their columns in one query from INFORMATION_SCHEMA.STATISTICS. Real output from MySQL 9.7.

  20. How to See the Structure of a MySQL Table (DESCRIBE and SHOW CREATE TABLE)

    See a MySQL table's columns, types, keys and constraints: DESCRIBE for a quick look, SHOW FULL COLUMNS for collations, SHOW CREATE TABLE for the complete definition, and INFORMATION_SCHEMA.COLUMNS for queries. What PRI, UNI and MUL mean, with real output from MySQL 9.7.

  21. How to List the Tables in a MySQL Database

    List the tables of a MySQL database with SHOW TABLES, filter them with LIKE, tell tables from views with SHOW FULL TABLES, and get engine, collation and row counts from INFORMATION_SCHEMA.TABLES, including why TABLE_ROWS isn't an exact count. Real output from MySQL 9.7.

  22. How to Run a Command Inside a Running Docker Compose Container (docker compose exec)

    Run one command, or a whole interactive shell, inside a container that Docker Compose started, with docker compose exec. See how to read its environment, open bash and leave it, run as another user, and use -T in scripts. Shown with a MySQL 9.7 container.

  23. How to See the Logs of a Docker Compose Service (docker compose logs)

    Read what a container started by Docker Compose prints, with docker compose logs: the last few lines, timestamps, only the last few minutes, live following, and searching for one message in bash or PowerShell. Shown with a MySQL 9.7 container.

  24. Fixed: "Unable to create a 'DbContext' of type 'InventoryDbContext'. The exception 'Unable to resolve service for type DbContextOptions' was thrown" in EF Core

    An EF Core migrations bundle run as Production failed with: An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider, then Unable to create a 'DbContext' of type. Why the app's own startup code decides it, why --connection didn't help, and the fix.

  25. Fixed: "NU1608: Pomelo.EntityFrameworkCore.MySql 9.0.0 requires Microsoft.EntityFrameworkCore.Relational (>= 9.0.0 && <= 9.0.999) but version 10.0.14 was resolved"

    Adding Pomelo.EntityFrameworkCore.MySql 9.0.0 to an EF Core 10 project failed with NU1608: Detected package version outside of dependency constraint, plus NU1902 for MySqlConnector 2.4.0. Why a provider for EF Core 9 can't run on EF Core 10, why suppressing the warning is wrong, and the fix: a provider built for EF Core 10.

  26. Fixed: "dotnet package update --vulnerable: error: Restore failed. Unhandled exception: Specified method is not supported."

    dotnet package update --vulnerable crashed with error: Restore failed and Unhandled exception: Specified method is not supported. in a .NET 10 solution with TreatWarningsAsErrors. Microsoft's docs explain the cause, NuGet warnings failing the command's own restore, and give the workaround I used: a condition on TreatWarningsAsErrors and an environment variable.

  27. Fixed: "NU1903: Warning As Error: Package 'Newtonsoft.Json' 12.0.3 has a known high severity vulnerability"

    Restore and build failed with error NU1903: Warning As Error: Package has a known high severity vulnerability. What NuGet Audit found, the two commands that failed while I tried to fix it, the report that worked with --no-restore, and the version change that cleared it. Real output from .NET 10.

  28. Fixed: "System.IO.IOException: Failed to bind to address http://127.0.0.1:5190: address already in use." in ASP.NET Core

    dotnet run stopped with Hosting failed to start: System.IO.IOException: Failed to bind to address http://127.0.0.1:5190: address already in use. How to find the process that holds the port with lsof (or PowerShell on Windows), stop it cleanly, or run on another port, with real output from .NET 10 on macOS.

  29. Fixed: "error IDE0044: Make field readonly" in a .NET C# Build

    dotnet build failed with error IDE0044: Make field readonly after turning on EnforceCodeStyleInBuild. What the rule checks, why a code-style suggestion became a build error, the one-word fix, and how to change the rule's severity in .editorconfig if you disagree with it.

  30. Fixed: "error NU1109: Detected package downgrade: Microsoft.EntityFrameworkCore.Relational from 10.0.12 to centrally defined 10.0.11"

    dotnet restore failed with error NU1109: Detected package downgrade … to centrally defined version, in a .NET C# solution with Central Package Management and transitive pinning. How to read the two dependency lines under the message, why NuGet refuses, and the two fixes from Microsoft's NU1109 page.