SqlConnection.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. //
  2. // System.Data.SqlClient.SqlConnection.cs
  3. //
  4. // Authors:
  5. // Rodrigo Moya ([email protected])
  6. // Daniel Morgan ([email protected])
  7. // Tim Coleman ([email protected])
  8. // Phillip Jerkins ([email protected])
  9. //
  10. // Copyright (C) Ximian, Inc 2002
  11. // Copyright (C) Daniel Morgan 2002, 2003
  12. // Copyright (C) Tim Coleman, 2002, 2003
  13. // Copyright (C) Phillip Jerkins, 2003
  14. //
  15. using Mono.Data.Tds;
  16. using Mono.Data.Tds.Protocol;
  17. using System;
  18. using System.Collections;
  19. using System.Collections.Specialized;
  20. using System.ComponentModel;
  21. using System.Data;
  22. using System.Data.Common;
  23. using System.EnterpriseServices;
  24. using System.Net;
  25. using System.Net.Sockets;
  26. using System.Text;
  27. using System.Xml;
  28. namespace System.Data.SqlClient {
  29. [DefaultEvent ("InfoMessage")]
  30. public sealed class SqlConnection : Component, IDbConnection, ICloneable
  31. {
  32. #region Fields
  33. bool disposed = false;
  34. // The set of SQL connection pools
  35. static Hashtable SqlConnectionPools = new Hashtable ();
  36. // The current connection pool
  37. SqlConnectionPool pool;
  38. // The connection string that identifies this connection
  39. string connectionString = null;
  40. // The transaction object for the current transaction
  41. SqlTransaction transaction = null;
  42. // Connection parameters
  43. TdsConnectionParameters parms = new TdsConnectionParameters ();
  44. bool connectionReset;
  45. bool pooling;
  46. string dataSource;
  47. int connectionTimeout;
  48. int minPoolSize;
  49. int maxPoolSize;
  50. int packetSize;
  51. int port = 1433;
  52. // The current state
  53. ConnectionState state = ConnectionState.Closed;
  54. SqlDataReader dataReader = null;
  55. XmlReader xmlReader = null;
  56. // The TDS object
  57. ITds tds;
  58. #endregion // Fields
  59. #region Constructors
  60. public SqlConnection ()
  61. : this (String.Empty)
  62. {
  63. }
  64. public SqlConnection (string connectionString)
  65. {
  66. ConnectionString = connectionString;
  67. }
  68. #endregion // Constructors
  69. #region Properties
  70. [DataCategory ("Data")]
  71. [DataSysDescription ("Information used to connect to a DataSource, such as 'Data Source=x;Initial Catalog=x;Integrated Security=SSPI'.")]
  72. [DefaultValue ("")]
  73. [RecommendedAsConfigurable (true)]
  74. [RefreshProperties (RefreshProperties.All)]
  75. public string ConnectionString {
  76. get { return connectionString; }
  77. set { SetConnectionString (value); }
  78. }
  79. [DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")]
  80. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  81. public int ConnectionTimeout {
  82. get { return connectionTimeout; }
  83. }
  84. [DataSysDescription ("Current SQL Server database, 'Initial Catalog=X' in the ConnectionString.")]
  85. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  86. public string Database {
  87. get { return tds.Database; }
  88. }
  89. internal SqlDataReader DataReader {
  90. get { return dataReader; }
  91. set { dataReader = value; }
  92. }
  93. [DataSysDescription ("Current SqlServer that the connection is opened to, 'Data Source=X' in the ConnectionString.")]
  94. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  95. public string DataSource {
  96. get { return dataSource; }
  97. }
  98. [DataSysDescription ("Network packet size, 'Packet Size=x' in the ConnectionString.")]
  99. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  100. public int PacketSize {
  101. get { return packetSize; }
  102. }
  103. [Browsable (false)]
  104. [DataSysDescription ("Version of the SQL Server accessed by the SqlConnection.")]
  105. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  106. public string ServerVersion {
  107. get { return tds.ServerVersion; }
  108. }
  109. [Browsable (false)]
  110. [DataSysDescription ("The ConnectionState indicating whether the connection is open or closed.")]
  111. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  112. public ConnectionState State {
  113. get { return state; }
  114. }
  115. internal ITds Tds {
  116. get { return tds; }
  117. }
  118. internal SqlTransaction Transaction {
  119. get { return transaction; }
  120. set { transaction = value; }
  121. }
  122. [DataSysDescription ("Workstation Id, 'Workstation Id=x' in the ConnectionString.")]
  123. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  124. public string WorkstationId {
  125. get { return parms.Hostname; }
  126. }
  127. internal XmlReader XmlReader {
  128. get { return xmlReader; }
  129. set { xmlReader = value; }
  130. }
  131. #endregion // Properties
  132. #region Events
  133. [DataCategory ("InfoMessage")]
  134. [DataSysDescription ("Event triggered when messages arrive from the DataSource.")]
  135. public event SqlInfoMessageEventHandler InfoMessage;
  136. [DataCategory ("StateChange")]
  137. [DataSysDescription ("Event triggered when the connection changes state.")]
  138. public event StateChangeEventHandler StateChange;
  139. #endregion // Events
  140. #region Delegates
  141. private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
  142. {
  143. throw new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State);
  144. }
  145. private void MessageHandler (object sender, TdsInternalInfoMessageEventArgs e)
  146. {
  147. OnSqlInfoMessage (CreateSqlInfoMessageEvent (e.Errors));
  148. }
  149. #endregion // Delegates
  150. #region Methods
  151. public SqlTransaction BeginTransaction ()
  152. {
  153. return BeginTransaction (IsolationLevel.ReadCommitted, String.Empty);
  154. }
  155. public SqlTransaction BeginTransaction (IsolationLevel iso)
  156. {
  157. return BeginTransaction (iso, String.Empty);
  158. }
  159. public SqlTransaction BeginTransaction (string transactionName)
  160. {
  161. return BeginTransaction (IsolationLevel.ReadCommitted, transactionName);
  162. }
  163. public SqlTransaction BeginTransaction (IsolationLevel iso, string transactionName)
  164. {
  165. if (state == ConnectionState.Closed)
  166. throw new InvalidOperationException ("The connection is not open.");
  167. if (transaction != null)
  168. throw new InvalidOperationException ("SqlConnection does not support parallel transactions.");
  169. string isolevel = String.Empty;
  170. switch (iso) {
  171. case IsolationLevel.Chaos:
  172. isolevel = "CHAOS";
  173. break;
  174. case IsolationLevel.ReadCommitted:
  175. isolevel = "READ COMMITTED";
  176. break;
  177. case IsolationLevel.ReadUncommitted:
  178. isolevel = "READ UNCOMMITTED";
  179. break;
  180. case IsolationLevel.RepeatableRead:
  181. isolevel = "REPEATABLE READ";
  182. break;
  183. case IsolationLevel.Serializable:
  184. isolevel = "SERIALIZABLE";
  185. break;
  186. }
  187. tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0};BEGIN TRANSACTION {1}", isolevel, transactionName));
  188. transaction = new SqlTransaction (this, iso);
  189. return transaction;
  190. }
  191. public void ChangeDatabase (string database)
  192. {
  193. if (!IsValidDatabaseName (database))
  194. throw new ArgumentException (String.Format ("The database name {0} is not valid."));
  195. if (state != ConnectionState.Open)
  196. throw new InvalidOperationException ("The connection is not open.");
  197. tds.Execute (String.Format ("use {0}", database));
  198. }
  199. private void ChangeState (ConnectionState currentState)
  200. {
  201. ConnectionState originalState = state;
  202. state = currentState;
  203. OnStateChange (CreateStateChangeEvent (originalState, currentState));
  204. }
  205. public void Close ()
  206. {
  207. if (transaction != null && transaction.IsOpen)
  208. transaction.Rollback ();
  209. if (dataReader != null || xmlReader != null) {
  210. tds.SkipToEnd ();
  211. dataReader = null;
  212. xmlReader = null;
  213. }
  214. if (pooling)
  215. pool.ReleaseConnection (tds);
  216. else
  217. tds.Disconnect ();
  218. tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler (ErrorHandler);
  219. tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler (MessageHandler);
  220. ChangeState (ConnectionState.Closed);
  221. }
  222. public SqlCommand CreateCommand ()
  223. {
  224. SqlCommand command = new SqlCommand ();
  225. command.Connection = this;
  226. return command;
  227. }
  228. private SqlInfoMessageEventArgs CreateSqlInfoMessageEvent (TdsInternalErrorCollection errors)
  229. {
  230. return new SqlInfoMessageEventArgs (errors);
  231. }
  232. private StateChangeEventArgs CreateStateChangeEvent (ConnectionState originalState, ConnectionState currentState)
  233. {
  234. return new StateChangeEventArgs (originalState, currentState);
  235. }
  236. protected override void Dispose (bool disposing)
  237. {
  238. if (!disposed) {
  239. if (disposing) {
  240. if (State == ConnectionState.Open)
  241. Close ();
  242. parms = null;
  243. dataSource = null;
  244. }
  245. base.Dispose (disposing);
  246. disposed = true;
  247. }
  248. }
  249. [MonoTODO ("Not sure what this means at present.")]
  250. public void EnlistDistributedTransaction (ITransaction transaction)
  251. {
  252. throw new NotImplementedException ();
  253. }
  254. object ICloneable.Clone ()
  255. {
  256. return new SqlConnection (ConnectionString);
  257. }
  258. IDbTransaction IDbConnection.BeginTransaction ()
  259. {
  260. return BeginTransaction ();
  261. }
  262. IDbTransaction IDbConnection.BeginTransaction (IsolationLevel iso)
  263. {
  264. return BeginTransaction (iso);
  265. }
  266. IDbCommand IDbConnection.CreateCommand ()
  267. {
  268. return CreateCommand ();
  269. }
  270. void IDisposable.Dispose ()
  271. {
  272. Dispose (true);
  273. GC.SuppressFinalize (this);
  274. }
  275. public void Open ()
  276. {
  277. string serverName = "";
  278. if (connectionString == null)
  279. throw new InvalidOperationException ("Connection string has not been initialized.");
  280. try {
  281. if (!pooling) {
  282. if(!ParseDataSource (dataSource, out port, out serverName))
  283. throw new SqlException(20, 0, "SQL Server does not exist or access denied.", 17, "ConnectionOpen (Connect()).", dataSource, parms.ApplicationName, 0);
  284. tds = new Tds70 (serverName, port, PacketSize, ConnectionTimeout);
  285. }
  286. else {
  287. pool = (SqlConnectionPool) SqlConnectionPools [connectionString];
  288. if (pool == null) {
  289. if(!ParseDataSource (dataSource, out port, out serverName))
  290. throw new SqlException(20, 0, "SQL Server does not exist or access denied.", 17, "ConnectionOpen (Connect()).", dataSource, parms.ApplicationName, 0);
  291. pool = new SqlConnectionPool (serverName, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
  292. SqlConnectionPools [connectionString] = pool;
  293. }
  294. tds = pool.AllocateConnection ();
  295. }
  296. }
  297. catch (TdsTimeoutException e) {
  298. throw SqlException.FromTdsInternalException ((TdsInternalException) e);
  299. }
  300. tds.TdsErrorMessage += new TdsInternalErrorMessageEventHandler (ErrorHandler);
  301. tds.TdsInfoMessage += new TdsInternalInfoMessageEventHandler (MessageHandler);
  302. if (!tds.IsConnected)
  303. tds.Connect (parms);
  304. /* Not sure ebout removing these 2 lines.
  305. * The command that gets to the sql server is just
  306. * 'sp_reset_connection' and it fails.
  307. * Either remove them definitely or fix it
  308. else if (connectionReset)
  309. tds.ExecProc ("sp_reset_connection");
  310. */
  311. ChangeState (ConnectionState.Open);
  312. }
  313. private bool ParseDataSource (string theDataSource, out int thePort, out string theServerName)
  314. {
  315. theServerName = "";
  316. string theInstanceName = "";
  317. thePort = 1433; // default TCP port for SQL Server
  318. bool success = true;
  319. int idx = 0;
  320. if ((idx = theDataSource.IndexOf (",")) > -1) {
  321. theServerName = theDataSource.Substring (0, idx);
  322. string p = theDataSource.Substring (idx + 1);
  323. thePort = Int32.Parse (p);
  324. }
  325. else if ((idx = theDataSource.IndexOf ("\\")) > -1) {
  326. theServerName = theDataSource.Substring (0, idx);
  327. theInstanceName = theDataSource.Substring (idx + 1);
  328. // do port discovery via UDP port 1434
  329. port = DiscoverTcpPortViaSqlMonitor (theServerName, theInstanceName);
  330. if (port == -1)
  331. success = false;
  332. }
  333. else {
  334. theServerName = theDataSource;
  335. }
  336. if(theServerName.Equals("(local)"))
  337. theServerName = "localhost";
  338. return success;
  339. }
  340. private int DiscoverTcpPortViaSqlMonitor(string ServerName, string InstanceName)
  341. {
  342. SqlMonitorSocket msock;
  343. msock = new SqlMonitorSocket (ServerName, InstanceName);
  344. int SqlServerPort = msock.DiscoverTcpPort ();
  345. msock = null;
  346. return SqlServerPort;
  347. }
  348. void SetConnectionString (string connectionString)
  349. {
  350. connectionString += ";";
  351. NameValueCollection parameters = new NameValueCollection ();
  352. if (connectionString == String.Empty)
  353. return;
  354. bool inQuote = false;
  355. bool inDQuote = false;
  356. string name = String.Empty;
  357. string value = String.Empty;
  358. StringBuilder sb = new StringBuilder ();
  359. foreach (char c in connectionString)
  360. {
  361. switch (c) {
  362. case '\'':
  363. inQuote = !inQuote;
  364. break;
  365. case '"' :
  366. inDQuote = !inDQuote;
  367. break;
  368. case ';' :
  369. if (!inDQuote && !inQuote) {
  370. if (name != String.Empty && name != null) {
  371. value = sb.ToString ();
  372. parameters [name.ToUpper ().Trim ()] = value.Trim ();
  373. }
  374. name = String.Empty;
  375. value = String.Empty;
  376. sb = new StringBuilder ();
  377. }
  378. else
  379. sb.Append (c);
  380. break;
  381. case '=' :
  382. if (!inDQuote && !inQuote) {
  383. name = sb.ToString ();
  384. sb = new StringBuilder ();
  385. }
  386. else
  387. sb.Append (c);
  388. break;
  389. default:
  390. sb.Append (c);
  391. break;
  392. }
  393. }
  394. if (this.ConnectionString == null)
  395. {
  396. SetDefaultConnectionParameters (parameters);
  397. }
  398. SetProperties (parameters);
  399. this.connectionString = connectionString;
  400. }
  401. void SetDefaultConnectionParameters (NameValueCollection parameters)
  402. {
  403. if (null == parameters.Get ("APPLICATION NAME"))
  404. parameters["APPLICATION NAME"] = "Mono SqlClient Data Provider";
  405. if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT"))
  406. parameters["CONNECT TIMEOUT"] = "15";
  407. if (null == parameters.Get ("CONNECTION LIFETIME"))
  408. parameters["CONNECTION LIFETIME"] = "0";
  409. if (null == parameters.Get ("CONNECTION RESET"))
  410. parameters["CONNECTION RESET"] = "true";
  411. if (null == parameters.Get ("ENLIST"))
  412. parameters["ENLIST"] = "true";
  413. if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
  414. parameters["INTEGRATED SECURITY"] = "false";
  415. if (null == parameters.Get ("MAX POOL SIZE"))
  416. parameters["MAX POOL SIZE"] = "100";
  417. if (null == parameters.Get ("MIN POOL SIZE"))
  418. parameters["MIN POOL SIZE"] = "0";
  419. if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
  420. parameters["NETWORK LIBRARY"] = "dbmssocn";
  421. if (null == parameters.Get ("PACKET SIZE"))
  422. parameters["PACKET SIZE"] = "512";
  423. if (null == parameters.Get ("PERSIST SECURITY INFO"))
  424. parameters["PERSIST SECURITY INFO"] = "false";
  425. if (null == parameters.Get ("POOLING"))
  426. parameters["POOLING"] = "true";
  427. if (null == parameters.Get ("WORKSTATION ID"))
  428. parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
  429. }
  430. private void SetProperties (NameValueCollection parameters)
  431. {
  432. string value;
  433. foreach (string name in parameters) {
  434. value = parameters[name];
  435. switch (name) {
  436. case "APPLICATION NAME" :
  437. parms.ApplicationName = value;
  438. break;
  439. case "ATTACHDBFILENAME" :
  440. case "EXTENDED PROPERTIES" :
  441. case "INITIAL FILE NAME" :
  442. break;
  443. case "CONNECT TIMEOUT" :
  444. case "CONNECTION TIMEOUT" :
  445. connectionTimeout = Int32.Parse (value);
  446. break;
  447. case "CONNECTION LIFETIME" :
  448. break;
  449. case "CONNECTION RESET" :
  450. connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
  451. break;
  452. case "CURRENT LANGUAGE" :
  453. parms.Language = value;
  454. break;
  455. case "DATA SOURCE" :
  456. case "SERVER" :
  457. case "ADDRESS" :
  458. case "ADDR" :
  459. case "NETWORK ADDRESS" :
  460. dataSource = value;
  461. break;
  462. case "ENLIST" :
  463. break;
  464. case "INITIAL CATALOG" :
  465. case "DATABASE" :
  466. parms.Database = value;
  467. break;
  468. case "INTEGRATED SECURITY" :
  469. case "TRUSTED_CONNECTION" :
  470. break;
  471. case "MAX POOL SIZE" :
  472. maxPoolSize = Int32.Parse (value);
  473. break;
  474. case "MIN POOL SIZE" :
  475. minPoolSize = Int32.Parse (value);
  476. break;
  477. case "NET" :
  478. case "NETWORK LIBRARY" :
  479. if (!value.ToUpper ().Equals ("DBMSSOCN"))
  480. throw new ArgumentException ("Unsupported network library.");
  481. break;
  482. case "PACKET SIZE" :
  483. packetSize = Int32.Parse (value);
  484. break;
  485. case "PASSWORD" :
  486. case "PWD" :
  487. parms.Password = value;
  488. break;
  489. case "PERSIST SECURITY INFO" :
  490. break;
  491. case "POOLING" :
  492. pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
  493. break;
  494. case "UID" :
  495. case "USER ID" :
  496. parms.User = value;
  497. break;
  498. case "WORKSTATION ID" :
  499. parms.Hostname = value;
  500. break;
  501. }
  502. }
  503. }
  504. static bool IsValidDatabaseName (string database)
  505. {
  506. if (database.Length > 32 || database.Length < 1)
  507. return false;
  508. if (database[0] == '"' && database[database.Length] == '"')
  509. database = database.Substring (1, database.Length - 2);
  510. else if (Char.IsDigit (database[0]))
  511. return false;
  512. if (database[0] == '_')
  513. return false;
  514. foreach (char c in database.Substring (1, database.Length - 1))
  515. if (!Char.IsLetterOrDigit (c) && c != '_')
  516. return false;
  517. return true;
  518. }
  519. private void OnSqlInfoMessage (SqlInfoMessageEventArgs value)
  520. {
  521. if (InfoMessage != null)
  522. InfoMessage (this, value);
  523. }
  524. private void OnStateChange (StateChangeEventArgs value)
  525. {
  526. if (StateChange != null)
  527. StateChange (this, value);
  528. }
  529. private sealed class SqlMonitorSocket : UdpClient
  530. {
  531. // UDP port that the SQL Monitor listens
  532. private static readonly int SqlMonitorUdpPort = 1434;
  533. private static readonly string SqlServerNotExist = "SQL Server does not exist or access denied";
  534. private string server;
  535. private string instance;
  536. internal SqlMonitorSocket (string ServerName, string InstanceName)
  537. : base (ServerName, SqlMonitorUdpPort)
  538. {
  539. server = ServerName;
  540. instance = InstanceName;
  541. }
  542. internal int DiscoverTcpPort ()
  543. {
  544. int SqlServerTcpPort;
  545. Client.Blocking = false;
  546. // send command to UDP 1434 (SQL Monitor) to get
  547. // the TCP port to connect to the MS SQL server
  548. ASCIIEncoding enc = new ASCIIEncoding ();
  549. Byte[] rawrq = new Byte [instance.Length + 1];
  550. rawrq[0] = 4;
  551. enc.GetBytes (instance, 0, instance.Length, rawrq, 1);
  552. int bytes = Send (rawrq, rawrq.Length);
  553. if (!Active)
  554. return -1; // Error
  555. bool result;
  556. result = Client.Poll (100, SelectMode.SelectRead);
  557. if (result == false)
  558. return -1; // Error
  559. if (Client.Available <= 0)
  560. return -1; // Error
  561. IPEndPoint endpoint = new IPEndPoint (Dns.GetHostByName ("localhost").AddressList [0], 0);
  562. Byte [] rawrs;
  563. rawrs = Receive (ref endpoint);
  564. string rs = Encoding.ASCII.GetString (rawrs);
  565. string[] rawtokens = rs.Split (';');
  566. Hashtable data = new Hashtable ();
  567. for (int i = 0; i < rawtokens.Length / 2 && i < 256; i++) {
  568. data [rawtokens [i * 2]] = rawtokens [ i * 2 + 1];
  569. }
  570. if (!data.ContainsKey ("tcp"))
  571. throw new NotImplementedException ("Only TCP/IP is supported.");
  572. SqlServerTcpPort = int.Parse ((string) data ["tcp"]);
  573. Close ();
  574. return SqlServerTcpPort;
  575. }
  576. }
  577. #endregion // Methods
  578. }
  579. }