Domain related issue

I would like to ask about the recommended solution: We have a list of competitions. Each competition determined the fee that the participant must pay. We have participants. I must know if the participant who is in the competition has paid a fee or not. I think of 2 solutions, and the fact is that this should be the most suitable solution in Domain Driven Design. Firstly, to create a dictionary in a contest instead of a list, the dictionary must be of type <Memberant, bool>. Secon may be creating another class that has 2 fields, a member and a feePaid. And in Competiton I will have a list of objects of this new class.

thanks

+4
source share
2 answers

The way I deal with this is competitions, participants and registrations. The participant must register for the Competition by creating a registration. Registration will consist of a competition identifier, a participant identifier, a flag indicating whether a fee has been paid or not, and any other data related to registration (for example, registration date). This will be modeled in the database as a “connection table” (with additional data). On the application side, the Participant will have a list of Registrations, each Registration will have an associated Participant and a Competition. Similarly, each Competition will have a list of Registrations.

+5
source

sounds like a typical attitude of many to many. I would model it with the Entry association class as follows:

class Participator { } class Competition { Currency fee } class Entry { Competition competition Participator participator Boolean feePaid } 
+6
source

All Articles