Interview Q&A

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

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 26–50 of 153

Career & HR topics

By tech stack

Mid PDF
How does Code First handle schema changes in the database?

EF Core uses migrations to track and apply schema changes: You modify your C# models. Use Add-Migration to create a migration class. Use Update-Database to apply the changes to the DB. EF Core compares the model to the c…

EF Core Read answer
Mid PDF
How do you configure mappings (table names, column names, keys) using Data Annotations vs Fluent API?

🧩 Data Annotations (in the entity class): [Table("Users")] public class User { [Key] public int Id { get; set; } [Column("UserName")] public string Name { get; set; } } 🧠 Fluent API (in OnModelCreating): modelBuilder.E…

EF Core Read answer
Mid PDF
What are migrations? How are they used in Code First?

Migrations in EF Core are a way to: Track schema changes over time Apply those changes to the database 📦 Basic commands: Add-Migration MigrationName Update-Database Remove-Migration Script-Migration 🔄 Migrations are cl…

EF Core Read answer
Mid PDF
What are migrations?

How are they used in Code First? Migrations in EF Core are a way to: Track schema changes over time Apply those changes to the database 📦 Basic commands: Add-Migration MigrationName Update-Database Remove-Migration Scri…

EF Core Read answer
Mid PDF
How do you create a migration? (e.g. Add-Migration) Use one of the following commands: .NET CLI: dotnet ef migrations add MigrationName ● Package Manager Console:

Answer: dd-Migration MigrationName This creates a migration file with Up() and Down() methods, and a snapshot of the current model. What interviewers expect A clear definition tied to EF Core in Entity Framework Core pro…

EF Core Read answer
Mid PDF
How do you create a migration?

(e.g. Add-Migration) Use one of the following commands: .NET CLI: dotnet ef migrations add MigrationName Package Manager Console: Add-Migration MigrationName This creates a migration file with Up() and Down() methods, an…

EF Core Read answer
Mid PDF
How to apply migrations to the database? (e.g. Update-Database)

Answer: pply the migration to your database using: .NET CLI: dotnet ef database update Package Manager Console: Update-Database EF Core translates your model changes into SQL and executes them against the database. What…

EF Core Read answer
Mid PDF
How to apply migrations to the database?

Answer: (e.g. Update-Database) Apply the migration to your database using: .NET CLI: dotnet ef database update Package Manager Console: Update-Database EF Core translates your model changes into SQL and executes them aga…

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

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, na…

EF Core Read answer
Mid PDF
How do you rollback or revert a migration?

Answer: To remove the last migration before applying it: dotnet ef migrations remove To rollback the database to a previous migration: dotnet ef database update MigrationName To rollback all migrations: dotnet ef databas…

EF Core Read answer
Mid PDF
What are migration scripts? How to generate SQL scripts for migrations?

Answer: Generate SQL script using: dotnet ef migrations script To script a specific range: dotnet ef migrations script FromMigration ToMigration These scripts are useful for deploying to production environments or execut…

EF Core Read answer
Mid PDF
What are migration scripts?

How to generate SQL scripts for migrations? Generate SQL script using: dotnet ef migrations script To script a specific range: dotnet ef migrations script FromMigration ToMigration These scripts are useful for deploying…

EF Core Read answer
Mid PDF
How do you seed initial data using migrations / EF Core configuration?

Answer: Use the HasData() method in OnModelCreating(): modelBuilder.Entity<User>().HasData( new User { Id = 1, Name = "Admin" } ); Data is inserted automatically during Update-Database. Changes to seed data…

EF Core Read answer
Mid PDF
How do you handle conflicts in migrations (e.g. when team members make schema changes)?

Best practices: Communicate and coordinate migration changes. Always pull and apply the latest migrations before adding a new one. If conflicts arise: Resolve merge conflicts in migration files manually. Rebuild ModelSna…

EF Core Read answer
Mid PDF
How to handle migrations in production / CI/CD pipelines?

