If I have an association between product A -> product B, it seems I can only retrieve this association by source. If I ask B for associations (through IAssociationsRepository), it doesn't appear to have any. The UI also reflects this: B has no "Related entries".
The scenario is that I want to show cross links on both product pages... "B is accessory to A" and not only "A has accessory B".
Currently I have to resort to some fugly SQL to make it happen, but I'd much rather have support for this in the API.
I never see any APIs that meet your need. I think as Episerver commerce implementation, the assocations are one-direct relations not bi-direct relations, so that is why there are no APIs for this stuff. :)
Valid point Johan. This is a place where source/target makes senses (unlike IRelationRepository). We will look into that, however that sounds like a breaking change (adding new methods to interface) so it will not be addressed any time soon
Upvoted. I have also a need for this (re-indexing the source on changes of the target). I was a bit surprised that there wasn't support already.
Why would just adding new methods to an interface be a breaking change? I hope that this will be addressed sooner than "not any time soon".
The basic definition of breaking change is "you have to fix your code to make it compile" (even though the full concept of breaking changes can be very complicated). Adding a new method to an interface is definitely a breaking change.
Ok, I was just thinking this specific interface and that only Episerver would make implementations of it. But you are correct. In general, somebody could have made their own implementation of an interface and that would be broken when new methods are added.
Johan Book: As a work-around since associations are not bidirectional, on association create/change event you could check that there is an association in the other direction and create it if needed.