I’m doing an application in C# with an SQL database.
I’ve got a model:
Person()
{
string id;//unike key
string name;
List<string> responsableOf;//list of id
}
and I want to represent it into a table.
Which are the right fields for the tables?
It depends on what kind of relation is there between the person and the other persons that he will be responsible for.
If it is a parent and child relation i.e a composition you can use a self reference table. Something like:
Personswith the following columns:Id,name.ParentIdForeign key to the same table.If the relation between the person and the others is an aggregation, and a person may be responsible for many other
persons:Persons:Id,name.usersresponsibilities:Id,PersonId,ResobonsiblePersonID.Later, in both the two cases, in your front end application you will need to deal with the data in these table as an objects not as rows. You should think in terms of objects.
In your application your current class
Personshould be mapped to this table.