Looking for some insight on Code-First DB.

Hey guys!

I’m currently building a platform for a non-profit organization, which focuses on helping people on the street. I’ve never used the Code First approach using Entity Framework so I decided to go with that and I have quite a few models defined but I am unsure how to approach the table sizes.

For example, I have a ‘Person’ model which contains basic information (Name, Age, Nationality and so on). I’m also using other models(Enums to be exact) for other necessary information such as Education Level and Drugs. For instance, Education Level is a 1:1 relationship with Person, which I will keep in the same Model. However my doubt comes when handling 1:N relationships. A Person can consume 1 or various ‘Drugs’ which leads me to have a 1:N between those tables. I’m not sure how to approach this using Code First though. Would you guys recommend using a model between Person and Drugs in order to have a third table to handle that relationship? Something like PersonDrugs with the IDs of any relationship necessary?

Any insight is highly appreciated 🙂

submitted by /u/LeinadDC
[link] [comments]

Leave a Reply