Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 401–425 of 963

Career & HR topics

By tech stack

Popular tracks

Junior PDF
How do you write a basic CRUD operation (Insert / Update / Delete / Read) in EF Core?

Short answer: // Create context.Users.Add(new User { Name = "John" }); context.SaveChanges(); // Read var user = context.Users.FirstOrDefault(u => u.Id == 1); // Update user.Name = "Jane"; context.…

EF Core Read answer
Junior PDF
What is Code First approach?

Short answer: Code First is an EF Core approach where you define your database schema using C# classes, and EF Core generates the database from your code. ✅ Advantages: Full control via C# code (POCOs) Easily version-con…

EF Core Read answer
Junior PDF
What is Code First approach?

Short answer: Advantages and when to use it Code First is an EF Core approach where you define your database schema using C# classes, and EF Core generates the database from your code. ✅ Advantages: Full control via C# c…

EF Core Read answer
Junior PDF
What is Database First approach?

Short answer: Database First involves generating C# entity classes and a DbContext from an existing database. ✅ Pros: Quick start if the DB already exists Ensures model aligns with legacy databases ❌ Cons: Harder to vers…

EF Core Read answer
Junior PDF
What is Database First approach?

Short answer: Use‑cases and pros and cons Database First involves generating C# entity classes and a DbContext from an existing database. ✅ Pros: Quick start if the DB already exists Ensures model aligns with legacy data…

EF Core Read answer
Junior PDF
What is Model First? Is it used in EF Core?

Short answer: Model First allows creating a database model using a designer (EDMX file), then generating both the database and code from that model. ⚠ EF Core does not support Model First. This approach was available in…

EF Core Read answer
Junior PDF
What is Model First?

Short answer: Is it used in EF Core? Model First allows creating a database model using a designer (EDMX file), then generating both the database and code from that model. ⚠ EF Core does not support Model First. This app…

EF Core Read answer
Junior PDF
What is the migration snapshot and what is its role?

Short answer: A migration snapshot is a C# file (e.g., ModelSnapshot.cs) automatically created by EF Core. It represents the current model state. EF uses it to compare changes in future migrations. Located in the Migrati…

EF Core Read answer
Junior PDF
What is change tracking in EF Core?

Short answer: fter they are loaded from the database. This allows EF Core to generate the correct SQL INSERT, UPDATE, or DELETE statements when SaveChanges() is called. Real-world example (ShopNest) Read-only catalog pag…

EF Core Read answer
Junior PDF
What is change tracking in EF Core?

Short answer: Change tracking is the process by which EF Core keeps track of changes made to entities after they are loaded from the database. This allows EF Core to generate the correct SQL INSERT, UPDATE, or DELETE sta…

EF Core Read answer
Junior PDF
What is the difference between tracked and untracked queries?

Short answer: re monitored and persisted. Untracked queries: EF does not monitor the returned entities. re monitored and persisted. Untracked queries: EF does not monitor the returned entities. Faster, read-only ccess. T…

EF Core Read answer
Junior PDF
What is the difference between tracked and untracked queries?

Short answer: Tracked queries: EF Core tracks entities returned from the query. Changes to them are monitored and persisted. Untracked queries: EF does not monitor the returned entities. Faster, read-only access. Tracked…

EF Core Read answer
Junior PDF
What is .AsNoTracking()? When to use it?

Short answer: .AsNoTracking() tells EF Core not to track entities in the returned query. Explain a bit more ✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking…

EF Core Read answer
Junior PDF
What is .AsNoTracking()?

Short answer: When to use it? .AsNoTracking() tells EF Core not to track entities in the returned query. ✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking Exa…

EF Core Read answer
Junior PDF
How is concurrency handled?

