IntentArchitect / Support

A repository dedicated to handling issues and support queries
3 stars 0 forks source link

CRUD for Bridging tables #17

Closed ZardusMukon closed 1 year ago

ZardusMukon commented 1 year ago

Ask a question

Good morning, 

I have a quick question regarding domain associations and to what extend IA manages CRUD services for bridging tables. 

We have two independent tables:

There is a many-to-many association between these two. (A person can have multiple work descriptions, a work description can be assigned to multiple persons). 

The user can link existing persons to existing work descriptions (so this linking is NOT part of the CRUD services of either).

Setting up an m-m association does result in the migration script creating a bridging table (this is what we want)

But I don't see an easy way to create the CRUD services for this bridging table. 

Do we have to create it manually or am I missing something in intent to handle this?

I can kind of see why Intent won't "see" the bridging table, but I just want to make sure.

JonathanLydall commented 1 year ago

Hi @ZardusMukon,

You're correct that Intent doesn't know about the joining table because it's a table which EF Core creates and manages completely internally for the many-to-many relationship.

You can however manually create this joining table yourself and you will then be able to see it from the Services designer. You would change your domain model from something like:

image

To instead be something like:

image

The PersonWorkDescription class will then be visible in the Services designer when trying to create CRUD services or mappings.