Generate SQL script from tested migrations. Manually review and apply via DBA or DevOps tools. Use EF Core tools in CI/CD (e.g., GitHub Actions, Azure DevOps): dotnet ef database update --no-build ● Always backup the dat…

EF Core Read answer
Mid PDF
What are scaffolded migrations?

Answer: Scaffolded migrations are the automatically generated classes that contain Up() and Down() methods. They are generated based on model differences. You can manually edit these files to: Add custom SQL Rename colum…

EF Core Read answer
Mid PDF
How can you customize migrations (e.g. modify Up/Down methods, custom SQL)?

You can manually edit migration files after scaffolding: protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql("UPDATE Users SET IsActive = 1 WHERE IsActive IS NULL"); } Add indexes, constr…

EF Core Read answer
Junior PDF
What is change tracking in EF Core? Change tracking is the process by which EF Core keeps track of changes made to entities

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. What interviewers expect A clear definition tied to EF Co…

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

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 S…

EF Core Read answer
Mid PDF
What are the different entity states? EF Core uses these EntityState values: State Description

dded New entity to be inserted into the database Modified Entity has been changed and will be updated Deleted Entity will be deleted from the database Detached Entity is not tracked by the context Unchange No changes hav…

EF Core Read answer
Mid PDF
What are the different entity states?

EF Core uses these EntityState values: State Description Added New entity to be inserted into the database Modified Entity has been changed and will be updated Deleted Entity will be deleted from the database Detached En…

EF Core Read answer
Mid PDF
How does EF Core detect changes in entity properties? EF Core tracks changes via: ● Snapshot change tracking: EF stores a snapshot of original values when entities

Answer: re loaded, and compares them before saving. Notifications: If your entities implement INotifyPropertyChanged, EF can track changes immediately. EF compares the current values to the original snapshot during SaveC…

EF Core Read answer
Mid PDF
How does EF Core detect changes in entity properties?

EF Core tracks changes via: Snapshot change tracking: EF stores a snapshot of original values when entities are loaded, and compares them before saving. Notifications: If your entities implement INotifyPropertyChanged, E…

EF Core Read answer
Junior PDF
What is the difference between tracked and untracked queries? ● Tracked queries: EF Core tracks entities returned from the query. Changes to them

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.AsNoTra…

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

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): va…

EF Core Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

EF Core uses migrations to track and apply schema changes:

  • You modify your C# models.
  • Use Add-Migration to create a migration class.
  • Use Update-Database to apply the changes to the DB.

EF Core compares the model to the current schema to generate SQL.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

🧩 Data Annotations (in the entity class):

[Table("Users")]

public class User
{

[Key]

public int Id { get; set; }

[Column("UserName")]

public string Name { get; set; }
}

🧠 Fluent API (in OnModelCreating):

modelBuilder.Entity<User>()

.ToTable("Users")

.HasKey(u => u.Id);

modelBuilder.Entity<User>()

.Property(u => u.Name)

.HasColumnName("UserName");

📌 Fluent API is more powerful and flexible, preferred for complex configurations.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Migrations in EF Core are a way to:

  • Track schema changes over time
  • Apply those changes to the database

📦 Basic commands:

  • Add-Migration MigrationName
  • Update-Database
  • Remove-Migration
  • Script-Migration

🔄 Migrations are classes containing Up() and Down() methods (for applying and reverting

changes).

📌 They are essential for schema versioning in Code First.

Entity Framework Core – Migrations

Interview Questions
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

How are they used in Code First?

Migrations in EF Core are a way to:

  • Track schema changes over time
  • Apply those changes to the database

📦 Basic commands:

  • Add-Migration MigrationName
  • Update-Database
  • Remove-Migration
  • Script-Migration

🔄 Migrations are classes containing Up() and Down() methods (for applying and reverting

changes).

📌 They are essential for schema versioning in Code First.

Entity Framework Core – Migrations

