Beispiel #1
0
 private TableBase(DatabaseBase db, string tableName, Type recordType, bool pIsTemporaryTable, bool?pUseConcurrenyChecking)
 {
     if (db == null)
     {
         throw new NullReferenceException("DefaultDatabase cannot be null");
     }
     if (string.IsNullOrWhiteSpace(tableName))
     {
         throw new Exception("tableName cannot be null or empty");
     }
     if (recordType == (Type)null)
     {
         throw new NullReferenceException("recordType cannot be null");
     }
     if (!recordType.IsSubclassOf(typeof(Record)))
     {
         throw new Exception("recordType must be a subclass of Sql.ARow");
     }
     this.defaultDatabase       = db;
     this.tableName             = tableName;
     this.rowType               = recordType;
     this.isTemporaryTable      = pIsTemporaryTable;
     this.alias                 = "_" + TableBase.GetNextAlias();
     this.useConcurrenyChecking = pUseConcurrenyChecking;
 }
Beispiel #2
0
        /// <summary>
        /// Creates a temporary table with an auto generated table name
        ///
        /// </summary>
        /// <param name="recordType"/>
        protected TableBase(Type recordType)
        {
            if (!recordType.IsSubclassOf(typeof(Record)))
            {
                throw new Exception("recordType must be a subclass of Sql.ARow");
            }
            this.rowType          = recordType;
            this.isTemporaryTable = true;
            string nextAlias = TableBase.GetNextAlias();

            this.tableName             = "Temp_" + nextAlias;
            this.alias                 = "_" + nextAlias;
            this.useConcurrenyChecking = new bool?();
        }