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 101–125 of 154

Career & HR topics

By tech stack

Mid PDF
Should you use a generic repository? What are the trade-offs?

Short answer: Generic repository provides CRUD for all entity types. Advantages: Reusable and reduces boilerplate. Simple for basic CRUD. Disadvantages: Can become too generic, losing flexibility for complex queries. May…

EF Core Read answer
Mid PDF
Should you use a generic repository?

Short answer: What are the trade-offs? Generic repository provides CRUD for all entity types. Advantages: Reusable and reduces boilerplate. Simple for basic CRUD. Disadvantages: Can become too generic, losing flexibility…

EF Core Read answer
Mid PDF
How to implement repository for EF Core?

Short answer: public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync(); Task AddAsync(T entity); void Update(T entity); void Delete(T enti…

EF Core Read answer
Mid PDF
How to implement repository for EF Core?

Short answer: Sample signature / interface? public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync(); Task AddAsync(T entity); void Update…

EF Core Read answer
Mid PDF
How to implement unit of work with EF Core?

Short answer: public interface IUnitOfWork : IDisposable { IRepository<Customer> Customers { get; } IRepository<Order> Orders { get; } Task<int> CommitAsync(); } Implementation typically injects a singl…

EF Core Read answer
Mid PDF
How to handle transactions across multiple repositories?

Short answer: wait _unitOfWork.CommitAsync(); wait transaction.CommitAsync(); } catch { wait transaction.RollbackAsync(); throw; } wait _unitOfWork.CommitAsync(); wait transaction.CommitAsync(); } catch { wait transactio…

EF Core Read answer
Mid PDF
How to handle transactions across multiple repositories?

Short answer: Use DbContext transaction or IDbContextTransaction: using var transaction = await _context.Database.BeginTransactionAsync(); try { // multiple repository operations await _unitOfWork.CommitAsync(); Example…

EF Core Read answer
Mid PDF
How to test repository or data access layer?

Short answer: Mocking DbContext using frameworks like Moq (complex). Use InMemoryDatabase provider from EF Core for integration-like tests. Abstract dependencies and inject mocked interfaces for isolation. Performance, B…

EF Core Read answer
Mid PDF
What are shadow properties? Practical use cases.

Short answer: Properties not defined in your CLR classes but tracked by EF Core. Useful for storing metadata like CreatedBy, LastModified, or foreign keys without cluttering domain models. Real-world example (ShopNest) S…

EF Core Read answer
Mid PDF
What are shadow properties?

Short answer: Practical use cases. Properties not defined in your CLR classes but tracked by EF Core. Useful for storing metadata like CreatedBy, LastModified, or foreign keys without cluttering domain models. Say this i…

EF Core Read answer
Junior PDF
What is a global query filter? When/why to use it?

Short answer: A filter automatically applied to all queries on an entity. Useful for soft deletes, multi-tenancy (filtering by tenant ID), or data partitioning. Real-world example (ShopNest) ShopNest’s order service uses…

EF Core Read answer
Junior PDF
What is a global query filter?

Short answer: When/why to use it? A filter automatically applied to all queries on an entity. Useful for soft deletes, multi-tenancy (filtering by tenant ID), or data partitioning. Real-world example (ShopNest) ShopNest’…

EF Core Read answer
Mid PDF
How to optimize EF Core performance?

Short answer: Use .AsNoTracking() for read-only queries. Avoid over-fetching: only select needed columns (Select). Use eager loading wisely (Include). Minimize round trips by batching operations. Use compiled queries for…

EF Core Read answer
Junior PDF
What is batching?

Short answer: EF Core batches multiple commands into a single database round trip when possible. Improves performance by reducing network overhead. Real-world example (ShopNest) ShopNest’s order service uses EF Core to s…

EF Core Read answer
Junior PDF
What is batching?

Short answer: How does EF Core handle batch operations? EF Core batches multiple commands into a single database round trip when possible. Improves performance by reducing network overhead. Real-world example (ShopNest)…

EF Core Read answer
Mid PDF
How to handle large datasets / streaming?

Short answer: Use pagination (Skip, Take). Use streaming APIs like IAsyncEnumerable<T> with EF Core 5+. Avoid loading all data into memory at once. Real-world example (ShopNest) ShopNest’s order service uses EF Cor…

EF Core Read answer
Mid PDF
How to use caching with EF Core?

Short answer: EF Core doesn’t have built-in caching for query results. Use second-level caching libraries (like EFCoreSecondLevelCacheInterceptor). Use application-level caching (MemoryCache, Redis) strategically. Real-w…

EF Core Read answer
Mid PDF
How to handle raw SQL or stored procedures when needed?

Short answer: Use FromSqlRaw or ExecuteSqlRaw to execute raw SQL. Map results to entities or DTOs. Use for performance-critical or legacy operations not easily expressed in LINQ. Real-world example (ShopNest) ShopNest’s…

EF Core Read answer
Mid PDF
What are database providers?

Short answer: SQL Server, PostgreSQL, MySQL — differences, limitations? Providers abstract database-specific implementations. Each supports different features & SQL dialects. Some features may not be supported on all…

EF Core Read answer
Mid PDF
What about migrations and model changes when using non-relational / special databases?

Short answer: Migrations support may be limited or unavailable. May require manual scripts or provider-specific tooling. Consider NoSQL-specific approaches for schema changes. Real-world example (ShopNest) When ShopNest…

EF Core Read answer
Mid PDF
How to implement auditing (CreatedAt, UpdatedAt, soft delete)?

Short answer: Use shadow properties or explicit properties for timestamps. Override SaveChanges() to set audit fields. Use global query filters for soft delete support. Real-world example (ShopNest) ShopNest’s order serv…

EF Core Read answer
Junior PDF
What is soft delete?

Short answer: Mark entities as deleted without physically removing them. Implemented using a boolean flag and global query filters to exclude “deleted” records. Real-world example (ShopNest) ShopNest’s order service uses…

EF Core Read answer
Junior PDF
What is soft delete?

Short answer: Implementation strategies in EF Core? Mark entities as deleted without physically removing them. Implemented using a boolean flag and global query filters to exclude “deleted” records. Real-world example (S…

EF Core Read answer
Mid PDF
How to handle shadow foreign keys?

Short answer: EF Core can track foreign keys without them being defined in your model as properties. Useful for cleaner domain models. Real-world example (ShopNest) ShopNest’s order service uses EF Core to save an Order…

EF Core Read answer
Mid PDF
How to use Fluent API features (HasOne, HasMany, WithOne, WithMany)?

Short answer: Configure relationships explicitly. HasOne / WithMany to define navigation properties and cardinality. Offers fine control beyond Data Annotations. Real-world example (ShopNest) ShopNest’s order service use…

EF Core Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Generic repository provides CRUD for all entity types. Advantages: Reusable and reduces boilerplate. Simple for basic CRUD. Disadvantages: Can become too generic, losing flexibility for complex queries. May leak EF Core specifics or cause over-abstraction. Sometimes custom repositories per aggregate are better.

Real-world example (ShopNest)

ShopNest registers AppDbContext as scoped. One HTTP request = one context. Never inject it as a singleton.

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: What are the trade-offs? Generic repository provides CRUD for all entity types. Advantages: Reusable and reduces boilerplate. Simple for basic CRUD. Disadvantages: Can become too generic, losing flexibility for complex queries. May leak EF Core specifics or cause over-abstraction. Sometimes custom repositories per aggregate are better.

Real-world example (ShopNest)

ShopNest registers AppDbContext as scoped. One HTTP request = one context. Never inject it as a singleton.

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: public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync(); Task AddAsync(T entity); void Update(T entity); void Delete(T entity); Task SaveChangesAsync(); } public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync();… Task AddAsync(T entity);…… void Update(T entity); void Delete(T entity); Task…

Explain a bit more

SaveChangesAsync(); } public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync(); Task AddAsync(T entity); void Update(T entity); void Delete(T entity); Task SaveChangesAsync(); } public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync();… Task AddAsync(T entity); void Update(T entity); void Delete(T entity); Task SaveChangesAsync(); }

