
Learn to use entity framework core to map C# objects to a database, manage migrations, seed data, and write efficient queries, while exploring lazy loading and other advanced features.
Discover how Entity Framework acts as an ORM, mapping c-sharp classes to database tables with a db context and db sets, using where and select queries via code-first with providers.
Create a database schema for an Azure DevOps–style project manager using Entity Framework Core, with epic, issue, and task items sharing common fields and type-specific data.
Create a minimal asp.net core web api project in Visual Studio with swagger enabled, and explore the weather forecast endpoint. Simplify the program.cs and prepare for future Entity Framework configuration.
Create c# .net entity framework core entities for workItem, comment, tags, user, and address in an entities folder, detailing fields like state, priority, start date, end date, and remaining work.
Install and configure entity framework core packages, create a DbContext with DbSet properties for tables, and bind the sqlserver connection via dependency injection using the appsettings.development.json file.
Learn how to implement primary keys in Entity Framework Core using int and GUID types, including identity columns and composite keys configured via OnModelCreating.
Learn how entity framework uses conventions to map properties to columns and how to override defaults with data annotations and fluent API, including max length, precision, and required constraints.
Configure default values for new records with entity framework using OnModelCreating and HasDefaultValue. Set default by SQL Server using getUTCDate for createdDate, and use ValueGeneratedOnUpdate to update updatedDate.
Learn to implement a one-to-one relationship in EF Core between user and address, using navigation properties and the fluent API in OnModelCreating, with the foreign key stored in the address table.
Configure one-to-many relationships in Entity Framework Core, linking work items to comments and to authors (users) using hasMany and hasOne and foreign keys like workItemId and authorId.
Configure many-to-many relationships between work items and tags using a join table with the NTT framework in older .NET versions, or use direct lists in newer .NET versions.
Refactor the work item to extract state into a WorkItemState entity, linking it via a many-to-one relationship with a required value max length 50, configured in DbContext.
Learn how to map inheritance in Entity Framework Core using table per hierarchy, with a WorkItem base and three derived types—Epic, Issue, and Task—sharing a single table with a discriminator.
Create and reflect the DbContext in SQL Server, then generate and apply the first migration to build seven tables in the myboardsdb database, reflecting entity configurations and relationships.
Learn how Entity Framework Core detects model changes, creates migrations with add-migration, and applies them via update database, updating the context snapshot and migrations history, and handles merge concerns.
Learn how to perform a custom migration in Entity Framework Core by adding a full name column, migrating data with SQL, and removing first and last name while preserving data.
Generate idempotent sql migration scripts from entity framework migrations for production, enabling review, transactions with rollback, and integration with deployment and CI.
Learn how to undo and remove entity framework core migrations, rollback changes before and after applying to the database, and use update database and remove migration commands.
Refactor the comment entity to reference the user instead of a string author and add a foreign key. Create and apply migrations, then validate the database schema and cascading behavior.
Seed initial data in entity framework core using the model seed data approach with hasData to populate workItemState with to do, doing, and done, and create a migration.
Create an empty migration and seed data manually using the migration builder to insert and delete rows, adding on hold and rejected states to the work item states table.
Learn how to implement custom seeding logic in the Entity Framework Core app by checking the users table, creating two sample users with addresses, and persisting them with save changes.
Learn practical data seeding in EF Core by applying a has data seed for the tag entity, adding five records (web, ui, desktop, api, service) via migration and database update.
Learn to write sql-like queries with the dbcontext and dbset properties, retrieve and filter data, and expose endpoints in a minimal api using order by descending, take, and group by.
Learn to query with a dbContext to filter epics in the onHold state, sort by priority, and find the top author by comments using groupBy and related user details.
Build queries via IQueryable from DbSet and materialize results only when you call a materialization method, executing on the database side and enabling provider-specific SQL translation.
Learn to update data with Entity Framework by retrieving an epic via firstAsync, modifying area, priority, and start date, updating relationships, and persisting changes with saveChanges or saveChangesAsync.
Add data with entity framework core by creating new tag values and related user and address entities, using add, addAsync, addRange, and saveChanges to persist changes.
Load related data with entity framework core by using include to fetch a user and their comments in a single query, and configure the serializer to ignore cycles.
Learn how data deletion works with providers, including cascading deletion in SQL Server, and use Entity Framework remove and remove range to delete related work items, comments, tags, and authors.
Enable client-side cascading deletes in Entity Framework Core. Use the include method to load related comments and rely on client cascade to automatically delete them when removing an author.
Learn how change tracker in a db context detects changes, stores original and current values, and marks entities as added, modified, or deleted, with as no tracking for untracked queries.
Compare ef core change tracking with and without asNoTracking using benchmark.net, measure time and memory, and decide when to use no-tracking for read-only data versus tracking for changes.
Explore executing raw sql with Entity Framework Core using fromSqlRaw and fromSqlInterpolated on DB sets, and execute sql on the DB context for direct updates and procedures.
Explore creating and mapping a view in Entity Framework Core, define a keyless view model, and query the top authors by work items created.
Master owned types in entity framework core by embedding coordinates into address. Configure with the owned attribute or model builder and set precision.
Explore lazy loading in Entity Framework Core, compare it with eager loading, and configure lazy loading with proxies and virtual navigation properties to fetch related data only when needed.
Lazy loading in Entity Framework risks hidden queries and performance issues; use only with team awareness, keep navigation properties virtual, and avoid the lazy loading call in this course.
Enable filtering, sorting, and pagination with Entity Framework Core, and return a paged result DTO that includes items, total items, range, and total pages.
Group entity configurations into dedicated classes using IEntityTypeConfiguration to keep OnModelCreating lean. Apply these configurations automatically with ApplyConfigurationsFromAssembly, letting EF Core call each Configure method for address, workItem, and workItemState.
Scaffold a db context from an existing database with scaffold dbcontext, generating entities and relationships for a SQL Server database like Northwind. Configure the project and connection string.
Add an index on the email column in the users table via Entity Framework Core configuration, and create a composite index on email and full name with optional uniqueness.
Learn how to optimize Entity Framework Core queries by using the select operator to return only needed columns, and combine select and selectMany to flatten data and improve performance.
Explain the n plus one problem in entity framework core, and demonstrate solving it with include for eager loading to fetch users and their comments in one query.
Explore bulk updates in entity framework core by updating multiple records without loading them into memory. Compare pre-.NET 7 approaches using link2db with EF Core 7's native executeUpdate.
Explore bulk updates in EF Core by updating employee notes where higherDate exceeds a date. See how link2db enables a single, efficient update instead of loading records then updating.
Master bulk updates in EF Core 7+ with ExecuteUpdateAsync to update multiple rows in a single SQL command. Filter by higher date and update the notes property.
Generate realistic user and address data using the bogus package, seed your database with EF Core, and explore locales like Polish, randomization, and strict-mode controls.
Learn to implement server-side paging, sorting, and filtering with EF Core using the sieve package, exposing an api endpoint that returns paged epic data with total count.
Master Entity Framework Core: Comprehensive Course with Practical Exercises and Performance Optimization
Creating various types of applications—whether mobile, web, or desktop—almost always requires a robust database to store and manage data efficiently.
While you could learn SQL to write and send queries directly to a database, this approach is often error-prone and makes code maintenance challenging and time-consuming.
A smarter and more efficient solution is to use an ORM (Object-Relational Mapping) tool. An ORM simplifies database communication by allowing you to work with C# objects, which serve as an abstraction of the underlying database, streamlining development and reducing errors.
Entity Framework Core (EF Core) stands out as the most popular .NET ORM, trusted by developers worldwide with over 800 million downloads. Its versatility and power make it a go-to choice for building scalable and high-performance applications.
Hi, I’m Jakub Kozera, a passionate .NET expert, and in this comprehensive EF Core course, I’ll guide you through mastering database operations using EF Core—from foundational concepts to advanced techniques.
What You’ll Learn in This Course
Core Mechanics and Principles: Understand the inner workings of EF Core, its capabilities, and its limitations to make informed decisions in your projects.
Database Creation: Learn to design C# classes that automatically generate a database and configure them to create a table schema that aligns perfectly with your vision.
Entity Relationships: Set up relationships between C# entities to establish seamless database relations, ensuring data integrity and consistency.
Database Migrations: Master database migrations to evolve your database schema as your application grows, with practical strategies for managing changes effectively.
Data Seeding: Implement data seeding to pre-populate your database with essential data, ensuring your application is ready to go from its first launch.
CRUD Operations: Gain hands-on experience with adding, deleting, and modifying records to manage table data efficiently.
Efficient Queries: Write optimized queries to retrieve data with minimal performance overhead, boosting your application’s speed and responsiveness.
Advanced Features: Dive into lazy loading, built-in types, view support, and other advanced EF Core functionalities to unlock its full potential.
Performance Optimization: Explore EF Core’s performance, identify common challenges, and apply proven techniques to resolve performance bottlenecks.
Practical Exercises: Reinforce your learning with hands-on exercises designed to solidify your understanding and build real-world skills.
Why Choose This Course?
Whether you’re a beginner just starting with EF Core or an experienced developer looking to refine your skills, this course is tailored to help you succeed. By the end, you’ll be able to:
Use EF Core confidently to build robust, scalable applications.
Optimize database performance to ensure your applications run smoothly.
Apply best practices to avoid common pitfalls and streamline development.
Added Value for Your Learning Journey
Beyond the core curriculum, this course includes real-world case studies and expert tips from my years of experience as a .NET developer. You’ll also gain access to a community of learners where you can share insights, ask questions, and grow your network. Plus, the course is regularly updated to reflect the latest EF Core features and industry trends, ensuring you stay ahead in the fast-evolving world of .NET development.
This course is your ultimate guide to mastering Entity Framework Core, .NET database development, ORM best practices, database performance optimization, and C# programming. Whether you’re building web applications, mobile apps, or desktop software, this course equips you with the skills to create high-performance, scalable, and maintainable database-driven solutions.
Enroll today and take the first step toward becoming an EF Core expert! By the end of this course, you’ll wield Entity Framework Core with confidence, delivering high-quality applications without worrying about database performance.