Entity Framework Core 10 from model to production: modelling and migrations, LINQ translation and loading strategies, change tracking, advanced mapping and concurrency, performance, and running EF Core safely in production on SQL Server.
-
What are shadow properties and backing fields in EF Core? When would you use each, and how do you map an aggregate that exposes a read-only collection while EF Core still loads and saves it?
Covers EF Core shadow properties (EF.Property, audit and FK uses), backing fields and property access modes, and mapping encapsulated read-only collections in DDD aggregates.
Mid-Level
Theory
EF Core Fundamentals
Β· π 2 follow-ups Β· π 1 real-world
-
Show how you use value converters in EF Core: store an enum as a string, map strongly typed IDs such as OrderId, and handle a Money value object. When do you need a value comparer, and which LINQ queries break on converted properties?
Covers EF Core value converters (HasConversion, built-in and custom ValueConverter), enums as strings, strongly typed IDs with record structs and ConfigureConventions, value comparers for mutable types, why Money fits a complex type better, and query translation pitfalls.
Mid-Level
Coding
EF Core Fundamentals
Β· π 2 follow-ups Β· π 1 real-world
-
Owned entities or complex types: how do you map value objects such as Address or Money in EF Core 10? Explain table splitting, separate tables and JSON columns, how each behaves in change tracking, and which you would choose today.
Covers mapping value objects in EF Core 10: owned entity types (OwnsOne, OwnsMany, hidden keys, reference semantics), complex types (ComplexProperty, value semantics, optional and collection support, JSON mapping in EF Core 10), table splitting and ToJson, and the current recommendation.
Mid-Level
Theory
EF Core Fundamentals
Β· π 2 follow-ups Β· π 1 real-world
-
You renamed a property, but the generated EF Core migration drops the column and adds a new one. On another branch, Database.Migrate() now fails with a 'pending model changes' error on EF Core 9 or later. How do you review and fix both problems?
Covers debugging EF Core migrations: why the differ scaffolds drop and add instead of a rename, the data-loss warning, editing a migration to RenameColumn, and the EF Core 9+ PendingModelChangesWarning including non-deterministic seed data.
Mid-Level
Debugging
EF Core Fundamentals
Β· π 2 follow-ups Β· π 1 real-world
-
Code review: a new service's DbContext sets the connection string in OnConfiguring, turns on lazy loading proxies, leaves every string unconfigured, keeps cascade delete on every relationship and uses Guid.NewGuid() clustered primary keys. What do you flag, in what order, and what does the fixed configuration look like?
A senior code review of an EF Core model configuration covering a hard-coded connection string in OnConfiguring, lazy loading proxies, nvarchar(max) strings, cascade delete everywhere and random GUID clustered keys, ranked by severity with a rewrite.
Senior
CodeReview
EF Core Fundamentals
Β· π 3 follow-ups Β· π 1 real-world
-
EF Core throws 'The LINQ expression could not be translated'. How do you fix it without moving the whole query to memory?
Junior
Theory
Querying
-
Why can wrapping a column in a function in an EF Core query, such as ToLower() or .Year, make it slow even though it translates?
Intermediate
Theory
Querying
-
How do you reuse a projection expression across several EF Core queries without breaking translation?
Mid-Level
Theory
Querying
-
When would you use snapshot isolation or RCSI with EF Core on Azure SQL, and what does it cost?
Mid-Level
Theory
Querying
-
Why does calling Update() on a disconnected entity cause EF Core to write every column, and what would you do instead?
Intermediate
Theory
Querying
-
Why does offset pagination get slower on deep pages, and how does keyset pagination fix it in EF Core?
Mid-Level
Coding
Querying
-
In EF Core, what is the practical difference between IQueryable<T> and IEnumerable<T>? Where does a Where filter actually run in each case, and what goes wrong when someone calls AsEnumerable() or returns IEnumerable<T> from a repository too early?
Covers where EF Core queries execute depending on IQueryable versus IEnumerable, how the static type decides SQL versus in-memory filtering, and the AsEnumerable() and early-materialisation traps.
Junior
Theory
Querying
Β· π 3 follow-ups
-
How does EF Core translate a LINQ query into SQL? What kinds of expressions translate, where is client evaluation still allowed, what happens when something cannot be translated, and how do you check the SQL EF Core will send?
Covers EF Core's query pipeline, which LINQ constructs and methods translate to SQL Server, the final-projection client-evaluation rule, translation exceptions and how to inspect SQL with ToQueryString() and LogTo.
Intermediate
Theory
Querying
Β· π 2 follow-ups
-
How do you load related data in EF Core? Explain eager loading with Include and ThenInclude, explicit loading, and lazy loading, when you would use each, and what filtered Include lets you do.
Covers EF Core's three ways to load navigations (eager with Include/ThenInclude, explicit with Entry().Collection().Load, lazy with proxies), filtered Include, the SQL each produces and when to choose each.
Junior
Theory
Querying
Β· π 2 follow-ups
-
For a read-only API endpoint, would you load data with Include or project it with Select into a DTO? Explain the difference in the SQL, over-fetching, what each means for change tracking, and when Include is still the right choice.
Covers Select projection versus Include in EF Core: generated SQL, columns and rows transferred, tracking behaviour of projected DTOs and entities, projecting collections and aggregates, and when Include is still correct.
Mid-Level
Theory
Querying
Β· π 3 follow-ups Β· π 1 real-world
-
What is cartesian explosion in EF Core, and how do split queries help? Explain what AsSplitQuery() changes in the SQL, the consistency and round-trip trade-offs, and how you decide between single queries, split queries and projection.
Covers cartesian explosion from multiple collection Includes, how AsSplitQuery() and UseQuerySplittingBehavior change the generated SQL, consistency and ordering caveats, round-trip costs, and choosing between single, split and projected queries.
Mid-Level
Theory
Querying
Β· π 2 follow-ups Β· π 1 real-world
-
What is the difference between a tracking query, AsNoTracking() and AsNoTrackingWithIdentityResolution() in EF Core? What does each cost, how does each handle the same row appearing twice, and which would you use where?
Covers EF Core tracking versus no-tracking queries, identity resolution, snapshot and identity-map costs, QueryTrackingBehavior defaults, and when to choose tracking, AsNoTracking or AsNoTrackingWithIdentityResolution.
Intermediate
Theory
Querying
Β· π 3 follow-ups
-
Your ASP.NET Core API uses EF Core with lazy loading proxies. One endpoint returns entities directly and now either throws a JSON 'possible object cycle' exception or runs dozens of SQL queries per request. How do you diagnose and fix it?
Covers diagnosing lazy-loading N+1 queries and serialisation cycles in an ASP.NET Core API with EF Core: SQL logging, Application Insights, the System.Text.Json cycle error, and fixing with DTO projection, explicit loading strategy and turning lazy loading off.
Mid-Level
Debugging
Querying
Β· π 2 follow-ups Β· π 1 real-world
-
Show how you would build a search endpoint in EF Core with optional filters, a client-chosen sort column and paging. How do you compose IQueryable safely, combine predicates with expressions, avoid SQL injection and plan-cache problems, and keep the query translatable?
Covers composing dynamic EF Core queries: conditional IQueryable filters, combining Expression<Func<T,bool>> predicates (OR with PredicateBuilder-style code), whitelisted sorting, stable paging, parameterisation, and checking translation.
Mid-Level
Coding
Querying
Β· π 3 follow-ups Β· π 1 real-world
-
What deferred-execution problems are specific to EF Core? Walk through a query enumerated twice, a query returned from a method and enumerated after the DbContext is disposed, and an unmaterialised query used inside a loop that also writes. When would you buffer with ToListAsync() and when would you stream with AsAsyncEnumerable()?
Covers EF Core-specific deferred-execution failures (repeated database round trips, ObjectDisposedException after scope end, open-reader conflicts and second-operation errors) and the buffering versus streaming choice between ToListAsync() and AsAsyncEnumerable().
Senior
Theory
Querying
Β· π 3 follow-ups Β· π 1 real-world