Junior
From PDF
MVC
ASP.NET Core MVC
What is EF Core?
Short answer: Entity Framework Core (EF Core) is a modern, lightweight, cross-platform ORM (Object Relational Mapper) from Microsoft. It allows .NET developers to work with databases using .NET objects, without writing most SQL manually. {
Example code
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { } public DbSet<Product> Products { get; set; }
} 🧱 4. What are Migrations? Migrations allow you to evolve your database schema as your models change, without losing existing data. Commands: dotnet ef migrations add InitialCreate dotnet ef database update This creates a Migrations folder with code that applies schema changes automatically. 🧩 5. What is the OnModelCreating method used for? OnModelCreating is where you configure entity behavior and relationships using the Fluent API. Example: protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Product>() .Property(p => p.Name) .HasMaxLength(100) .IsRequired(); modelBuilder.Entity<Order>() .HasMany(o => o.Items) .WithOne(i => i.Order) .HasForeignKey(i => i.OrderId);
} Use it for constraints, relationships, indexes, seeding, and more. 💤 6. How do you enable Lazy Loading in EF Core? Lazy loading means related entities are loaded automatically when accessed. To enable it: Install the package: dotnet add package Microsoft.EntityFrameworkCore.Proxies
Real-world example (ShopNest)
ShopNest admin screens use MVC: controller loads data, Razor view renders HTML, Tag Helpers build forms safely.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png