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 1076–1100 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
How to execute stored procedures (if possible)?

Short answer: Stored procedures can be called via raw SQL or FromSqlRaw: var orders = context.Orders .FromSqlRaw("EXEC GetOrdersByCustomer @CustomerId = {0}", customerId) .ToList(); For non-query SPs, use Datab…

EF Core Read answer
Mid PDF
How to use compiled queries for performance?

Short answer: Precompile frequently used queries to improve performance: private static readonly Func<MyDbContext, int, Product> _getProductById = EF.CompileQuery((MyDbContext ctx, int id) => ctx.Products.First(…

EF Core Read answer
Mid PDF
How to log or view the SQL that EF Core generates?

Short answer: Enable logging in DbContext options: optionsBuilder .UseSqlServer(connectionString) .LogTo(Console.WriteLine, LogLevel.Information); Or configure logging in ASP.NET Core logging pipeline. Repository Pattern…

EF Core Read answer
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
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
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
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
Mid PDF
What are value converters in EF Core?

Short answer: Convert CLR types to database-compatible types and vice versa. Example: storing an enum as a string or encrypted data. Real-world example (ShopNest) ShopNest’s order service uses EF Core to save an Order an…

EF Core Read answer
Mid PDF
What are owned entity types? When to use them?

Short answer: Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer). Real-world example (ShopNest) ShopNest’s order service uses EF Core t…

EF Core Read answer
Mid PDF
What are owned entity types?

Short answer: When to use them? Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer). Real-world example (ShopNest) ShopNest’s order serv…

EF Core Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Stored procedures can be called via raw SQL or FromSqlRaw: var orders = context.Orders .FromSqlRaw("EXEC GetOrdersByCustomer @CustomerId = {0}", customerId) .ToList(); For non-query SPs, use Database.ExecuteSqlRaw().

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: Precompile frequently used queries to improve performance: private static readonly Func<MyDbContext, int, Product> _getProductById = EF.CompileQuery((MyDbContext ctx, int id) => ctx.Products.First(p => p.Id == id)); // Usage: var product = _getProductById(context, 5);

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: Enable logging in DbContext options: optionsBuilder .UseSqlServer(connectionString) .LogTo(Console.WriteLine, LogLevel.Information); Or configure logging in ASP.NET Core logging pipeline. Repository Pattern & Unit of Work

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: 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: 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: 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: 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

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Convert CLR types to database-compatible types and vice versa. Example: storing an enum as a string or encrypted data.

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: Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer).

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 to use them? Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer).

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