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 ab2d25908c..9bfe6de00b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -277,6 +277,9 @@ Microsoft\Data\SqlClient\SqlException.cs + + Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs + Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs @@ -562,7 +565,6 @@ Microsoft\Data\SqlClient\SqlEnclaveSession.cs - diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs deleted file mode 100644 index f508331743..0000000000 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs +++ /dev/null @@ -1,46 +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. - -namespace Microsoft.Data.SqlClient -{ - /// - public sealed class SqlInfoMessageEventArgs : System.EventArgs - { - private SqlException _exception; - - internal SqlInfoMessageEventArgs(SqlException exception) - { - _exception = exception; - } - - /// - public SqlErrorCollection Errors - { - get { return _exception.Errors; } - } - - private bool ShouldSerializeErrors() - { - return (null != _exception) && (0 < _exception.Errors.Count); - } - - /// - public string Message - { - get { return _exception.Message; } - } - - /// - public string Source - { - get { return _exception.Source; } - } - - /// - override public string ToString() - { - return Message; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 87162db2ab..4a3603c37c 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -366,6 +366,9 @@ Microsoft\Data\SqlClient\SqlException.cs + + Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs + Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs @@ -551,7 +554,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs deleted file mode 100644 index d191d6d2af..0000000000 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs +++ /dev/null @@ -1,47 +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. - -namespace Microsoft.Data.SqlClient -{ - /// - public sealed class SqlInfoMessageEventArgs : System.EventArgs - { - private SqlException exception; - - internal SqlInfoMessageEventArgs(SqlException exception) - { - this.exception = exception; - } - - /// - public SqlErrorCollection Errors - { - get { return exception.Errors; } - } - - /*virtual protected*/ - private bool ShouldSerializeErrors() - { // MDAC 65548 - return (null != exception) && (0 < exception.Errors.Count); - } - - /// - public string Message - { // MDAC 68482 - get { return exception.Message; } - } - - /// - public string Source - { // MDAC 68482 - get { return exception.Source; } - } - - /// - override public string ToString() - { // MDAC 68482 - return Message; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs new file mode 100644 index 0000000000..bca1f3d65f --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInfoMessageEvent.cs @@ -0,0 +1,34 @@ +// 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. + +namespace Microsoft.Data.SqlClient +{ + /// + public sealed class SqlInfoMessageEventArgs : System.EventArgs + { + private readonly SqlException _exception; + + internal SqlInfoMessageEventArgs(SqlException exception) + { + _exception = exception; + } + + /// + public SqlErrorCollection Errors => _exception.Errors; + + // MDAC 65548 + private bool ShouldSerializeErrors() => (null != _exception) && (0 < _exception.Errors.Count); + + /// + public string Message => _exception.Message; + + /// + // MDAC 68482 + public string Source => _exception.Source; + + /// + // MDAC 68482 + override public string ToString() => Message; + } +}