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 1026–1050 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
What are scalar properties, complex properties, and shadow properties?

Short answer: Scalar: Simple types like int, string, DateTime Complex: Nested objects mapped to multiple columns (Value objects) Shadow: Properties not defined in the .NET class but tracked by EF Core Real-world example…

EF Core Read answer
Mid PDF
What are the benefits of using EF Core?

Short answer: Productivity via abstraction from SQL Cross-platform support Strongly-typed LINQ queries Migration support Tracks changes automatically Works well with dependency injection Real-world example (ShopNest) Sho…

EF Core Read answer
Mid PDF
What are some disadvantages / pitfalls of using EF Core?

Short answer: May generate inefficient SQL for complex queries Learning curve for advanced features Less control over fine-tuned SQL performance Not ideal for high-performance bulk operations Entity Framework Core – Sche…

EF Core Read answer
Mid PDF
How do you reverse engineer a database in EF Core (DB First) into entity classes & DbContext?

Short answer: Use the CLI or Package Manager Console: dotnet ef dbcontext scaffold "YourConnectionString" Microsoft.EntityFrameworkCore.SqlServer -o Models OR Scaffold-DbContext "YourConnectionString"…

EF Core Read answer
Mid PDF
How does Code First handle schema changes in the database?

Short answer: 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…

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

Short answer: 🧩 Data Annotations (in the entity class): [Table("Users")] public class User Example code { [Key] public int Id { get; set; } [Column("UserName")] public string Name { get; set; } } 🧠…

EF Core Read answer
Mid PDF
What are migrations?

Short answer: 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 🔄 Mig…

EF Core Read answer
Mid PDF
What are migrations?

Short answer: 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-…

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

Short answer: dd-Migration MigrationName This creates a migration file with Up() and Down() methods, and a snapshot of the current model. Real-world example (ShopNest) When ShopNest adds a DiscountCode column, you create…

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

Short answer: (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…

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

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

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

Short 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 th…

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

Short 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 d…

EF Core Read answer
Mid PDF
What are migration scripts?

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

EF Core Read answer
Mid PDF
What are migration scripts?

Short answer: 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…

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

Short 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 s…

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

Short answer: 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. Re…

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

Short answer: 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…

EF Core Read answer
Mid PDF
What are scaffolded migrations?

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

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

Short answer: 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"…

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

Short answer: 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…

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

Short answer: 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 databa…

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

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

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

Short answer: 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 INotifyProp…

EF Core Read answer
Mid PDF
How to disable change tracking globally?

Short answer: You can disable tracking by default for a specific DbContext using: optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTrac king); Or per-query using .AsNoTracking(). Real-world example (ShopNe…

EF Core Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

Short answer: Scalar: Simple types like int, string, DateTime Complex: Nested objects mapped to multiple columns (Value objects) Shadow: Properties not defined in the .NET class but tracked by EF Core

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: Productivity via abstraction from SQL Cross-platform support Strongly-typed LINQ queries Migration support Tracks changes automatically Works well with dependency injection

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: May generate inefficient SQL for complex queries Learning curve for advanced features Less control over fine-tuned SQL performance Not ideal for high-performance bulk operations Entity Framework Core – Schema Design & Migrations Interview Questions

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 the CLI or Package Manager Console: dotnet ef dbcontext scaffold "YourConnectionString" Microsoft.EntityFrameworkCore.SqlServer -o Models OR Scaffold-DbContext "YourConnectionString" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models ✅ It generates: Entity classes DbContext class Mappings based on database schema

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

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: 🧩 Data Annotations (in the entity class): [Table("Users")] public class User

Example code

{ [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.

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

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

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: dd-Migration MigrationName This creates a migration file with Up() and Down() methods, and a snapshot of the current model.

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

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

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

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

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

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

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 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 require a new migration.

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

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

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

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

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: 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; Example… code dded… New… entity to be inserted into the database Modified Entity…

Explain a bit more

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; 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; Example… code dded New entity…

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

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: 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().

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 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().

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: You can disable tracking by default for a specific DbContext using: optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTrac king); Or per-query using .AsNoTracking().

Real-world example (ShopNest)

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

Say this in the interview

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