Modify Student
Modify the student class
Modify the student class as shown below
note the following here
the vehicles property is called a (collection) navigation property
it is required as per the relationship in our domain which says one student can have many vehicles associated with him (one to many)
hash set is very similar to List datatype, but prevents duplicate entries, so it gives an additional safety. We could have used list collection as well
the constructor is initializing the Vehicles collection to avoid checking for null collection later in the code. It is not mandatory but more of a convenience
Last updated