Many ways to relate Orchard things, part 5: media

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.A media library picker field

Let’s recap…


  1. No code.
  2. Complete admin UI, very easy on-the-fly creation and picking of items.
  3. Comes with decent default templates for common media types, including video and audio.
  4. As many media library picker fields as you want per content type.


  1. Potential for select n+1 performance bottlenecks that can be tricky to work around (see
  2. Not easy to query on, but few scenarios require it.
  3. Import/export still missing the actual media files in 1.9 (but this is already fixed in branch feature/deployment).

Use cases

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.

No Comments