My question is what are the best practices for database/application design for the following ?
I use Code First Entity Framework and .Net MVC 5. There are common functions I want to implement on different entities. For example consider the following simplified example:
class Person{
int PersonId;
string name;
}
class Member{
int PersonId;
int GroupId;
}
class Group{
int GroupId;
string name;
}
class Label{
string name;
}
So 2 entities person and group that have a many-to-many relationship. Now I want to add Labels to each to filter the data based on business logic. There are a few ways to go about it:
Now I would like some advice on which approach is best and why ?
Depending on what the labels are, and how dynamic they will need to be, you could look into using Enum flags. That would still only require a single column per table, and would certainly scale better than having a comma separated list in a column.