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 1576–1600 of 4608

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Difference between IQueryable<T> and IEnumerable<T> in EF Core.?

Short answer: IQueryable&lt;T&gt;: Represents a query against the data source. Query is translated to SQL and executed on the database. Supports deferred execution. IEnumerable&lt;T&gt;: Represents an in-memory collectio…

EF Core Read answer
Mid PDF
How to write joins (inner, left) in LINQ with EF Core?

Short answer: Inner join Example code var query = from c in context.Customers join o in context.Orders on c.Id equals o.CustomerId select new { c.Name, o.OrderDate }; Left join (using DefaultIfEmpty()): var query = from…

EF Core Read answer
Mid PDF
How to do grouping, aggregation (Sum, Count, Max, Min) via LINQ?

Short answer: var groupedData = context.Orders .GroupBy(o =&gt; o.CustomerId) .Select(g =&gt; new { CustomerId = g.Key, TotalOrders = g.Count(), TotalAmount = g.Sum(o =&gt; o.Amount), MaxAmount = g.Max(o =&gt; o.Amount),…

EF Core Read answer
Mid PDF
How to do filtering (Where), ordering (OrderBy, ThenBy, OrderByDescending)?

Short answer: Filtering: var filtered = context.Products.Where(p =&gt; p.Price &gt; 100); Ordering: var ordered = context.Products .OrderBy(p =&gt; p.Category) .ThenByDescending(p =&gt; p.Price); Real-world example (Shop…

EF Core Read answer
Junior PDF
What is projection (Select) and why is it useful?

Short answer: Projection transforms entities into custom shapes, e.g., DTOs. var projected = context.Products Example code .Select(p =&gt; new { p.Name, p.Price }); Useful for: Reducing data load. Returning only needed f…

EF Core Read answer
Mid PDF
How to use First, FirstOrDefault, Single, SingleOrDefault etc.?

Short answer: First(): Returns the first element, throws if none found. FirstOrDefault(): Returns first element or default (null) if none. Single(): Returns the single element, throws if zero or more than one. SingleOrDe…

EF Core Read answer
Mid PDF
What about pagination? (Skip, Take)

Short answer: Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p =&gt; p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); Use .Skip() and .Take() for pagination: var page2…

EF Core Read answer
Mid PDF
What about pagination?

Short answer: (Skip, Take) Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p =&gt; p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); Real-world example (ShopNest) ShopNes…

EF Core Read answer
Mid PDF
How to do raw SQL queries in EF Core? (FromSqlRaw, etc.)

Short answer: Use FromSqlRaw() or FromSqlInterpolated(): var products = context.Products .FromSqlRaw(&quot;SELECT * FROM Products WHERE Price &gt; {0}&quot;, 100) .ToList(); Use FromSqlRaw() or FromSqlInterpolated(): var…

EF Core Read answer
Mid PDF
How to do raw SQL queries in EF Core?

Short answer: (FromSqlRaw, etc.) Use FromSqlRaw() or FromSqlInterpolated(): var products = context.Products .FromSqlRaw(&quot;SELECT * FROM Products WHERE Price &gt; {0}&quot;, 100) .ToList(); Real-world example (ShopNes…

EF Core Read answer
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(&quot;EXEC GetOrdersByCustomer @CustomerId = {0}&quot;, 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&lt;MyDbContext, int, Product&gt; _getProductById = EF.CompileQuery((MyDbContext ctx, int id) =&gt; 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
Junior PDF
What is the Repository Pattern?

Short answer: pplication. Pros: Decouples data access logic from business logic. Easier to mock/test. Encapsulates queries in a single place. Cons: EF Core’s DbContext already acts like a repository and unit of work. Can…

EF Core Read answer
Junior PDF
What is the Repository Pattern?

Short answer: Why use it with EF Core (pros and cons)? Repository Pattern abstracts data access logic, exposing CRUD methods to the application. Pros: Decouples data access logic from business logic. Easier to mock/test.…

EF Core Read answer
Junior PDF
What is the Unit of Work pattern?

Short answer: Unit of Work maintains a list of operations to be committed as a single transaction. EF Core’s DbContext implements Unit of Work, tracking changes and coordinating commits (SaveChanges()). Real-world exampl…

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&lt;T&gt; where T : class { Task&lt;T&gt; GetByIdAsync(int id); Task&lt;IEnumerable&lt;T&gt;&gt; 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&lt;T&gt; where T : class { Task&lt;T&gt; GetByIdAsync(int id); Task&lt;IEnumerable&lt;T&gt;&gt; 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&lt;Customer&gt; Customers { get; } IRepository&lt;Order&gt; Orders { get; } Task&lt;int&gt; 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

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: IQueryable<T>: Represents a query against the data source. Query is translated to SQL and executed on the database. Supports deferred execution. IEnumerable<T>: Represents an in-memory collection. LINQ operators execute in memory. Usually results after the query has executed and data is loaded.

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

Example code

var query = from c in context.Customers join o in context.Orders on c.Id equals o.CustomerId select new { c.Name, o.OrderDate }; Left join (using DefaultIfEmpty()): var query = from c in context.Customers join o in context.Orders on c.Id equals o.CustomerId into orders from o in orders.DefaultIfEmpty() select new { c.Name, OrderDate = o != null ? o.OrderDate : (DateTime?)null };

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: var groupedData = context.Orders .GroupBy(o => o.CustomerId) .Select(g => new { CustomerId = g.Key, TotalOrders = g.Count(), TotalAmount = g.Sum(o => o.Amount), MaxAmount = g.Max(o => o.Amount), MinAmount = g.Min(o => o.Amount) });

Example code

var groupedData = context.Orders .GroupBy(o => o.CustomerId) .Select(g => new { CustomerId = g.Key, TotalOrders = g.Count(), TotalAmount = g.Sum(o => o.Amount), MaxAmount = g.Max(o => o.Amount), MinAmount = g.Min(o => o.Amount) });

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: Filtering: var filtered = context.Products.Where(p => p.Price > 100); Ordering: var ordered = context.Products .OrderBy(p => p.Category) .ThenByDescending(p => p.Price);

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: Projection transforms entities into custom shapes, e.g., DTOs. var projected = context.Products

Example code

.Select(p => new { p.Name, p.Price }); Useful for: Reducing data load. Returning only needed fields. Mapping to custom types.

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: First(): Returns the first element, throws if none found. FirstOrDefault(): Returns first element or default (null) if none. Single(): Returns the single element, throws if zero or more than one. SingleOrDefault(): Returns the single element or default if none; throws if more than one.

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 .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p => p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p => p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); Real-world example… (ShopNest) ShopNest’s order…… service uses EF Core to save an Order and its line items in one…

Explain a bit more

SaveChangesAsync() call inside a transaction. Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p => p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p => p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); 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: (Skip, Take) Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p => p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList();

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 FromSqlInterpolated(): var products = context.Products .FromSqlRaw("SELECT * FROM Products WHERE Price > {0}", 100) .ToList(); Use FromSqlRaw() or FromSqlInterpolated(): var products = context.Products .FromSqlRaw("SELECT * FROM Products WHERE Price > {0}", 100) .ToList(); Use FromSqlRaw() or FromSqlInterpolated(): var products = context.

Explain a bit more

Products .FromSqlRaw("SELECT * FROM Products WHERE Price > {0}", 100) .ToList(); Use FromSqlRaw() or FromSqlInterpolated(): var products = context.Products .FromSqlRaw("SELECT * FROM Products WHERE Price > {0}", 100) .ToList();

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: (FromSqlRaw, etc.) Use FromSqlRaw() or FromSqlInterpolated(): var products = context.Products .FromSqlRaw("SELECT * FROM Products WHERE Price > {0}", 100) .ToList();

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: 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: pplication. Pros: Decouples data access logic from business logic. Easier to mock/test. Encapsulates queries in a single place. Cons: EF Core’s DbContext already acts like a repository and unit of work. Can add unnecessary abstraction and boilerplate. May limit EF Core’s powerful querying 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: Why use it with EF Core (pros and cons)? Repository Pattern abstracts data access logic, exposing CRUD methods to the application. Pros: Decouples data access logic from business logic. Easier to mock/test. Encapsulates queries in a single place. Cons: EF Core’s DbContext already acts like a repository and unit of work. Can add unnecessary abstraction and boilerplate. May limit EF Core’s powerful querying 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: Unit of Work maintains a list of operations to be committed as a single transaction. EF Core’s DbContext implements Unit of Work, tracking changes and coordinating commits (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: 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
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