Click or drag to resize

Index Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
You can query an index to obtain a select number of columns from records matching specific filters. After an index has been created (see CreateIndex(String, IndexColumn)) the index persists in the transactional repository.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBase.TransactionalIndex

Namespace:  Telogis.GeoBase.Transactional
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public class Index

The Index type exposes the following members.

Properties
  NameDescription
Public propertyFields
Gets a list of the fields in this Index.
Public propertyTable
Gets the Table used for this Index.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodQuery
Performs a query of this table using a specified index. A set of filters can also be specified to narrow the result set.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
You should create your indexes when you create your table structure. The following code snippet provides an example of how you can do this. Also, refer to TransactionalRepository(String).
C#
 static TransactionalRepository InitRepository(String fname) {
    // 
    // if the repository file doesn't exist then it will be created
    // 
    bool created = !System.IO.File.Exists(fname);
    TransactionalRepository tr = new TransactionalRepository(fname);

    // 
    // If we created a new repository file then the repository is empty
    // and we must create the appropriate tables
    // 
    if (created)
    {
        Console.WriteLine("Creating transactional repository structure");
        // Creating tables and indexes must occur within a transaction
        tr.BeginTransaction();

        // create table(s) and some columns...
        ...

        // 
        // Create some indexes to allow us to query the table contents
        // 
        myCustomerTable.CreateIndex("name_address", 
            new IndexColumn[3] {
                new IndexColumn("CustomerName"),
                new IndexColumn("Address"),
                new IndexColumn("Phone")
            });

        myVehicleTable.CreateIndex("vehicle_details",
            new IndexColumn[4] {
                new IndexColumn("Type"),
                new IndexColumn("Weight"),
                new IndexColumn("Axles"),
                new IndexColumn("Height")
            });

        // at this point you may want to fill the table with some 
        // initial data...
        tr.EndTransaction;
    }
    else
    {
        Console.WriteLine("Loaded transactional repository from disk.");
        Console.WriteLine("I didn't need to create any tables, columns or indexes.");
    }

    return tr;
}
Now, by using a combination of filters you can select rows from each table using our indexes.
C#
Index idx_customers = myCustomerTable.Indexes["name_address"];

ContainsFilter phoneContains = new ContainsFilter("Phone", "866");
EqualFilter nameIs = new EqualFilter("CustomerName", "My Corporate");
ColumnFilter[] filters = new ColumnFilter[2] { phoneContains, nameIs };

using (EnsureTransaction trans = new EnsureTransaction(myTransactionalRepository)) {

  // we can now display the address of each customer from 'My Corporate' whose phone 
  // number contains '866'
  foreach (Record r in idx_customers.Query(filters)) {
      Console.WriteLine("{0}, {1}, {2}", r["CustomerName"], r["Address"], r["Phone"]);
  }

  ...

}
See Also