Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Private fields in your entity class mapped by EF Core instead of public properties. Useful for encapsulating domain logic and controlling property access. Transactions, Concurrency, Security Example code Pr…
Short answer: EF Core automatically wraps SaveChanges() calls in a transaction. Ensures all changes are committed atomically. For multiple SaveChanges() calls, transactions need manual handling. Real-world example (ShopN…
Short answer: Rollback) Use DbContext.Database.BeginTransaction() to start a transaction. Call Commit() to save changes or Rollback() to undo. Real-world example (ShopNest) ShopNest’s order service uses EF Core to save a…
Short answer: (BeginTransaction, Commit, Rollback) Use DbContext.Database.BeginTransaction() to start a transaction. Explain a bit more Call Commit() to save changes or Rollback() to undo. Useful for combining multiple o…
Short answer: Properties marked with [Timestamp] or configured as concurrency tokens. Stored in the database as rowversion/timestamp type or other markers. EF Core checks these tokens during updates/deletes to detect con…
Short answer: Catch DbUpdateConcurrencyException. Reload conflicting entity from database or merge changes. Retry operation or notify the user of conflict. Implement custom conflict resolution logic as needed. Testing, D…
Short answer: Unit Tests: Focus on logic without actual database. Use mocks or in-memory databases to isolate tests. Integration Tests: Use real database (or test instance) to validate EF Core behavior, migrations, and d…
Short answer: EF Core InMemory provider: Lightweight, fast, but doesn’t mimic relational database behavior exactly (no relational constraints, transactions). Other options: SQLite in-memory mode (better relational simula…
Short answer: Mock DbContext using libraries like Moq, but it can be complex due to EF internals. Better to abstract data access via repositories/interfaces, then mock those interfaces in tests. Alternatively, use in-mem…
Short answer: dd-Migration. Maintain separate migration history tables using MigrationsHistoryTable method. Apply migrations independently for each DbContext. Real-world example (ShopNest) When ShopNest adds a DiscountCo…
Short answer: Use separate migration folders per DbContext via the -Context option in Add-Migration. Maintain separate migration history tables using MigrationsHistoryTable method. Apply migrations independently for each…
Short answer: Configure DbContext in Startup or Program to select provider based on environment variables or config files. Use DI to inject correct connection strings and providers. Can use conditional compilation or env…
Short answer: Use migrations scripts with data transformation carefully. Apply backward-compatible schema changes first (add columns instead of drop). Use feature flags or phased deployment. Run migrations during mainten…
Short answer: Use IHostingEnvironment or config flags inside the DbContext OnModelCreating or after migration. Separate seed classes or methods per environment. Use EF Core’s HasData method or custom seed logic at runtim…
Short answer: Use [JsonIgnore] or ReferenceLoopHandling.Ignore in JSON serialization. Use DTOs without circular refs for API responses. Carefully design navigation properties to avoid cycles or use explicit loading. Real…
Short answer: lso Employee)? Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates). lso Employee)? Define navigation property and forei…
Short answer: Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates). Example code Define navigation property and foreign key for self-r…
Short answer: Use FromSqlRaw or FromSqlInterpolated for stored procedures and views. Map views as query types or entities without keys (read-only). For insert/update via SP, call them directly from DbContext. Real-world…
Short answer: Throws InvalidOperationException or returns null since no tracking or lazy loading. Need to attach entity or explicitly load navigation properties. Example code Throws InvalidOperationException or returns n…
Short answer: Use context.Entry(entity).State = EntityState.Detached. Useful to avoid tracking or to simulate detached state. Real-world example (ShopNest) ShopNest’s order service uses EF Core to save an Order and its l…
Short answer: Attach entity, then set only modified properties as Modified. Use context.Entry(entity).Property(p => p.PropertyName).IsModified = true. Useful for PATCH operations. Real-world example (ShopNest) ShopNes…
Short answer: Use libraries like EFCore.BulkExtensions, Z.EntityFramework.Extensions. These provide optimized bulk operations, bypassing EF change tracking for performance. Real-world example (ShopNest) ShopNest’s order…
Short answer: Freelancing success depends on niche clarity, pricing discipline, and reliable delivery. Position yourself around outcomes instead of tasks, and build repeatable systems for sales and execution. This helps…
Short answer: Freelancing success depends on niche clarity, pricing discipline, and reliable delivery. Position yourself around outcomes instead of tasks, and build repeatable systems for sales and execution. This helps…
Short answer: Freelancing success depends on niche clarity, pricing discipline, and reliable delivery. Position yourself around outcomes instead of tasks, and build repeatable systems for sales and execution. This helps…
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Private fields in your entity class mapped by EF Core instead of public properties. Useful for encapsulating domain logic and controlling property access. Transactions, Concurrency, Security
Private fields in your entity class mapped by EF Core instead of public properties. Useful for encapsulating domain logic and controlling property access. Transactions, Concurrency, Security
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: EF Core automatically wraps SaveChanges() calls in a transaction. Ensures all changes are committed atomically. For multiple SaveChanges() calls, transactions need manual handling.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Rollback) Use DbContext.Database.BeginTransaction() to start a transaction. Call Commit() to save changes or Rollback() to undo.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: (BeginTransaction, Commit, Rollback) Use DbContext.Database.BeginTransaction() to start a transaction.
Call Commit() to save changes or Rollback() to undo. Useful for combining multiple operations that should succeed or fail as a unit. using var transaction = context.Database.BeginTransaction(); try { // Perform multiple operations context.SaveChanges(); transaction.Commit(); } catch { transaction.Rollback(); throw; }
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Properties marked with [Timestamp] or configured as concurrency tokens. Stored in the database as rowversion/timestamp type or other markers. EF Core checks these tokens during updates/deletes to detect concurrent changes.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Catch DbUpdateConcurrencyException. Reload conflicting entity from database or merge changes. Retry operation or notify the user of conflict. Implement custom conflict resolution logic as needed. Testing, Deployment, Tools
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Unit Tests: Focus on logic without actual database. Use mocks or in-memory databases to isolate tests. Integration Tests: Use real database (or test instance) to validate EF Core behavior, migrations, and data persistence. Tests cover CRUD operations, queries, and business logic using EF Core.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: EF Core InMemory provider: Lightweight, fast, but doesn’t mimic relational database behavior exactly (no relational constraints, transactions). Other options: SQLite in-memory mode (better relational simulation). Use InMemory for unit tests; SQLite for more realistic integration testing.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Mock DbContext using libraries like Moq, but it can be complex due to EF internals. Better to abstract data access via repositories/interfaces, then mock those interfaces in tests. Alternatively, use in-memory or SQLite database for integration tests instead of mocking DbContext. Miscellaneous / Scenario / Trick Questions
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: dd-Migration. Maintain separate migration history tables using MigrationsHistoryTable method. Apply migrations independently for each DbContext.
When ShopNest adds a DiscountCode column, you create a migration, review the SQL, then apply it on staging before production.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use separate migration folders per DbContext via the -Context option in Add-Migration. Maintain separate migration history tables using MigrationsHistoryTable method. Apply migrations independently for each DbContext.
When ShopNest adds a DiscountCode column, you create a migration, review the SQL, then apply it on staging before production.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Configure DbContext in Startup or Program to select provider based on environment variables or config files. Use DI to inject correct connection strings and providers. Can use conditional compilation or environment-based settings.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use migrations scripts with data transformation carefully. Apply backward-compatible schema changes first (add columns instead of drop). Use feature flags or phased deployment. Run migrations during maintenance windows or use rolling updates.
When ShopNest adds a DiscountCode column, you create a migration, review the SQL, then apply it on staging before production.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use IHostingEnvironment or config flags inside the DbContext OnModelCreating or after migration. Separate seed classes or methods per environment. Use EF Core’s HasData method or custom seed logic at runtime.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use [JsonIgnore] or ReferenceLoopHandling.Ignore in JSON serialization. Use DTOs without circular refs for API responses. Carefully design navigation properties to avoid cycles or use explicit loading.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: lso Employee)? Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates). lso Employee)? Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates). lso Employee)? Define navigation property and foreign key for… self-reference. Use Fluent API: .HasOne(e =>…
e.Manager).WithMany(e => e.Subordinates). lso Employee)? Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates).
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates).
Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates).
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use FromSqlRaw or FromSqlInterpolated for stored procedures and views. Map views as query types or entities without keys (read-only). For insert/update via SP, call them directly from DbContext.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Throws InvalidOperationException or returns null since no tracking or lazy loading. Need to attach entity or explicitly load navigation properties.
Throws InvalidOperationException or returns null since no tracking or lazy loading. Need to attach entity or explicitly load navigation properties.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use context.Entry(entity).State = EntityState.Detached. Useful to avoid tracking or to simulate detached state.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Attach entity, then set only modified properties as Modified. Use context.Entry(entity).Property(p => p.PropertyName).IsModified = true. Useful for PATCH operations.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Short answer: Use libraries like EFCore.BulkExtensions, Z.EntityFramework.Extensions. These provide optimized bulk operations, bypassing EF change tracking for performance.
ShopNest’s order service uses EF Core to save an Order and its line items in one SaveChangesAsync() call inside a transaction.
Freelancing Career & HR Interview Guide · Freelancing
Short answer: Freelancing success depends on niche clarity, pricing discipline, and reliable delivery. Position yourself around outcomes instead of tasks, and build repeatable systems for sales and execution. This helps you attract better clients and reduce income volatility.
Ananya was working at Infosys and needed to handle this situation: how to find freelance clients. She prepared a clear plan with timelines, ownership, and expected outcomes before speaking to HR and her manager. Vikram, who had recently moved to Freshworks, reviewed her approach and helped her tighten the messaging with measurable results. Within a few weeks, Ananya achieved a better career outcome while preserving strong professional relationships.
Capture major decisions in writing to avoid confusion and future disputes.
Freelancing Career & HR Interview Guide · Freelancing
Short answer: Freelancing success depends on niche clarity, pricing discipline, and reliable delivery. Position yourself around outcomes instead of tasks, and build repeatable systems for sales and execution. This helps you attract better clients and reduce income volatility.
Meera was working at Freshworks and needed to handle this situation: how to get international clients. She prepared a clear plan with timelines, ownership, and expected outcomes before speaking to HR and her manager. Rohit, who had recently moved to CRED, reviewed her approach and helped her tighten the messaging with measurable results. Within a few weeks, Meera achieved a better career outcome while preserving strong professional relationships.
Capture major decisions in writing to avoid confusion and future disputes.
Freelancing Career & HR Interview Guide · Freelancing
Short answer: Freelancing success depends on niche clarity, pricing discipline, and reliable delivery. Position yourself around outcomes instead of tasks, and build repeatable systems for sales and execution. This helps you attract better clients and reduce income volatility.
Neha was working at CRED and needed to handle this situation: how to handle difficult clients. She prepared a clear plan with timelines, ownership, and expected outcomes before speaking to HR and her manager. Arjun, who had recently moved to Flipkart, reviewed her approach and helped her tighten the messaging with measurable results. Within a few weeks, Neha achieved a better career outcome while preserving strong professional relationships.
Capture major decisions in writing to avoid confusion and future disputes.