Short answer: Optimistic concurrency: Assumes that conflicts are rare. EF checks for changes before saving using concurrency tokens. Pessimistic concurrency: Locks records in the DB to prevent other updates (not supporte…

EF Core Read answer
Junior PDF
What is a concurrency token / [Timestamp] attribute?

Short answer: A concurrency token is a property used to detect concurrency conflicts. Example with [Timestamp]: [Timestamp] public byte[] RowVersion { get; set; } EF Core includes this column in the WHERE clause of updat…

EF Core Read answer
Junior PDF
What are foreign keys and primary keys? How to define them via

Short answer: nnotations & Fluent API? Primary Key (PK): Unique identifier of a record. Foreign Key (FK): A field that references a PK in another table. Data Annotations: [Key] public int Id { get; set; } [ForeignKey…

EF Core Read answer
Junior PDF
What is a composite key?

Short answer: composite key is a primary key made of multiple columns. EF Core does not support composite keys via data annotations, so you must use Fluent PI: modelBuilder.Entity<OrderDetail>() .HasKey(od => ne…

EF Core Read answer
Junior PDF
What is a composite key?

Short answer: How to define composite keys in EF Core? A composite key is a primary key made of multiple columns. EF Core does not support composite keys via data annotations, so you must use Fluent API: modelBuilder.Ent…

EF Core Read answer
Junior PDF
What is cascade delete, and how can it be configured?

Short answer: Cascade delete ensures that related entities are deleted when the parent entity is deleted. Configure with Fluent API: modelBuilder.Entity<Blog>() .HasMany(b => b.Posts) .WithOne(p => p.Blog) .O…

EF Core Read answer
Junior PDF
What is eager loading?

Short answer: Eager loading loads related data as part of the initial query, reducing round-trips to the database. ✅ Use .Include() to load related entities: var blogs = context.Blogs .Include(b => b.Posts) .ToList();…

EF Core Read answer
Junior PDF
What is eager loading?

Short answer: How is .Include() / .ThenInclude() used? Eager loading loads related data as part of the initial query, reducing round-trips to the database. ✅ Use .Include() to load related entities: var blogs = context.B…

EF Core Read answer
Junior PDF
What is lazy loading?

Short answer: re proxies? Lazy loading delays the loading of related data until it's accessed for the first time. EF Core requires proxies for lazy loading: Install NuGet: Microsoft.EntityFrameworkCore.Proxies Enable in…

EF Core Read answer
Junior PDF
What is lazy loading?

Short answer: How to enable lazy loading in EF Core? What are proxies? Lazy loading delays the loading of related data until it's accessed for the first time. EF Core requires proxies for lazy loading: Install NuGet: Mic…

EF Core Read answer
Junior PDF
What is explicit loading? When & how to use it?

Short answer: Explicit loading means loading related data manually, after the main entity is loaded. Explain a bit more Use when: You need full control over what and when to load You don’t want automatic lazy loading var…

EF Core Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: // Create context.Users.Add(new User { Name = "John" }); context.SaveChanges(); // Read var user = context.Users.FirstOrDefault(u => u.Id == 1); // Update user.Name = "Jane"; context.SaveChanges(); // Delete context.Users.Remove(user); context.SaveChanges();

Example code

// Create context.Users.Add(new User { Name = "John" }); context.SaveChanges(); // Read var user = context.Users.FirstOrDefault(u => u.Id == 1); // Update user.Name = "Jane"; context.SaveChanges(); // Delete context.Users.Remove(user); context.SaveChanges();

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Code First is an EF Core approach where you define your database schema using C# classes, and EF Core generates the database from your code. ✅ Advantages: Full control via C# code (POCOs) Easily version-controlled Supports migrations to handle schema evolution Works well with Domain-Driven Design 📌 When to use: When you're starting a new project or prefer designing schema in code.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Advantages and when to use it Code First is an EF Core approach where you define your database schema using C# classes, and EF Core generates the database from your code. ✅ Advantages: Full control via C# code (POCOs) Easily version-controlled Supports migrations to handle schema evolution Works well with Domain-Driven Design 📌 When to use: When you're starting a new project or prefer designing schema in code.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Database First involves generating C# entity classes and a DbContext from an existing database. ✅ Pros: Quick start if the DB already exists Ensures model aligns with legacy databases ❌ Cons: Harder to version control Schema changes must be manually re-scaffolded 📌 When to use: For integrating with existing databases or legacy systems.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Use‑cases and pros and cons Database First involves generating C# entity classes and a DbContext from an existing database. ✅ Pros: Quick start if the DB already exists Ensures model aligns with legacy databases ❌ Cons: Harder to version control Schema changes must be manually re-scaffolded 📌 When to use: For integrating with existing databases or legacy systems.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Model First allows creating a database model using a designer (EDMX file), then generating both the database and code from that model. ⚠ EF Core does not support Model First. This approach was available in EF6 with Visual Studio tooling.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Is it used in EF Core? Model First allows creating a database model using a designer (EDMX file), then generating both the database and code from that model. ⚠ EF Core does not support Model First. This approach was available in EF6 with Visual Studio tooling.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: A migration snapshot is a C# file (e.g., ModelSnapshot.cs) automatically created by EF Core. It represents the current model state. EF uses it to compare changes in future migrations. Located in the Migrations folder, named like [YourDbContext]ModelSnapshot.cs.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: fter they are loaded from the database. This allows EF Core to generate the correct SQL INSERT, UPDATE, or DELETE statements when SaveChanges() is called.

Real-world example (ShopNest)

Read-only catalog pages use AsNoTracking() so EF Core does not spend time snapshotting entities you will never update.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Change tracking is the process by which EF Core keeps track of changes made to entities after they are loaded from the database. This allows EF Core to generate the correct SQL INSERT, UPDATE, or DELETE statements when SaveChanges() is called.

Real-world example (ShopNest)

Read-only catalog pages use AsNoTracking() so EF Core does not spend time snapshotting entities you will never update.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: re monitored and persisted. Untracked queries: EF does not monitor the returned entities. re monitored and persisted. Untracked queries: EF does not monitor the returned entities. Faster, read-only ccess. Tracked (default): var user = context.Users.FirstOrDefault(); Untracked: var user = context.Users.AsNoTracking().FirstOrDefault(); re monitored and…… persisted. Untracked queries: EF does not monitor the returned…

Explain a bit more

entities. Faster, read-only ccess. Tracked (default): var user = context.Users.FirstOrDefault(); Untracked: var user = context.Users.AsNoTracking().FirstOrDefault(); re monitored and persisted. Untracked queries: EF does not monitor the returned entities. re monitored and persisted. Untracked queries: EF does not monitor the returned entities. Faster, read-only ccess. Tracked (default): var user = context.Users.FirstOrDefault(); Untracked: var user = context.Users.AsNoTracking().FirstOrDefault(); re monitored and persisted. Untracked queries: EF does not monitor the returned entities. Faster, read-only ccess. Tracked (default):…

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Tracked queries: EF Core tracks entities returned from the query. Changes to them are monitored and persisted. Untracked queries: EF does not monitor the returned entities. Faster, read-only access. Tracked (default): var user = context.Users.FirstOrDefault(); Untracked: var user = context.Users.AsNoTracking().FirstOrDefault();

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: .AsNoTracking() tells EF Core not to track entities in the returned query.

Explain a bit more

✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking var users = context.Users.AsNoTracking().ToList(); .AsNoTracking() tells EF Core not to track entities in the returned query. .AsNoTracking() tells EF Core not to track entities in the returned query. ✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking

Example code

var users = context.Users.AsNoTracking().ToList(); .AsNoTracking() tells EF Core not to track entities in the returned query. .AsNoTracking() tells EF Core not to track entities in the returned query. ✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking Example: var users = context.Users.AsNoTracking().ToList(); .AsNoTracking() tells EF Core not to track entities in the returned query. ✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking Example: var users = context.Users.AsNoTracking().ToList();

Real-world example (ShopNest)

Read-only catalog pages use AsNoTracking() so EF Core does not spend time snapshotting entities you will never update.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: When to use it? .AsNoTracking() tells EF Core not to track entities in the returned query. ✅ Use when: Read-only operations Improving performance for large queries Preventing memory overhead of tracking

Example code

var users = context.Users.AsNoTracking().ToList();

Real-world example (ShopNest)

Read-only catalog pages use AsNoTracking() so EF Core does not spend time snapshotting entities you will never update.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Optimistic concurrency: Assumes that conflicts are rare. EF checks for changes before saving using concurrency tokens. Pessimistic concurrency: Locks records in the DB to prevent other updates (not supported out-of-the-box in EF Core). EF Core supports optimistic concurrency using [ConcurrencyCheck] or [Timestamp].

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: A concurrency token is a property used to detect concurrency conflicts. Example with [Timestamp]: [Timestamp] public byte[] RowVersion { get; set; } EF Core includes this column in the WHERE clause of updates. If the row has changed since it was loaded, EF will throw a DbUpdateConcurrencyException. Entity Framework Core – Relationships

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: nnotations & Fluent API? Primary Key (PK): Unique identifier of a record. Foreign Key (FK): A field that references a PK in another table. Data Annotations: [Key] public int Id { get; set; } [ForeignKey("Blog")] public int BlogId { get; set; } Fluent API: modelBuilder.Entity<Post>() .HasKey(p => p.Id); modelBuilder.Entity<Post>() .HasOne(p =>… p.Blog)……… WithMany(b => b.Posts) .HasForeignKey(p => p.BlogId);…

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: composite key is a primary key made of multiple columns. EF Core does not support composite keys via data annotations, so you must use Fluent PI: modelBuilder.Entity<OrderDetail>() .HasKey(od => new { od.OrderId, od.ProductId }); composite key is a primary key made of multiple columns.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: How to define composite keys in EF Core? A composite key is a primary key made of multiple columns. EF Core does not support composite keys via data annotations, so you must use Fluent API: modelBuilder.Entity<OrderDetail>() .HasKey(od => new { od.OrderId, od.ProductId });

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Cascade delete ensures that related entities are deleted when the parent entity is deleted. Configure with Fluent API: modelBuilder.Entity<Blog>() .HasMany(b => b.Posts) .WithOne(p => p.Blog) .OnDelete(DeleteBehavior.Cascade); Delete behaviors: Cascade Restrict SetNull NoAction EF Core defaults to Cascade for required relationships.

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Eager loading loads related data as part of the initial query, reducing round-trips to the database. ✅ Use .Include() to load related entities: var blogs = context.Blogs .Include(b => b.Posts) .ToList(); Use .ThenInclude() for deeper nesting: context.Blogs .Include(b => b.Posts) .ThenInclude(p => p.Comments); Eager loading prevents lazy load performance issues and the N+1 problem.

Real-world example (ShopNest)

Loading orders with items uses .Include(o => o.Items). Without Include, listing 50 orders can trigger 50 extra queries (N+1).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: How is .Include() / .ThenInclude() used? Eager loading loads related data as part of the initial query, reducing round-trips to the database. ✅ Use .Include() to load related entities: var blogs = context.Blogs .Include(b => b.Posts) .ToList(); Use .ThenInclude() for deeper nesting: context.Blogs .Include(b => b.Posts) .ThenInclude(p => p.Comments); Eager loading prevents lazy load performance issues and the N+1…

Real-world example (ShopNest)

Loading orders with items uses .Include(o => o.Items). Without Include, listing 50 orders can trigger 50 extra queries (N+1).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: re proxies? Lazy loading delays the loading of related data until it's accessed for the first time. EF Core requires proxies for lazy loading: Install NuGet: Microsoft.EntityFrameworkCore.Proxies Enable in OnConfiguring or AddDbContext: options.UseLazyLoadingProxies(); Mark navigation properties as virtual: public virtual ICollection<Post>… Posts { get;…… set;… } EF creates runtime proxies to override navigation…

Real-world example (ShopNest)

Loading orders with items uses .Include(o => o.Items). Without Include, listing 50 orders can trigger 50 extra queries (N+1).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: How to enable lazy loading in EF Core? What are proxies? Lazy loading delays the loading of related data until it's accessed for the first time. EF Core requires proxies for lazy loading: Install NuGet: Microsoft.EntityFrameworkCore.Proxies Enable in OnConfiguring or AddDbContext: options.UseLazyLoadingProxies(); Mark navigation properties as virtual: public virtual ICollection<Post> Posts { get; set; } EF creates…

Explain a bit more

runtime proxies to override navigation properties and load them when accessed.

Real-world example (ShopNest)

Loading orders with items uses .Include(o => o.Items). Without Include, listing 50 orders can trigger 50 extra queries (N+1).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Explicit loading means loading related data manually, after the main entity is loaded.

Explain a bit more

Use when: You need full control over what and when to load You don’t want automatic lazy loading var blog = context.Blogs.First(); context.Entry(blog) .Collection(b => b.Posts) .Load(); context.Entry(blog) .Reference(b => b.Owner) .Load(); ✅ Use .Reference().Load() for single navigation ✅ Use .Collection().Load() for collections Explicit loading means loading related data manually, after the main entity is loaded. Explicit loading means loading related data manually, after the main entity is loaded. Use when: You need full control over what and when to load You don’t want automatic lazy loading

Example code

var blog = context.Blogs.First(); context.Entry(blog) .Collection(b => b.Posts) .Load(); context.Entry(blog) .Reference(b => b.Owner) .Load(); ✅ Use .Reference().Load() for single navigation ✅ Use .Collection().Load() for collections Explicit loading means loading related data manually, after the main entity is loaded. Explicit loading means loading related data manually, after the main entity is loaded. Use when: You need full control over what and when to load You don’t want automatic lazy loading Example: var blog = context.Blogs.First(); context.Entry(blog) .Collection(b => b.Posts) .Load(); context.Entry(blog) .Reference(b => b.Owner) .Load(); ✅ Use .Reference().Load() for single navigation ✅ Use .Collection().Load() for collections Explicit loading means loading related data manually, after the main entity is loaded. Use when: You need full control over what and when to load You don’t want automatic lazy loading Example: var blog = context.Blogs.First(); context.Entry(blog) .Collection(b => b.Posts) .Load(); context.Entry(blog) .Reference(b => b.Owner) .Load(); ✅ Use .Reference().Load() for single navigation ✅ Use .Collection().Load() for collections

Real-world example (ShopNest)

ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details