using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Uber.Storage { /// /// Represents a database server and holds information about the database host, port and access credentials. /// public class DatabaseServer { #region Fields private readonly string mHost; private readonly uint mPort; private readonly string mUser; private readonly string mPassword; #endregion #region Properties /// /// The network host of the database server, eg 'localhost' or '127.0.0.1'. /// public string Host { get { return mHost; } } /// /// The network port of the database server as an unsigned 32 bit integer. /// public uint Port { get { return mPort; } } /// /// The username to use when connecting to the database. /// public string User { get { return mUser; } } /// /// The password to use in combination with the username when connecting to the database. /// public string Password { get { return mPassword; } } #endregion #region Constructor /// /// Constructs a DatabaseServer object with given details. /// /// The network host of the database server, eg 'localhost' or '127.0.0.1'. /// The network port of the database server as an unsigned 32 bit integer. /// The username to use when connecting to the database. /// The password to use in combination with the username when connecting to the database. public DatabaseServer(string sHost, uint Port, string sUser, string sPassword) { if (sHost == null || sHost.Length == 0) throw new ArgumentException("sHost"); if (sUser == null || sUser.Length == 0) throw new ArgumentException("sUser"); mHost = sHost; mPort = Port; mUser = sUser; mPassword = (sPassword != null) ? sPassword : ""; } #endregion #region Methods public override string ToString() { return mUser + "@" + mHost; } #endregion } }