/// <summary> /// Opens the content stream of specified <paramref name="dokumentversjon"/>. /// </summary> /// <param name="instance">The instance.</param> /// <param name="dokumentversjon">The document object.</param> /// <returns></returns> public static async Task <Stream> OpenAsync(this IAsyncDocumentManager instance, Dokumentversjon dokumentversjon) { if (instance == null) { throw new ArgumentNullException("instance"); } if (dokumentversjon == null) { throw new ArgumentNullException("dokumentversjon"); } if (!dokumentversjon.DokumentbeskrivelseId.HasValue) { throw new InvalidOperationException("The Documentversjon.DokumentbeskrivelseId cannot be <null>."); } if (string.IsNullOrEmpty(dokumentversjon.VariantId)) { throw new InvalidOperationException("The Documentversjon.VariantId cannot be <null> or empty."); } if (!dokumentversjon.Versjonsnummer.HasValue) { throw new InvalidOperationException("The Documentversjon.Versjonsnummer cannot be <null>."); } return(await instance.OpenAsync(dokumentversjon.DokumentbeskrivelseId.Value, dokumentversjon.VariantId, dokumentversjon.Versjonsnummer.Value)); }
/// <summary> /// Opens the content stream of specified <paramref name="documentObject"/>. /// </summary> /// <param name="instance">The instance.</param> /// <param name="documentObject">The document object.</param> /// <returns></returns> public static async System.Threading.Tasks.Task <Stream> OpenAsync(this IAsyncDocumentManager instance, DocumentObject documentObject) { if (instance == null) { throw new ArgumentNullException("instance"); } if (documentObject == null) { throw new ArgumentNullException("documentObject"); } if (string.IsNullOrEmpty(documentObject.VariantFormatId)) { throw new InvalidOperationException("The DocumentObject.VariantFormatId cannot be <null> or empty."); } return(await instance.OpenAsync(documentObject.DocumentDescriptionId, documentObject.VariantFormatId, documentObject.VersionNumber)); }