Ejemplo n.º 1
0
        protected override void Init()
        {
            if (Partitions.Count == 0 && !(this is CalculatedTable))
            {
                // Make sure the table contains at least one partition (Calculated Tables handles this on their own), but don't add it to the undo stack:
                Handler.UndoManager.Enabled = false;

                if (Model.DataSources.Any(ds => ds.Type == DataSourceType.Provider) || Handler.CompatibilityLevel < 1400)
                {
                    Partition.CreateNew(this, Name);
                }
                else
                {
                    MPartition.CreateNew(this, Name);
                }

                Handler.UndoManager.Enabled = true;
            }

            RowLevelSecurity = new TableRLSIndexer(this);

            if (Handler.CompatibilityLevel >= 1400)
            {
                ObjectLevelSecurity = new TableOLSIndexer(this);
            }

            base.Init();
        }
Ejemplo n.º 2
0
        protected override void Init()
        {
            PartitionViewTable = new PartitionViewTable(this);

            if (Partitions.Count == 0 && !(this is CalculatedTable))
            {
                // Make sure the table contains at least one partition (Calculated Tables handles this on their own):

                if (Model.DataSources.Any(ds => ds.Type == DataSourceType.Structured))
                {
                    MPartition.CreateNew(this, Name);
                }
                else
                {
                    Partition.CreateNew(this, Name);
                }
            }

            RowLevelSecurity = new TableRLSIndexer(this);

            if (Handler.CompatibilityLevel >= 1400)
            {
                ObjectLevelSecurity = new TableOLSIndexer(this);
            }

            CheckChildrenErrors();

            base.Init();
        }
Ejemplo n.º 3
0
        public Partition AddPartition(string name = null, string query = null)
        {
            Handler.BeginUpdate("add partition");
            var partition = Partition.CreateNew(this, name);

            if (!string.IsNullOrEmpty(query))
            {
                partition.Query = query;
            }
            Handler.EndUpdate();
            return(partition);
        }
Ejemplo n.º 4
0
        public void ConvertToLegacy(ProviderDataSource providerSource = null)
        {
            Handler.BeginUpdate("Convert partitions");
            foreach (var oldPartition in this.OfType <MPartition>().ToList())
            {
                var newPartition = Partition.CreateNew(Table);
                newPartition.DataSource = providerSource == null ? oldPartition.DataSource : providerSource;
                newPartition.Expression = oldPartition.Expression;

                oldPartition.Delete();
                newPartition.Name = oldPartition.Name;
            }
            Handler.EndUpdate();
        }
Ejemplo n.º 5
0
        protected override void Init()
        {
            PartitionViewTable = new PartitionViewTable(this);

            if (Partitions.Count == 0 && !(this is CalculatedTable))
            {
                // Make sure the table contains at least one partition (Calculated Tables handles this on their own):
                Partition.CreateNew(this, Name);
            }

            RowLevelSecurity = new TableRLSIndexer(this);

            if (Handler.CompatibilityLevel >= 1400)
            {
                ObjectLevelSecurity = new TableOLSIndexer(this);
            }

            CheckChildrenErrors();

            base.Init();
        }