当前位置: 首页>>代码示例>>C#>>正文


C# Index.Script方法代码示例

本文整理汇总了C#中Index.Script方法的典型用法代码示例。如果您正苦于以下问题:C# Index.Script方法的具体用法?C# Index.Script怎么用?C# Index.Script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Index的用法示例。


在下文中一共展示了Index.Script方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createStgIndex

        private void createStgIndex(Index i, TableViewBase parent)
        {
            if (i.PartitionScheme == "")
                throw (new System.NotSupportedException(
                    String.Format("The index '{0}' is not aligned to a Partition Scheme", i.Name)));

              // todo:  differentiate between Base Table as source, and View as source

              // LZAV:  Index stgIndex = new Index(parent, parent.Name + "_" + i.Name);
              String indexName = parent.Name + "_" + i.Name;		// LZAV
              if (indexName.Length > 128)						// LZAV
              indexName = "IX_CL_" + parent.Name;				// LZAV

              Index stgIndex = new Index(parent, indexName);		// LZAV

              foreach (IndexedColumn iCol in i.IndexedColumns)
              {
             IndexedColumn stgICol = new IndexedColumn(stgIndex, iCol.Name, iCol.Descending);
             stgICol.IsIncluded = iCol.IsIncluded;
             stgIndex.IndexedColumns.Add(stgICol);
              }
              stgIndex.IndexType = i.IndexType;
              stgIndex.IndexKeyType = i.IndexKeyType;
              stgIndex.IsClustered = i.IsClustered;
              stgIndex.IsUnique = i.IsUnique;
              stgIndex.CompactLargeObjects = i.CompactLargeObjects;
              stgIndex.IgnoreDuplicateKeys = i.IgnoreDuplicateKeys;
              stgIndex.IsFullTextKey = i.IsFullTextKey;
              stgIndex.PadIndex = i.PadIndex;
              stgIndex.FileGroup = db.PartitionSchemes[i.PartitionScheme].FileGroups[partitionNumber - 1];

              // add the partitioning column to the index if it is not already there
              String partitionKeyName = i.PartitionSchemeParameters[0].Name;
              if (stgIndex.IndexedColumns[partitionKeyName] == null)
              {
             IndexedColumn stgICol = new IndexedColumn(stgIndex, partitionKeyName);
             // It is added as a Key to the Clustered index and as an Include column to a Nonclustered
             stgICol.IsIncluded = !stgIndex.IsClustered;
             stgIndex.IndexedColumns.Add(stgICol);
              }

              if (srv.VersionMajor >= 10)
              {
             // Define compression property to match by creating a Physical Partition object (not applicable to Colstore)
             {
                PhysicalPartition stgPartition = new PhysicalPartition(stgIndex, 1);
                if (i.IndexType != IndexType.NonClusteredColumnStoreIndex)
                {
                    stgPartition.DataCompression = i.PhysicalPartitions[partitionNumber - 1].DataCompression;
                }
                stgIndex.PhysicalPartitions.Add(stgPartition);
             }
             // Handle Filtered Index
             if (i.HasFilter)
             {
                stgIndex.FilterDefinition = i.FilterDefinition;
             }
              }
              scriptChunks.Add(stgIndex.Script());
              if (executeCommands) stgIndex.Create();
        }
开发者ID:lucazav,项目名称:SqlServerPartitionManagementUtility,代码行数:61,代码来源:PartitionManagement.cs


注:本文中的Index.Script方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。