I have a Subscriber object that contains a list of Provider objects. Providers can belong to many Subscribers, hence the many-to-many relationship. This is fine, except that the Provider needs to define a Status property but this cannot be stored in the Provider table, as the same provider could have a different Status for different Subscribers, so I am storing the Status in the many-to-many table. At the moment I have a basic many-to-many mapping:
HasManyToMany(s => s.Providers)
.Table("SubscriberProviders")
.ParentKeyColumn("SubscriberID")
.ChildKeyColumn("ProviderID");
How can I set the Status property, of the Provider, within the many-to-many mapping?
Many thanks
A
many-to-manymapping can’t have properties of its own, so you have to map the join table into an artificial ProviderSubscriber entity, which will beone-to-manyfrom the Provider.For a full example of a workaround, see Many-to-many relationships with properties