private void OnReadingEntity(object sender, ReadingWritingEntityEventArgs args) { IMediaContextContainer mediaContextContainer = args.Entity as IMediaContextContainer; if (mediaContextContainer != null) { mediaContextContainer.SetMediaContext(this._mediaContext); } }
/// <summary> /// Returns the parent <see cref="MediaContextBase"/> instance. /// </summary> /// <param name="asset">The <see cref="IAsset"/> instance.</param> /// <returns>The parent <see cref="MediaContextBase"/> instance.</returns> public static MediaContextBase GetMediaContext(this IAsset asset) { if (asset == null) { throw new ArgumentNullException("asset", "The asset cannot be null."); } IMediaContextContainer mediaContextContainer = asset as IMediaContextContainer; MediaContextBase context = null; if (mediaContextContainer != null) { context = mediaContextContainer.GetMediaContext(); } return(context); }
/// <summary> /// Returns the parent <see cref="MediaContextBase"/> instance. /// </summary> /// <param name="job">The <see cref="IJob"/> instance.</param> /// <returns>The parent <see cref="MediaContextBase"/> instance.</returns> public static MediaContextBase GetMediaContext(this IJob job) { if (job == null) { throw new ArgumentNullException("job", "The job cannot be null."); } IMediaContextContainer mediaContextContainer = job as IMediaContextContainer; MediaContextBase context = null; if (mediaContextContainer != null) { context = mediaContextContainer.GetMediaContext(); } return(context); }