
Entity Framework Core
DbContext, DbSet, LINQ queries, tracking, relationships, migrations, best practices
1What is a DbContext in Entity Framework Core?
What is a DbContext in Entity Framework Core?
Resposta
DbContext is the central class in Entity Framework Core that represents a session with the database. It allows configuring the model, performing LINQ queries on entities, and persisting changes through SaveChanges. Each DbContext instance maintains an entity cache and change tracking to optimize persistence operations.
2What is the role of a DbSet<T> in Entity Framework Core?
What is the role of a DbSet<T> in Entity Framework Core?
Resposta
DbSet<T> represents a collection of entities of a specific type in the database context. It exposes CRUD operations (Create, Read, Update, Delete) and serves as the entry point for LINQ queries. Each DbSet typically corresponds to a table in the database and allows adding, removing, or querying entities of that type.
3What is the difference between Add and AddRange in Entity Framework Core?
What is the difference between Add and AddRange in Entity Framework Core?
Resposta
Add adds a single entity to the context while AddRange adds multiple entities in a single operation. For performance reasons, using AddRange is preferred when adding multiple entities as it reduces the number of change detection operations. Both methods mark entities with the Added state until SaveChanges is called.
What does the SaveChanges method do in Entity Framework Core?
When to use the ChangeTracker in Entity Framework Core?
+22 perguntas de entrevista
Outros temas de entrevista .NET
C# Basics
LINQ & Delegates
C# Language Essentials
ASP.NET Core Fundamentals
ASP.NET Core Request Lifecycle
Configuration & Settings
Application Lifecycle
Dependency Injection
Minimal APIs
Web API Development
Async in ASP.NET Core
Authentication & Authorization
HttpClient & Networking
JSON Serialization
Entity Framework Core Advanced
C# Advanced Features
Clean Architecture
Logging, Monitoring & Observability
Unit Testing & xUnit
Integration Testing
Docker & Containerization
NuGet Package Management
Memory Management & GC
Reactive Programming
Async/await & Patterns
.NET Design Patterns
Performance Optimization
Security & Best Practices
SignalR & Real-time
Microservices Architecture
Domine .NET para sua proxima entrevista
Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.
Comece gratis