private ConstraintInfo(DataRow drConstraint, FirebirdProcessor processor) { Name = drConstraint["rdb$constraint_name"].ToString().Trim(); IsPrimaryKey = drConstraint["rdb$constraint_type"].ToString().Trim() == "PRIMARY KEY"; IsNotNull = drConstraint["rdb$constraint_type"].ToString().Trim() == "NOT NULL"; IsForeignKey = drConstraint["rdb$constraint_type"].ToString().Trim() == "FOREIGN KEY"; IsUnique = drConstraint["rdb$constraint_type"].ToString().Trim() == "UNIQUE"; IndexName = drConstraint["rdb$index_name"].ToString().Trim(); if (IsForeignKey) { using (DataSet dsForeign = processor.Read(colQuery, AdoHelper.FormatValue(Name))) { DataRow drForeign = dsForeign.Tables[0].Rows[0]; ForeignIndex = IndexInfo.Read(processor, IndexName); UpdateRule = GetForeignRule(drForeign["rdb$update_rule"]); DeleteRule = GetForeignRule(drForeign["rdb$delete_rule"]); } } }
private void LoadIndexes() { Indexes = IndexInfo.Read(Processor, TableMeta); foreach (IndexInfo index in Indexes) { IndexDefinition indexDef = new IndexDefinition() { Name = index.Name, TableName = TableMeta.Name, IsUnique = index.IsUnique }; index.Columns.ForEach(x => indexDef.Columns.Add( new IndexColumnDefinition() { Name = x, Direction = index.IsAscending ? Direction.Ascending : Direction.Descending })); Definition.Indexes.Add(indexDef); } }