Coding Your Model
As you learned previously, with the Code First approach you define entities and associations in code. Let’s provide a simple example, in which you implement business objects like an Author
class and a Book
class representing two entities. Listing 26.7 shows how to define both entities.
Public Class Author Public Property AuthorId As Integer Public Property FirstName As String Public Property LastName As String Public Property Books As ICollection(Of Book)End ClassPublic Class Book Public Property BookId As Integer Public Property Title As String Public Property Author As Author Public Property ISBN As String Public Property ...
Get Visual Basic 2015 Unleashed 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.