Class Index
Represents a database index associated with a table. An index is used to enhance the performance of database queries by providing quick access to rows in a table based on the values of one or more columns.
public class Index : Key, IVisitorAcceptor, ICheckable
- Inheritance
-
Index
- Implements
- Inherited Members
Remarks
The Index class inherits from the Key class, which represents a set of columns in the table that define a constraint or relationship. The Index can be unique, primary, or secondary and can be matched against primary or foreign key constraints in the table.
Constructors
Index(Table, string, IEnumerable<string>, bool, bool)
Initializes a new instance of the Index class.
public Index(Table table, string name, IEnumerable<string> columnNames, bool unique, bool primaryKey)
Parameters
tableTableThe table that owns the index.
namestringThe name of the index.
columnNamesIEnumerable<string>The names of the columns that make up the index.
uniqueboolWhether the index is unique.
primaryKeyboolWhether the index is a primary key.
Properties
IsPrimaryKey
Gets a value indicating whether the index is a primary key.
public bool IsPrimaryKey { get; }
Property Value
IsUnique
Gets a value indicating whether the index is unique.
public bool IsUnique { get; }
Property Value
MatchesForeignKey
Gets a value indicating whether the index matches a foreign key constraint.
public bool MatchesForeignKey { get; }
Property Value
MatchesKey
Gets a value indicating whether the index matches a primary or foreign key constraint.
public bool MatchesKey { get; }
Property Value
MatchesPrimaryKey
Gets a value indicating whether the index matches a primary key constraint.
public bool MatchesPrimaryKey { get; }
Property Value
Methods
AcceptVisitor(IVisitor)
Accepts a visitor, allowing it to perform operations on the implementing class. The visitor will typically have specific methods for handling different types of elements in the object structure.
public override void AcceptVisitor(IVisitor visitor)
Parameters
visitorIVisitorThe visitor instance that will perform operations on the implementing class.