help with a model relationship

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 лет назад
Hey Guys,

Well this is more of a database relationship modelling question than a nop question,

Am trying to model this scenario

the entities are Customer, Guest, Event
1.) customer registers for events
2.) each customer has guests that he can bring to the event that he's registered for
     (eg if he has registered to event 1 and quantity is 3 he can assign 2 guests to that)





so in trying to setup my shop using nop to model that scenario, i do this:

public class customer //already exists in nop
{
public virtual ICollection<Guest> Guests {}
}

the events are productvariants in nop terminology (acc to my understanding)

but i cant figureout where to put the mapping table that maps CustomerId, EventId(productvariantId from the orderproductvariant table?) and GuestId

-------------------------------------------------------

i tried this out using a simple scenario where i made a many to many relation b/w guests and events and it works fine,
and i can add guests to events using the events.guests navigation property
but i need to have it work with customers, am havin a hard time wrapping my head around it and merging it with nop dbase

public class Guest
    {
        public int GuestId { get; set; }
        public string GuestName { get; set; }
        public virtual ICollection<Event> Events { get; set; }
    }

    public class Event
    {
        public int EventId { get; set; }
        public string EventName { get; set; }
        public virtual ICollection<Guest> Guests { get; set; }
    }
12 лет назад
You need a Registration table which is

Id
CustomerId
EventId
NumberOfGuestsAllowed

and then a Registration_Guest_Mapping table that is

RegistrationId
GuestId

The Registration entity would have a Customer, Event, and List<Guest> plus any other info for the registration like date added, meal choice, etc.
12 лет назад
When I saw the thread title, I wondered to myself 'What is her name, and why is he having problems with his relationship with her?' But then I read the post. And I was bummed. *sigh*
12 лет назад
Thanks for the super prompt input! ill work on it more today ~
12 лет назад
mikeaurelius wrote:
When I saw the thread title, I wondered to myself 'What is her name, and why is he having problems with his relationship with her?' But then I read the post. And I was bummed. *sigh*


This is our way of life *sigh* we have trouble with relationships among entities, haha
12 лет назад
hacknop wrote:
When I saw the thread title, I wondered to myself 'What is her name, and why is he having problems with his relationship with her?' But then I read the post. And I was bummed. *sigh*

This is our way of life *sigh* we have trouble with relationships among entities, haha


: ) Sometimes we need smile good ..
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.