Database Design and C# cass
Guys I need help for database design and C# class
Suppose there is One table Address Table and other tables are Office , School, Hospital obviously these there will have address so which is best way store address ? Means should I put AddressId in these 3 tables or should I put Id of these 3 table in Address Table
3 Replies
honestly i dont think two entities will share the same address
unless the "address" you mean is not the mailing address but just a part of it, then you may have a one (Address) to many (Building) relationship
I'd store addresses in a separate table. This way, you can then query all known addresses and potentially find what's listed on each one.
Will there be a significant difference between the different building types? If not, you can just create an entity for Building and use a field to specify its type.
If the buildings do have major differences, you can utilize discrimination to have special fields for each building type
Inheritance - EF Core
How to configure entity type inheritance using Entity Framework Core