// CONSTRUCTORS DESTRUCTOR /// <summary> /// Basic constructor without parameters. /// </summary> public DataBaseService() { driver = null; message = null; dbConfiguration = null; rand = new System.Random(); disposedValue = false; }
/// <summary> /// Sets database configuration. /// </summary> /// <param name="configuration">Some configuration for setting up.</param> /// <returns> /// Current service for data access. /// </returns> /// <exception cref="System.ArgumentException"> /// Thrown when the configuration is inappropriate. /// </exception> public Interfaces.IDataAccessService SetConfiguration(Interfaces.IConfiguration configuration) { if (!(configuration is DBConfiguration)) { throw new System.ArgumentException("The configuration is inappropriate."); } dbConfiguration = (DBConfiguration)configuration; return(this); }
/// <summary> /// Special disposer. /// </summary> /// <param name="disposing">Says what resources must be disposed.</param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { dbConfiguration.Dispose(); dbConfiguration = null; SetNullToDriverAndMessage(); rand = null; } disposedValue = true; } }