Interview Questions

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: dd-Migration MigrationName This creates a migration file with Up() and Down() methods, and a snapshot of the current model.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

(e.g. Add-Migration)

Use one of the following commands:

.NET CLI:

dotnet ef migrations add MigrationName

Package Manager Console:

Add-Migration MigrationName

This creates a migration file with Up() and Down() methods, and a snapshot of the current

model.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: pply the migration to your database using: .NET CLI: dotnet ef database update Package Manager Console: Update-Database EF Core translates your model changes into SQL and executes them against the database.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: (e.g. Update-Database) Apply the migration to your database using: .NET CLI: dotnet ef database update Package Manager Console: Update-Database EF Core translates your model changes into SQL and executes them against the database.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • 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.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: To remove the last migration before applying it: dotnet ef migrations remove To rollback the database to a previous migration: dotnet ef database update MigrationName To rollback all migrations: dotnet ef database update 0

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: Generate SQL script using: dotnet ef migrations script To script a specific range: dotnet ef migrations script FromMigration ToMigration These scripts are useful for deploying to production environments or executing via CI/CD pipelines.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

How to generate SQL scripts for

migrations?

Generate SQL script using:

dotnet ef migrations script

To script a specific range:

dotnet ef migrations script FromMigration ToMigration

These scripts are useful for deploying to production environments or executing via CI/CD

pipelines.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: Use the HasData() method in OnModelCreating(): modelBuilder.Entity&lt;User&gt;().HasData( new User { Id = 1, Name = "Admin" } ); Data is inserted automatically during Update-Database. Changes to seed data require a new migration.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Best practices:

  • Communicate and coordinate migration changes.
  • Always pull and apply the latest migrations before adding a new one.
  • If conflicts arise:
  • Resolve merge conflicts in migration files manually.
  • Rebuild ModelSnapshot as needed.
  • Consider squashing or reorganizing migrations.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • Generate SQL script from tested migrations.
  • Manually review and apply via DBA or DevOps tools.

Use EF Core tools in CI/CD (e.g., GitHub Actions, Azure DevOps):

dotnet ef database update --no-build

  • ● Always backup the database before applying migrations in production.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: Scaffolded migrations are the automatically generated classes that contain Up() and Down() methods. They are generated based on model differences. You can manually edit these files to: Add custom SQL Rename columns Seed data, etc.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

You can manually edit migration files after scaffolding:

protected override void Up(MigrationBuilder migrationBuilder)

{

migrationBuilder.Sql("UPDATE Users SET IsActive = 1 WHERE

IsActive IS NULL");

}
  • Add indexes, constraints, stored procedures.
  • Use raw SQL or Fluent API.
  • Be cautious to maintain idempotency and correctness.

Entity Framework Core – Change

Tracking & Concurrency

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

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.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

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.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

dded New entity to be inserted into the database

Modified Entity has been changed and will be updated

Deleted Entity will be deleted from the database

Detached Entity is not tracked by the context

Unchange

No changes have been made since it was

loaded

You can check/set the state via:

context.Entry(entity).State = EntityState.Modified;
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

EF Core uses these EntityState values:

State Description

Added New entity to be inserted into the database

Modified Entity has been changed and will be updated

Deleted Entity will be deleted from the database

Detached Entity is not tracked by the context

Unchange

No changes have been made since it was

loaded

You can check/set the state via:

context.Entry(entity).State = EntityState.Modified;

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: re loaded, and compares them before saving. Notifications: If your entities implement INotifyPropertyChanged, EF can track changes immediately. EF compares the current values to the original snapshot during SaveChanges().

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

EF Core tracks changes via:

  • Snapshot change tracking: EF stores a snapshot of original values when entities

are loaded, and compares them before saving.

  • Notifications: If your entities implement INotifyPropertyChanged, EF can track

changes immediately.

EF compares the current values to the original snapshot during SaveChanges().

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

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();
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • 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();

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