November 2026
Every post published in November 2026, newest first. Pick a day to jump straight to it.
- Posts
- 1,091
- Topics
- 89
- Reading time
- 124 h
- Active days
- 16
Posts 991–1,020 of 1,091 · November 3, 2026
Page 34 of 37
Tuesday, November 3, 2026
30 of 91 posts
How to Enforce .NET C# Code Style Rules on Build with EnforceCodeStyleInBuild
Code-style rules in .editorconfig (IDE0044 and the other IDExxxx rules) are skipped by dotnet build until you set EnforceCodeStyleInBuild. See the same code build clean, then fail on IDE0044, then pass after the fix, and learn which settings decide what the build reports. Real output from the .NET 10 SDK.
7 min readHow to Add an .editorconfig to a .NET C# Project with dotnet new editorconfig
Create the default .NET .editorconfig with dotnet new editorconfig, read its sections and its option = value:severity entries, know which rules it sets to warning, and use --empty when you want to start from nothing. Real output from the .NET 10 SDK, and why the build ignores most of it until you turn on code-style enforcement.
6 min readHow to Turn On More .NET C# Code Analysis Rules with AnalysisLevel (latest-recommended and latest-all)
.NET analyzers are on by default, but only a few rules warn. Set AnalysisLevel to latest-recommended or latest-all to make the build report more code-quality issues, see what changes on a real project (CA1852, CA5394), and decide how strict to go. Real output from the .NET 10 SDK.
7 min readHow to Treat Warnings as Errors in .NET C# Projects (TreatWarningsAsErrors)
Make dotnet build fail on warnings with TreatWarningsAsErrors, keep chosen warnings as warnings with WarningsNotAsErrors, turn only some warnings into errors with WarningsAsErrors, and silence one with NoWarn. What it does to NuGet warnings such as NU1903, with real output from the .NET 10 SDK.
7 min readHow to Share Build Settings Across .NET C# Projects with Directory.Build.props
Set an MSBuild property once for every project in a .NET C# solution with Directory.Build.props: create it with dotnet new buildprops, check that each project picks it up with dotnet msbuild -getProperty, override it in one project, and avoid the nested-file trap with --inherit. Real output from the .NET 10 SDK.
7 min readHow to Upgrade a Transitive NuGet Package with Central Package Management (Transitive Pinning)
A package you reference pulls in an older version of another package, such as MySql.EntityFrameworkCore bringing EF Core 10.0.12 when 10.0.14 is out. See it with dotnet package list --include-transitive, raise it with CentralPackageTransitivePinningEnabled in Directory.Packages.props, and know the NU1109 rule for downgrades.
6 min readHow to Use Central Package Management for NuGet in a .NET C# Solution (Directory.Packages.props)
Keep every NuGet package version of a .NET C# solution in one file with Central Package Management: create Directory.Packages.props with dotnet new packagesprops, move existing versions out of the .csproj files, add and update packages from the CLI, and override one version for one project with VersionOverride. Real output from the .NET 10 SDK.
6 min readHow to Add, Update and Remove a NuGet Package with the .NET CLI (dotnet package add)
Add a NuGet package to a .NET C# project with dotnet package add, pin a specific version, list what's installed, try a prerelease, and remove it again. What each command writes into the .csproj, how it works with Central Package Management, and the older dotnet add package form. Real output from the .NET 10 SDK.
8 min readHow to Add a Project Reference in .NET C# with the CLI
Let one .NET C# project use the code of another: dotnet reference add writes the ProjectReference into the .csproj, dotnet reference list shows it, and dotnet reference remove takes it out. What the reference does at build time, the CS0246 error without it, and the older dotnet add reference form.
7 min readHow to Create and Manage a .slnx Solution File with the .NET CLI
Create a .NET 10 C# solution in the new .slnx XML format with dotnet new sln, add projects with and without solution folders, list them, keep the old .sln format when you need it, and convert an existing .sln with dotnet sln migrate. Real output from the .NET 10 SDK.
7 min readHow to Revert an Applied EF Core Migration
Roll a database back to an earlier EF Core migration with dotnet ef database update <migration>, see the Down method run and the history row disappear, revert everything with 0, and know why a Down method can fail and lose data. Real output from EF Core 10 on MySQL 9.7.
6 min readHow to Remove the Last EF Core Migration
Undo dotnet ef migrations add with dotnet ef migrations remove: what it deletes and restores, the error when the migration is already applied, how to revert first, and --force, which does both in one step. Real output from EF Core 10 with MySQL 9.7, plus when removing is the wrong move.
7 min readHow to Check for Pending Model Changes in EF Core
Find out whether your EF Core model has changed since the last migration, before you forget to create one: dotnet ef migrations has-pending-model-changes, its exit code for build scripts, what it compares, and how it proves a refactor changed nothing. Real output from EF Core 10 in a .NET C# solution.
6 min readHow to List EF Core Migrations and See Which Ones Are Applied
List every EF Core migration in your project and see which ones the database has applied with dotnet ef migrations list, read the (Pending) marker, get JSON for scripts, list without a database, and look at the __EFMigrationsHistory table EF Core keeps in MySQL. Real output from EF Core 10 and MySQL 9.7.
6 min readHow to Generate a SQL Script from EF Core Migrations
Turn EF Core migrations into a SQL script you can read, review and hand to whoever runs the database: all migrations, only the ones after a given migration, a range, a rollback script, and a file with --output. Real scripts from EF Core 10 for MySQL 9.7, including what the provider leaves out.
8 min readHow to Use EF Core Migrations When the DbContext Is in a Class Library
When your DbContext lives in a class library and the app in a separate .NET C# Web API project, every dotnet ef command needs two options: --project for the library and --startup-project for the app. See what each one means, the three errors you get when one is wrong, and the command that works. EF Core 10.
7 min readHow to Use ConfigureConventions in EF Core to Configure Every Property of a Type
Set a rule once for every decimal, DateTime or enum in your EF Core model with ConfigureConventions: precision for money, a UTC converter for dates, strings for enums. See each rule leave the model unchanged when it replaces per-property code, and see a per-property setting override it. EF Core 10 with MySQL.
7 min readHow to Configure a One-to-Many Relationship in EF Core
One category has many products: model it in C# with a foreign key and two navigation properties, see how EF Core discovers it by convention (foreign key, index and delete rule in MySQL), then configure it explicitly with HasOne, WithMany and HasForeignKey. Real migrations from EF Core 10 on MySQL 9.7.
6 min readHow to Make EF Core Columns Required or Nullable with C# Nullable Reference Types
With nullable reference types, EF Core reads your C# types to decide which MySQL columns may be NULL: string? is optional, string is required. See it in a real migration, use C#'s required modifier so the compiler enforces it too, and change an existing column from nullable to required safely. EF Core 10, .NET 10 and MySQL 9.7.
8 min readHow 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.
7 min readHow 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.
7 min readHow 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.
9 min readHow 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#.
7 min readHow 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.
8 min readHow 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 min readHow 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.
7 min readHow 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 min readHow 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.
8 min readHow 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.
10 min readHow 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.
9 min read