Defining a Model (Using Entity Framework 7)
Recall that a model is the code used to interact with the data in your application. If you work with a database, this code typically returns a list of data or a single record. The code also supports user interaction on that data (create, update, and delete). If you already have a set of classes for working with your database and expressing your business logic, you can use them for your model. If you don’t have these classes, you need to create them.
As an example, imagine that you have a database that contains a Customers
table. You could write a custom class to express the properties and validation rules of a Customer
object. You might also write functionality to get a list of customers, read a single ...
Get Microsoft Visual Studio 2015 Unleashed, Third Edition 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.