/************************************************************************************ * * Umbraco Data Layer * MIT Licensed work * ©2008 Ruben Verborgh * ***********************************************************************************/ using System; using System.Collections; using System.Collections.Generic; namespace umbraco.DataLayer.Utility.Table { /// /// Default implementation of the interface. /// /// The type of SQL helper. public class DefaultTableUtility : BaseUtility, ITableUtility where S : ISqlHelper { /// /// Initializes a new instance of the class. /// /// The SQL helper. public DefaultTableUtility(S sqlHelper) : base(sqlHelper) { } #region ITableUtility Members /// /// Determines whether the table with the specified name exists. /// /// The name. /// true if the table exists; otherwise, false. public virtual bool ContainsTable(string name) { return GetTable(name) != null; } /// /// Gets the table with the specified name. /// /// The name. /// The table, or null if no table with that name exists. public virtual ITable GetTable(string name) { throw new NotImplementedException(); } /// /// Saves or updates the table. /// /// The table to be saved. public virtual void SaveTable(ITable table) { throw new NotImplementedException(); } /// /// Creates the table with the specified name. /// /// The name. /// The table. public virtual ITable CreateTable(string name) { if (String.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); if (GetTable(name) != null) throw new ArgumentException(String.Format("A table named '{0}' already exists."), name); return new DefaultTable(name); } #endregion } }