There's this method in IContentRepository
That will let me know if there's content (pages/blocks) that is using the MediaData in someway.
What about the other way around?
Is there a generic way of finding out which MediaData that is referenced by a specific page/block?
I found this.
Note that it is marked as "Unsupported INTERNAL API!"
var contentSoftLinkIndexer = ServiceLocator.Current.GetInstance<ContentSoftLinkIndexer>();
var linkedContent = contentSoftLinkIndexer.GetLinks(content);
I'd suggest that, rather than use an internal API you could use IContentSoftLinkRepository. That has a "load" method which lets you retrieve a list of content linked from a given piece of content.