© Les Jackson 2020
L. JacksonThe Complete ASP.NET Core 3 API Tutorialhttps://doi.org/10.1007/978-1-4842-6255-9_6

6. Our Model and Repository

Les Jackson1 
(1)
Melbourne, VIC, Australia
 

Chapter Summary

In this chapter we’re going to introduce “data” to our API, so we’ll begin our journey with our Model and Repository classes.

When Done, You Will

  • Understand what a “Model” class is and code one up.

  • Define our Repository Interface, and implement a “mock” instance of it.

  • Understand how we use Dependency Injection to decouple interfaces from implementation.

Our Model

OK so we’ve done the “Controller” part of the MVC pattern (well a bit of it; it’s still not fully complete – but the groundwork is in), so let’s turn our attention to the Model part of the equation. ...

Get The Complete ASP.NET Core 3 API Tutorial: Hands-On Building, Testing, and Deploying now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.