Book Image

ASP.NET Core Essentials

By : Shahed Chowdhuri
Book Image

ASP.NET Core Essentials

By: Shahed Chowdhuri

Overview of this book

<p>ASP.NET Core is the latest collection of Microsoft’s web application development technologies. When you’re trying to reach a broad spectrum of users with a robust web application, ASP.NET Core is there to help you build that application. With the ability to cater to users on desktop, tablet, or smartphone platforms, you can put together a solution that works well anywhere.</p> <p>This book is what you need to get started developing ASP.NET Core applications was quickly as possible; starting by introducing the software and how it can be used in today’s modern world of web applications and smartphone apps. Walking you through the benefits of a Web API to support both applications and mobile apps to give you a solid understanding of the tech to build upon as you see what ASP.NET Core can do for you.</p> <p>The book wraps up with practical guidelines for the use of database technologies, unit tests, security best practices, and cloud deployments for the real world.</p>
Table of Contents (15 chapters)
ASP.NET Core Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Code First approach to database design and relationships


So what exactly is a Code First approach? It is exactly what it sounds like. You can model your database objects as entity classes in your code. To establish relationships between those objects, you can define a class to include other classes as member variables. If you already have an existing database, you can create an entity model in your code to represent some (or all) of your database objects.

From our Patient Records example from Chapter 3 , Understanding MVC, we already have a model class that represents a human. In this chapter, we will add a RobotDoctor class to our project to build a computerized system for a futuristic hospital with robot doctors. Then, we will establish a relationship between Humans and RobotDoctors in the code so that each robot doctor can be assigned to one or more human patients in the database.

Updating the models

In the Models folder of the sample project from Chapter 3 , Understanding MVC, let's add...