Skip to content

Commit

Permalink
Move into Shared for SqlInfoMessageEvent.cs (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcheunglci authored Oct 18, 2021
1 parent 542056a commit c10207a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlException.cs">
<Link>Microsoft\Data\SqlClient\SqlException.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs</Link>
</Compile>
Expand Down Expand Up @@ -566,7 +569,6 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlEnclaveSession.cs">
<Link>Microsoft\Data\SqlClient\SqlEnclaveSession.cs</Link>
</Compile>
<Compile Include="Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalTransaction.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlException.cs">
<Link>Microsoft\Data\SqlClient\SqlException.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs">
<Link>Microsoft\Data\SqlClient\SqlInfoMessageEventHandler.cs</Link>
</Compile>
Expand Down Expand Up @@ -555,7 +558,6 @@
<Compile Include="Microsoft\Data\SqlClient\SqlDependencyListener.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlDependencyUtils.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlError.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInfoMessageEvent.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnectionSmi.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlInternalConnectionTds.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
{
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlInfoMessageEventArgs.xml' path='docs/members[@name="SqlInfoMessageEventArgs"]/SqlInfoMessageEventArgs/*' />
public sealed class SqlInfoMessageEventArgs : System.EventArgs
{
private readonly SqlException _exception;

internal SqlInfoMessageEventArgs(SqlException exception)
{
_exception = exception;
}

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlInfoMessageEventArgs.xml' path='docs/members[@name="SqlInfoMessageEventArgs"]/Errors/*' />
public SqlErrorCollection Errors => _exception.Errors;

// MDAC 65548
private bool ShouldSerializeErrors() => (null != _exception) && (0 < _exception.Errors.Count);

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlInfoMessageEventArgs.xml' path='docs/members[@name="SqlInfoMessageEventArgs"]/Message/*' />
public string Message => _exception.Message;

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlInfoMessageEventArgs.xml' path='docs/members[@name="SqlInfoMessageEventArgs"]/Source/*' />
// MDAC 68482
public string Source => _exception.Source;

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlInfoMessageEventArgs.xml' path='docs/members[@name="SqlInfoMessageEventArgs"]/ToString/*' />
// MDAC 68482
override public string ToString() => Message;
}
}

0 comments on commit c10207a

Please sign in to comment.