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); }
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(); }
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); }