diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index 8d1f8d1bbd..f1c5c2d6e6 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -925,13 +925,15 @@ Microsoft\Data\SqlClient\SessionHandle.netcore.Unix.cs + + Microsoft\Data\SqlTypes\SqlFileStream.netcore.Unix.cs + - diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlFileStream.Unsupported.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlFileStream.Unsupported.cs deleted file mode 100644 index 8821657bf7..0000000000 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlFileStream.Unsupported.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; - -namespace Microsoft.Data.SqlTypes -{ - /// - public sealed partial class SqlFileStream : System.IO.Stream - { - /// - public SqlFileStream(string path, byte[] transactionContext, FileAccess access) - { - throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); - } - - /// - public SqlFileStream(string path, byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize) - { - throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); - } - - /// - public string Name { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public byte[] TransactionContext { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public override bool CanRead { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public override bool CanSeek { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public override bool CanWrite { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public override long Length { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public override long Position { get { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } set { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } } - /// - public override void Flush() { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } - /// - public override int Read(byte[] buffer, int offset, int count) { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } - /// - public override long Seek(long offset, System.IO.SeekOrigin origin) { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } - /// - public override void SetLength(long value) { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } - /// - public override void Write(byte[] buffer, int offset, int count) { throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); } - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.netcore.Unix.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.netcore.Unix.cs new file mode 100644 index 0000000000..9aac2d9d5e --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.netcore.Unix.cs @@ -0,0 +1,92 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if NET + +using System; +using System.IO; + +namespace Microsoft.Data.SqlTypes +{ + /// + public sealed class SqlFileStream : Stream + { + /// + public SqlFileStream(string path, byte[] transactionContext, FileAccess access) + { + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public SqlFileStream(string path, byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize) + { + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public string Name + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public byte[] TransactionContext + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public override bool CanRead + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public override bool CanSeek + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public override bool CanWrite + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public override long Length + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public override long Position + { + get => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + set => throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } + + /// + public override void Flush() => + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + + /// + public override int Read(byte[] buffer, int offset, int count) => + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + + /// + public override long Seek(long offset, System.IO.SeekOrigin origin) => + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + + /// + public override void SetLength(long value) => + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + + /// + public override void Write(byte[] buffer, int offset, int count) => + throw new PlatformNotSupportedException(Strings.SqlFileStream_NotSupported); + } +} + +#endif