0 Replies - 1044 Views - Last Post: 06 July 2014 - 06:36 PM Rate Topic: -----

#1 fishpond  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 14-December 13

Creating Database from Models

Posted 06 July 2014 - 06:36 PM

I've been going through a tutorial on ASP.NET MVC and it has me creating model classes that represent tables. The database is created through a DbContext and the models are represented as tables through DbSet's.

Inside my model classes, I have fields that represent other classes. Some fields are collections of other classes. The tutorial says this is ok because we will use a "lazy" method to load data into these fields from our database using the "virtual" keyword.

Is this really a good way to do it? If we're using a database, instead of using objects, shouldn't we use foreign keys instead?

This post has been edited by fishpond: 06 July 2014 - 06:41 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1