Should I create new table for every consistent data set or one systemCodes table?

asp.net-mvc entity-framework entity-framework-6 sql-server

Question

Should I create new table for every consistent data set or one system--codes table WHEN using Microsoft Entity framework 6 ?

I mean by the "consistent data set" are like:


    +Agent (Table)
    -Id
    -Name
    -Status (consistent data = available | busy | unavailable)
    -Type   (consistent data = reception | delivery | driver)
    -Gender (consistent data = male | female)
    -AddressId

    +Address (Table)
    -Id
    -Description
    -Longitude
    -Latitude
    -City (consistent data = [ .... any city .... ])
    -State (consistent data = [ .... any state.... ])

My question is should i Have a table for each of Status, Type, Gender,...etc and link them to the "Agent" table using foreign keys and navigational properties ? OR just make one table like this :

+SystemCodeTable
-CodeId
-CodeParentId
-NameAr
-NameEn
-Description

and save all my consistent data into it and then assign the CodeId to the "Status", "Type", "Gender", ...etc columns ?

Thank you

1
0
9/25/2018 10:03:17 AM

Popular Answer

I think For Status and Type - better you create StatusMaster and TypeMaster resp.

StatusMaster (StatusID)0 - Available 1 - Busy 2- Unavailable and Use StatusID in Agent Table same you can create for TypeMaster. and for Gender you can directly use 'M' and 'F' or 'Male' and 'Female' as it is in Agent table.

Hope this will help you.

1
9/25/2018 10:28:23 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow