Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: Convert CLR types to database-compatible types and vice versa. Example: storing an enum as a string or encrypted data. What interviewers expect A clear definition tied to EF Core in Entity Framework Core projects…
Answer: Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer). What interviewers expect A clear definition tied to EF Core in Entity Frame…
Answer: When to use them? Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer). What interviewers expect A clear definition tied to EF Co…
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 What interviewers exp…
Answer: EF Core automatically wraps SaveChanges() calls in a transaction. Ensures all changes are committed atomically. For multiple SaveChanges() calls, transactions need manual handling. What interviewers expect A clea…
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 t…
(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…
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 concurren…
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, Deploym…
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 persistenc…
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 InM…
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…
Answer: dd-Migration. Maintain separate migration history tables using MigrationsHistoryTable method. Apply migrations independently for each DbContext. What interviewers expect A clear definition tied to EF Core in Enti…
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 DbCon…
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 environme…
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 o…
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. Wha…
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. What inter…
Answer: lso Employee)? Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates). What interviewers expect A clear definition tied…
Answer: Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates). What interviewers expect A clear definition tied to EF Core in E…
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. What interviewers…
Answer: Throws InvalidOperationException or returns null since no tracking or lazy loading. Need to attach entity or explicitly load navigation properties. What interviewers expect A clear definition tied to EF Core in E…
Answer: Use context.Entry(entity).State = EntityState.Detached. Useful to avoid tracking or to simulate detached state. What interviewers expect A clear definition tied to EF Core in Entity Framework Core projects Trade-…
Answer: Attach entity, then set only modified properties as Modified. Use context.Entry(entity).Property(p => p.PropertyName).IsModified = true. Useful for PATCH operations. What interviewers expect A clear defini…
Answer: Use libraries like EFCore.BulkExtensions, Z.EntityFramework.Extensions. These provide optimized bulk operations, bypassing EF change tracking for performance. What interviewers expect A clear definition tied to E…
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Convert CLR types to database-compatible types and vice versa. Example: storing an enum as a string or encrypted data.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: When to use them? Complex types that don’t have their own identity and lifecycle. Useful for grouping related properties (like Address inside a Customer).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
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
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: EF Core automatically wraps SaveChanges() calls in a transaction. Ensures all changes are committed atomically. For multiple SaveChanges() calls, transactions need manual handling.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Rollback)
using var transaction = context.Database.BeginTransaction();
try {
// Perform multiple operations
context.SaveChanges();
transaction.Commit();
} catch {
transaction.Rollback();
throw;
}Entity Framework Core Entity Framework Core Tutorial · EF Core
(BeginTransaction, Commit,
Rollback)
using var transaction = context.Database.BeginTransaction();
try {
// Perform multiple operations
context.SaveChanges();
transaction.Commit();
} catch {
transaction.Rollback();
throw;
Entity Framework Core Entity Framework Core Tutorial · EF Core
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
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
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
databases to isolate tests.
migrations, and data persistence.
Entity Framework Core Entity Framework Core Tutorial · EF Core
database behavior exactly (no relational constraints, transactions).
Entity Framework Core Entity Framework Core Tutorial · EF Core
in tests.
mocking DbContext.
Miscellaneous / Scenario / Trick
Questions
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: dd-Migration. Maintain separate migration history tables using MigrationsHistoryTable method. Apply migrations independently for each DbContext.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Entity Framework Core Entity Framework Core Tutorial · EF Core
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: lso Employee)? Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Define navigation property and foreign key for self-reference. Use Fluent API: .HasOne(e => e.Manager).WithMany(e => e.Subordinates).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Throws InvalidOperationException or returns null since no tracking or lazy loading. Need to attach entity or explicitly load navigation properties.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Use context.Entry(entity).State = EntityState.Detached. Useful to avoid tracking or to simulate detached state.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Attach entity, then set only modified properties as Modified. Use context.Entry(entity).Property(p => p.PropertyName).IsModified = true. Useful for PATCH operations.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Entity Framework Core Entity Framework Core Tutorial · EF Core
Answer: Use libraries like EFCore.BulkExtensions, Z.EntityFramework.Extensions. These provide optimized bulk operations, bypassing EF change tracking for performance.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.