Base solution for your next web application
Open Closed

How to implement a many to many relationship in entities #10938


User avatar
0
marble68 created

11.01 MVC CORE

The rad tool lets us create 1 to 1 navigation properties or one to many, dropdown or lookup table.

This is great.

However - since it doesn't do many to many - what's the best approach to this?

Scenario: "Package entity" - the user can create a package, let's call it the Package entity. The user can also create services such as wash, oil change, wipers, tiers, and windshield, lets call that entity CarService

Thus:

Package 1 could have an oil change and tiers Package 2 could have an oil change and wash Package 3 could have wash and tires

I tried to do a 1<>many of Package and service. If I Edit Service, I can add a CarService to the package.

However, I can only add that carservice to one package?

If a CarService can belong to multiple Packages, should I do the entity relationship the other way? As in, do a master detail on the CarService entity?

Would the best approach to this be to create a new entity with navigation properties to both Package and CarService for creating these manually, but eventually modifying the user interface to provide more elegant matching (perhaps with drag drop or something)? In other words, do it this way, then modify the views and view objects to get the relationships?

Or is there a better approach that is right in front of me?

Thanks for any advice


1 Answer(s)