I have to create an application which allows to create connections between multiple entities (tables).
For example:
- Link between person and room.
- Link between person and person.
- Link between activity and person.
etc. etc. etc.
I plan to create one connection table with no real DB foreign keys.
The table has following fields:
Connection1, Connection1Type, Connection2, Connection2Type
The Type field defines the entity type. I think it is the most flexible solution.
How can I solve it with the Code First approach??? I think, then I define my entities the EF model builder will try to create foreign keys between the tables and the connection table. In my entities, I would like to have a property called "Connections". This property contains all connections of this entity.
Is it possible?
Thanks in advance.