SqlNotificationRequest.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //------------------------------------------------------------------------------
  2. // <copyright file="SqlNotificationRequest.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. // <owner current="true" primary="true">[....]</owner>
  6. // <owner current="true" primary="true">[....]</owner>
  7. // <owner current="false" primary="false">[....]</owner>
  8. //------------------------------------------------------------------------------
  9. namespace System.Data.Sql {
  10. using System;
  11. using System.Data.Common;
  12. using System.Data.SqlClient;
  13. // [System.ComponentModel.TypeConverterAttribute(typeof(System.Data.Sql.SqlNotificationRequest.SqlNotificationRequestConverter))]
  14. public sealed class SqlNotificationRequest {
  15. private string _userData;
  16. private string _options;
  17. private int _timeout;
  18. public SqlNotificationRequest()
  19. : this(null, null, SqlClient.SQL.SqlDependencyTimeoutDefault) {}
  20. public SqlNotificationRequest(string userData, string options, int timeout) {
  21. UserData = userData;
  22. Timeout = timeout;
  23. Options = options;
  24. }
  25. public string Options {
  26. get {
  27. return _options;
  28. }
  29. set {
  30. if ((null != value) && (UInt16.MaxValue < value.Length)) {
  31. throw ADP.ArgumentOutOfRange(String.Empty, ADP.ParameterService);
  32. }
  33. _options = value;
  34. }
  35. }
  36. public int Timeout {
  37. get {
  38. return _timeout;
  39. }
  40. set {
  41. if (0 > value) {
  42. throw ADP.ArgumentOutOfRange(String.Empty, ADP.ParameterTimeout);
  43. }
  44. _timeout = value;
  45. }
  46. }
  47. public string UserData {
  48. get {
  49. return _userData;
  50. }
  51. set {
  52. if ((null != value) && (UInt16.MaxValue < value.Length)) {
  53. throw ADP.ArgumentOutOfRange(String.Empty, ADP.ParameterUserData);
  54. }
  55. _userData = value;
  56. }
  57. }
  58. }
  59. }