コード例 #1
0
        public ProviderDataSource AddDataSource(string name = null)
        {
            if (Handler.UsePowerBIGovernance && !PowerBI.PowerBIGovernance.AllowCreate(typeof(ProviderDataSource)))
            {
                return(null);
            }

            Handler.BeginUpdate("add data source");

            var ds = ProviderDataSource.CreateNew(this, name);

            Handler.EndUpdate();
            return(ds);
        }
コード例 #2
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();
        }
コード例 #3
0
        public ProviderDataSource AddDataSource(string name = null)
        {
            if (!Handler.PowerBIGovernance.AllowCreate(typeof(ProviderDataSource)))
            {
                throw new PowerBIGovernanceException("Adding Data Sources to this Power BI Model is not supported.");
            }

            Handler.BeginUpdate("add data source");

            var ds = ProviderDataSource.CreateNew(this, name);

            Handler.EndUpdate();
            return(ds);
        }