/// <summary>
 /// Checks if table is empty i.e. no records exist.
 /// </summary>
 /// <returns></returns>
 public bool IsEmpty()
 {
     foreach (List <IIndex <TRecord> > list in this.table.Indexes)
     {
         if (list != null && 0 < list.Count)
         {
             foreach (IIndex <TRecord> index in list)
             {
                 return(index.IsEmpty(this.StoreSnapshot.Version));
             }
         }
     }
     if (this.table.PrimaryKey != null)
     {
         // No real index were found. The only hope is pseudo unique index of primary key.
         // Right now it is not faster then just table scan, but anyway use it as in the future it may change.
         return(this.table.PrimaryKey.IsEmpty(this.StoreSnapshot.Version));
     }
     // There is no indexes on the table. Do a full scan.
     return(TableSnapshot <TRecord> .IsEmpty(this.table, this.StoreSnapshot.Version));
 }
Esempio n. 2
0
 public bool IsEmpty(int version)
 {
     return(TableSnapshot <TRecord> .IsEmpty(this.table, version));
 }