Real-world example (ShopNest)

ShopNest registers AppDbContext as scoped. One HTTP request = one context. Never inject it as a singleton.

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: Sample signature / interface? public interface IRepository<T> where T : class { Task<T> GetByIdAsync(int id); Task<IEnumerable<T>> GetAllAsync(); Task AddAsync(T entity); void Update(T entity); void Delete(T entity); Task SaveChangesAsync(); }

Real-world example (ShopNest)

ShopNest registers AppDbContext as scoped. One HTTP request = one context. Never inject it as a singleton.

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: public interface IUnitOfWork : IDisposable { IRepository<Customer> Customers { get; } IRepository<Order> Orders { get; } Task<int> CommitAsync(); } Implementation typically injects a single DbContext instance shared across repositories. CommitAsync() calls DbContext.SaveChangesAsync().

Example code

public interface IUnitOfWork : IDisposable
{ IRepository<Customer> Customers { get; } IRepository<Order> Orders { get; } Task<int> CommitAsync(); } Implementation typically injects a single DbContext instance shared across repositories. CommitAsync() calls DbContext.SaveChangesAsync().

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: wait _unitOfWork.CommitAsync(); wait transaction.CommitAsync(); } catch { wait transaction.RollbackAsync(); throw; } wait _unitOfWork.CommitAsync(); wait transaction.CommitAsync(); } catch { wait transaction.RollbackAsync(); throw; } wait _unitOfWork.CommitAsync(); wait transaction.CommitAsync(); } catch { wait transaction.RollbackAsync(); throw; } wait… _unitOfWork.CommitAsync(); wait transaction.CommitAsync(); }…

