PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Kilimanjaro_November_CTP/ServiceBrokerInterface/cs/ServiceBrokerInterface/ServiceException.cs

#
C# | 88 lines | 47 code | 7 blank | 34 comment | 0 complexity | 7b0a8335c8eb3d77341d4bb2fd9f47d1 MD5 | raw file
  1. //-----------------------------------------------------------------------
  2. // This file is part of the Microsoft Code Samples.
  3. //
  4. // Copyright (C) Microsoft Corporation. All rights reserved.
  5. //
  6. //This source code is intended only as a supplement to Microsoft
  7. //Development Tools and/or on-line documentation. See these other
  8. //materials for detailed information regarding Microsoft code samples.
  9. //
  10. //THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
  11. //KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  12. //IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  13. //PARTICULAR PURPOSE.
  14. //-----------------------------------------------------------------------
  15. #region Using directives
  16. using System;
  17. using System.Data;
  18. using System.Data.SqlClient;
  19. using System.Data.SqlTypes;
  20. using System.Collections.Generic;
  21. using System.Text;
  22. using System.Diagnostics;
  23. using System.Reflection;
  24. #endregion
  25. namespace Microsoft.Samples.SqlServer
  26. {
  27. /// <remarks>
  28. /// This class wraps the exceptions thrown in the <c>Run</c> method of the
  29. /// <c>Service</c> class.
  30. /// </remarks>
  31. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
  32. public class ServiceException : Exception
  33. {
  34. #region Fields
  35. private SqlConnection m_connection;
  36. /// <summary>
  37. ///
  38. /// </summary>
  39. public SqlConnection Connection
  40. {
  41. get { return m_connection; }
  42. }
  43. private SqlTransaction m_transaction;
  44. /// <summary>
  45. ///
  46. /// </summary>
  47. public SqlTransaction Transaction
  48. {
  49. get { return m_transaction; }
  50. }
  51. private Conversation m_currentConversation;
  52. /// <summary>
  53. ///
  54. /// </summary>
  55. public Conversation CurrentConversation
  56. {
  57. get { return m_currentConversation; }
  58. }
  59. #endregion
  60. #region Constructor
  61. /// <summary>
  62. ///
  63. /// </summary>
  64. /// <param name="currentConversation"></param>
  65. /// <param name="connection"></param>
  66. /// <param name="transaction"></param>
  67. /// <param name="exception"></param>
  68. public ServiceException(
  69. Conversation currentConversation,
  70. SqlConnection connection,
  71. SqlTransaction transaction,
  72. Exception exception)
  73. : base(exception.Message, exception)
  74. {
  75. m_currentConversation = currentConversation;
  76. m_connection = connection;
  77. m_transaction = transaction;
  78. }
  79. #endregion
  80. }
  81. }