Today’s way of relating Orchard contents is less universal than any of the ones I’ve talked about so far in this series: it will only enable you to attach media, such as images, videos, and audio, to your content items. Still, media have been real content items for a few versions of Orchard, and the media library picker is a very efficient way to add single or multiple media, so this most definitely deserves a post…
To attach media to your content items, all you have to do is edit the content type, add one or several media library picker fields, configure them to accept one or multiple media, and you’re done. I previous posts, that’s what we’ve done for the album cover, and for assigning a track to songs.
- No code.
- Complete admin UI, very easy on-the-fly creation and picking of items.
- Comes with decent default templates for common media types, including video and audio.
- As many media library picker fields as you want per content type.
- Potential for select n+1 performance bottlenecks that can be tricky to work around (see https://weblogs.asp.net/bleroy/speeding-up-pages-with-lots-of-media-content-items).
- Not easy to query on, but few scenarios require it.
- Import/export still missing the actual media files in 1.9 (but this is already fixed in branch feature/deployment).
This one should really be a no-brainer: if the content you want to relate to is media, that’s what you should be using. Otherwise, it’s not.