Explain a bit more

catch { wait transaction.RollbackAsync(); throw; }

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 DbContext transaction or IDbContextTransaction: using var transaction = await _context.Database.BeginTransactionAsync(); try { // multiple repository operations await _unitOfWork.CommitAsync();

Example code

await transaction.CommitAsync();
} catch {
await transaction.RollbackAsync(); throw; }

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: Mocking DbContext using frameworks like Moq (complex). Use InMemoryDatabase provider from EF Core for integration-like tests. Abstract dependencies and inject mocked interfaces for isolation. Performance, Best Practices, & Advanced Features

Real-world example (ShopNest)

ShopNest registers AppDbContext as scoped. One HTTP request = one context. Never inject it as a singleton.

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: Properties not defined in your CLR classes but tracked by EF Core. Useful for storing metadata like CreatedBy, LastModified, or foreign keys without cluttering domain models.

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: Practical use cases. Properties not defined in your CLR classes but tracked by EF Core. Useful for storing metadata like CreatedBy, LastModified, or foreign keys without cluttering domain models.

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 filter automatically applied to all queries on an entity. Useful for soft deletes, multi-tenancy (filtering by tenant ID), or data partitioning.

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: When/why to use it? A filter automatically applied to all queries on an entity. Useful for soft deletes, multi-tenancy (filtering by tenant ID), or data partitioning.

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 .AsNoTracking() for read-only queries. Avoid over-fetching: only select needed columns (Select). Use eager loading wisely (Include). Minimize round trips by batching operations. Use compiled queries for repeated query patterns.

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: EF Core batches multiple commands into a single database round trip when possible. Improves performance by reducing network overhead.

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 does EF Core handle batch operations? EF Core batches multiple commands into a single database round trip when possible. Improves performance by reducing network overhead.

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 pagination (Skip, Take). Use streaming APIs like IAsyncEnumerable<T> with EF Core 5+. Avoid loading all data into memory at once.

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: EF Core doesn’t have built-in caching for query results. Use second-level caching libraries (like EFCoreSecondLevelCacheInterceptor). Use application-level caching (MemoryCache, Redis) strategically.

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 FromSqlRaw or ExecuteSqlRaw to execute raw SQL. Map results to entities or DTOs. Use for performance-critical or legacy operations not easily expressed in LINQ.

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: SQL Server, PostgreSQL, MySQL — differences, limitations? Providers abstract database-specific implementations. Each supports different features & SQL dialects. Some features may not be supported on all providers (e.g., some EF Core features are provider-specific).

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: Migrations support may be limited or unavailable. May require manual scripts or provider-specific tooling. Consider NoSQL-specific approaches for schema changes.

Real-world example (ShopNest)

When ShopNest adds a DiscountCode column, you create a migration, review the SQL, then apply it on staging before production.

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 shadow properties or explicit properties for timestamps. Override SaveChanges() to set audit fields. Use global query filters for soft delete support.

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: Mark entities as deleted without physically removing them. Implemented using a boolean flag and global query filters to exclude “deleted” records.

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: Implementation strategies in EF Core? Mark entities as deleted without physically removing them. Implemented using a boolean flag and global query filters to exclude “deleted” records.

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: EF Core can track foreign keys without them being defined in your model as properties. Useful for cleaner domain models.

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: Configure relationships explicitly. HasOne / WithMany to define navigation properties and cardinality. Offers fine control beyond Data Annotations.

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