I have created an MVC solution where a user can register for an event.
This is created with a Many-to-Many
relation between a UserRecord
and an EventRecord
. When a user registers for an event, a relation between that user and event is created. I need to be able to add some credentials to the user when he/she is registered for an event. For example adding experience for the individual event.
The credentials should only be bound to a relation between an event and user. So if User1 registeres for Event1 and Event2, he is able to add a set of credentials to Event1 and another set of credentials to Event2.
How would you recommend a proper database structure where credentials is added as mentioned above?
My UserRecord:
public class UserRecord
{
[Display(AutoGenerateField = false)]
public Guid Id { get; set; }
public string Gender { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual ICollection<EventRecord> Events { get; set; }
}
My EventRecord:
public class EventRecord
{
public Guid OwnerId { get; set; }
public string Title { get; set; }
public virtual ICollection<FighterRecord> Fighters { get; set; }
}
After using migration in Entity Framework, a junction table between the two records above is created in my database called UserRecordEventRecord
.