I am coding an MVC5 C# Internet application and I have a class called MapCompany
and a class classed MapLocation
.
Each MapCompany
has a list of MapCompany's
. My question is, for the context class, should I just have a DbSet<MapCompany>
, and add MapLocations
to the specific MapCompany
, or should I have both a DbSet<MapCompany>
and a DbSet<MapLocation>
?
EDIT
Here is a bit of information about the application:
- Each MapCompany can have many MapLocations ~5-25
- I wish to be able to access any MapLocation by its id
Because I wish to be able to access each MapLocation by its id, will there be a lot of database searching if there is only a DbSet<MapCompany>
, as I would have to search through each MapCompany to find a MapLocation by its id?
Would it be more economical to have a DbSet of each because of the increase in database searching? Also, will this make the database a lot larger?
Either way, each MapCompany needs to have many MapLocations, and I need to be able to retrieve any object by its own id efficiently.
With this above information, I am interested in whether I should code a DbSet for each object.