/// <summary> /// Returns a native implementation of <see cref="DbDataReader.GetStream(int)"/> for those providers /// which support it. Otherwise returns a chuncked read using <see cref="DbDataReader.GetBytes(int, long, byte[], int, int)"/>. /// </summary> /// <param name="reader">The reader from which to return the stream.</param> /// <param name="ordinal">The ordinal column for which to return the stream.</param> /// <param name="storage">The storage that gives the invariant.</param> /// <returns></returns> public static Stream GetStream(this DbDataReader reader, int ordinal, IRelationalStorage storage) { if (storage.SupportsStreamNatively()) { return(reader.GetStream(ordinal)); } return(new OrleansRelationalDownloadStream(reader, ordinal)); }