本文整理汇总了C#中Index.Drop方法的典型用法代码示例。如果您正苦于以下问题:C# Index.Drop方法的具体用法?C# Index.Drop怎么用?C# Index.Drop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index.Drop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropIndex
public IEnumerable<string> DropIndex(string tableName, string indexName)
{
Table table = GetTable(tableName);
Index index = new Index(table, indexName);
index.Drop();
return ScriptChanges(table.Parent.Parent);
}
示例2: DropConstraint
private static IEnumerable<string> DropConstraint(string tableName, string constraintName, IndexKeyType keyType)
{
Table table = GetTable(tableName);
Index uniqueConstraint = new Index(table, constraintName) { IndexKeyType = keyType };
uniqueConstraint.Drop();
return ScriptChanges(table.Parent.Parent);
}
示例3: AddColumnToIndex
public static void AddColumnToIndex(Table table, Column column, Index ind)
{
string oldName = ind.Name;
var idx = new Index(table, oldName)
{
BoundingBoxYMax = ind.BoundingBoxYMax,
BoundingBoxYMin = ind.BoundingBoxYMin,
BoundingBoxXMax = ind.BoundingBoxXMax,
BoundingBoxXMin = ind.BoundingBoxXMin,
CompactLargeObjects = ind.CompactLargeObjects,
DisallowRowLocks = ind.DisallowRowLocks,
FileGroup = ind.FileGroup,
FileStreamFileGroup = ind.FileStreamFileGroup,
FileStreamPartitionScheme = ind.FileStreamPartitionScheme,
FillFactor = ind.FillFactor,
FilterDefinition = ind.FilterDefinition,
IgnoreDuplicateKeys = ind.IgnoreDuplicateKeys,
IndexKeyType = ind.IndexKeyType,
IsClustered = ind.IsClustered,
IsFullTextKey = ind.IsFullTextKey,
IsUnique = ind.IsUnique,
Level1Grid = ind.Level1Grid,
Level2Grid = ind.Level2Grid,
Level3Grid = ind.Level3Grid,
Level4Grid = ind.Level4Grid,
MaximumDegreeOfParallelism = ind.MaximumDegreeOfParallelism,
NoAutomaticRecomputation = ind.NoAutomaticRecomputation,
OnlineIndexOperation = ind.OnlineIndexOperation,
PadIndex = ind.PadIndex,
ParentXmlIndex = ind.ParentXmlIndex,
PartitionScheme = ind.PartitionScheme,
SecondaryXmlIndexType = ind.SecondaryXmlIndexType,
SortInTempdb = ind.SortInTempdb,
SpatialIndexType = ind.SpatialIndexType,
};
foreach (IndexedColumn iColumn in ind.IndexedColumns)
{
var newIdxColumn = new IndexedColumn(idx, iColumn.Name)
{
Descending = iColumn.Descending,
IsIncluded = iColumn.IsIncluded,
};
idx.IndexedColumns.Add(newIdxColumn);
}
idx.IndexedColumns.Add(new IndexedColumn(idx, column.Name));
bool oldDisallowPageLocks = ind.DisallowPageLocks;
ind.Drop();
idx.Create();
idx.DisallowPageLocks = oldDisallowPageLocks;
idx.Alter();
}