This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add query notification support to SqlClient (#20708)
- Loading branch information
Showing
23 changed files
with
3,885 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/System.Data.SqlClient/src/System/Data/Sql/SqlNotificationRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// 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.Data.Common; | ||
using System.Data.SqlClient; | ||
|
||
namespace System.Data.Sql | ||
{ | ||
public sealed class SqlNotificationRequest | ||
{ | ||
private string _userData; | ||
private string _options; | ||
private int _timeout; | ||
|
||
public SqlNotificationRequest() | ||
: this(null, null, SQL.SqlDependencyTimeoutDefault) { } | ||
|
||
public SqlNotificationRequest(string userData, string options, int timeout) | ||
{ | ||
UserData = userData; | ||
Timeout = timeout; | ||
Options = options; | ||
} | ||
|
||
public string Options | ||
{ | ||
get | ||
{ | ||
return _options; | ||
} | ||
set | ||
{ | ||
if ((null != value) && (ushort.MaxValue < value.Length)) | ||
{ | ||
throw ADP.ArgumentOutOfRange(string.Empty, nameof(Options)); | ||
} | ||
_options = value; | ||
} | ||
} | ||
|
||
public int Timeout | ||
{ | ||
get | ||
{ | ||
return _timeout; | ||
} | ||
set | ||
{ | ||
if (0 > value) | ||
{ | ||
throw ADP.ArgumentOutOfRange(string.Empty, nameof(Timeout)); | ||
} | ||
_timeout = value; | ||
} | ||
} | ||
|
||
public string UserData | ||
{ | ||
get | ||
{ | ||
return _userData; | ||
} | ||
set | ||
{ | ||
if ((null != value) && (ushort.MaxValue < value.Length)) | ||
{ | ||
throw ADP.ArgumentOutOfRange(string.Empty, nameof(UserData)); | ||
} | ||
_userData = value; | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/System.Data.SqlClient/src/System/Data/SqlClient/OnChangedEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// 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 System.Data.SqlClient | ||
{ | ||
public delegate void OnChangeEventHandler(object sender, SqlNotificationEventArgs e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.