Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
Labs

Guided: Modeling and Relationships with EF Core 10

In this Code Lab, you'll learn advanced data modeling techniques in EF Core 10. You will start with a basic ASP.NET Core application and enhance its data model by implementing Complex Types, mapping JSON data, and configuring many-to-many relationships. The application uses an in-memory database, so no external database setup is required.

Lab platform
Lab Info
Last updated
Feb 28, 2026
Duration
45m

Contact sales

By clicking submit, you agree to our Privacy Policy and Terms of Use, and consent to receive marketing emails from Pluralsight.
Table of Contents
  1. Challenge

    Introduction and Setup

    Welcome to this Code Lab on Advanced Data Modeling with EF Core 10! In this lab, you'll work with a starter ASP.NET Core application scaffold for a university registrar. Your goal is to enhance the application's data model to handle more complex, real-world data requirements.

    The starter project uses an in-memory database, so you can focus entirely on data modeling without needing to set up an external database. You will learn to apply essential techniques like Complex Types, JSON column mapping, and many-to-many relationships. Get started!

    info> If you get stuck, you can find solution files for each task in the solution folder of your filetree.

    This lab experience was developed by the Pluralsight team using Forge, an internally developed AI tool utilizing Gemini technology. All sections were verified by human experts for accuracy prior to publication. For issue reporting, please contact us.

  2. Challenge

    Step 2: Creating the Initial Data Model

    The foundation of any data-driven application is its domain model. You'll start by defining the basic entities for your University Registrar API: Student and Course. You'll also register these entities with EF Core's DbContext so they can be managed and queried.

  3. Challenge

    Step 3: Refactoring to Complex Types

    Your initial Student model has several properties for the address (Street, City, etc.). This is common, but it can be improved. By grouping these properties into a separate Address class and marking it as a ComplexType, you create a more organized and reusable domain model. EF Core maps the properties of the Address object to columns on the Students table, avoiding the need for a separate Addresses table.

  4. Challenge

    Step 4: Mapping JSON Data

    Some data is semi-structured, like a student's academic history. EF Core lets you map a .NET object to a single JSON column. This keeps your model flexible and still queryable.

    Before starting Step 4, complete Steps 2 and 3.

  5. Challenge

    Step 5: Configuring Many-to-Many Relationships

    The relationship between students and courses is a classic many-to-many scenario. A student can enroll in many courses, and a course can have many students. You'll implement this using a join entity called Enrollment. This approach is powerful because the Enrollment entity can also contain additional information about the relationship, such as the Grade a student received in a course.

  6. Challenge

    Step 6: Command-Line Smoke Test

    In this step, you'll run a command-line smoke test that starts your API in the background and exercises it with real HTTP requests. This gives you an end-to-end verification that your application runs and routes correctly.

    1. Open scripts/api-smoke-test.sh and review what it does (start the API, wait for readiness, call key endpoints, then shut the API down).
    2. Run the script:
    bash scripts/api-smoke-test.sh
    

    If the script fails, it prints the HTTP call that failed and the API output log to help you diagnose the problem. Congratulations on completing the lab! You built an advanced EF Core model using complex types, JSON mapping, and a many-to-many relationship with a join entity—then validated the API end-to-end from the command line with a smoke test.

About the author

Pluralsight’s AI authoring technology is designed to accelerate the creation of hands-on, technical learning experiences. Serving as a first-pass content generator, it produces structured lab drafts aligned to learning objectives defined by Pluralsight’s Curriculum team. Each lab is then enhanced by our Content team, who configure the environments, refine instructions, and conduct rigorous technical and quality reviews. The result is a collaboration between artificial intelligence and human expertise, where AI supports scale and efficiency, and Pluralsight experts ensure accuracy, relevance, and instructional quality, helping learners build practical skills with confidence.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight