/// <summary> /// Loads an Analysis Services tabular database (Compatibility Level 1200 or newer) from a file /// or folder. /// </summary> /// <param name="path"></param> public TabularModelHandler(string path, TabularModelHandlerSettings settings = null) : this(settings) { _disableUpdates = true; var file = new FileInfo(path); // If the file extension is .pbit, assume Power BI template: if (file.Exists && file.Extension.EqualsI(".pbit")) { LoadPowerBiTemplateFile(path); } // If the file name is "database.json" or path is a directory, assume Split Model: else if ((file.Exists && file.Name.EqualsI("database.json")) || Directory.Exists(path)) { LoadSplitModelFiles(path); } // In any other case, assume this is just a regular Model.bim file: else { LoadModelFile(path); } UndoManager.Suspend(); Model.ClearTabularEditorAnnotations(); _disableUpdates = false; UndoManager.Resume(); PowerBIGovernance.UpdateGovernanceMode(); }
/// <summary> /// Creates a new blank Tabular Model /// </summary> public TabularModelHandler(int compatibilityLevel = 1200, TabularModelHandlerSettings settings = null, bool pbiDatasetModel = false) { Settings = settings ?? TabularModelHandlerSettings.Default; Singleton = this; server = null; database = new TOM.Database("SemanticModel") { CompatibilityLevel = compatibilityLevel, CompatibilityMode = pbiDatasetModel ? Microsoft.AnalysisServices.CompatibilityMode.PowerBI : Microsoft.AnalysisServices.CompatibilityMode.AnalysisServices }; CompatibilityLevel = compatibilityLevel; database.Model = new TOM.Model(); if (pbiDatasetModel) { database.Model.DefaultPowerBIDataSourceVersion = TOM.PowerBIDataSourceVersion.PowerBI_V3; } SourceType = ModelSourceType.File; Source = "Model.bim"; Status = "Succesfully created new model."; Init(); UndoManager.Enabled = true; PowerBIGovernance.UpdateGovernanceMode(this); }
private void UpdateSettings() { PowerBIGovernance.UpdateGovernanceMode(); _tree?.OnStructureChanged(); if (trace != null) { if (_settings.ChangeDetectionLocalServers && !trace.IsStarted) { trace.Start(); } else if (!_settings.ChangeDetectionLocalServers && trace.IsStarted) { trace.Stop(); } } }
/// <summary> /// Creates a new blank Tabular Model /// </summary> public TabularModelHandler(int compatibilityLevel = 1200, TabularModelHandlerSettings settings = null) { Settings = settings ?? TabularModelHandlerSettings.Default; Singleton = this; server = null; database = new TOM.Database("SemanticModel") { CompatibilityLevel = compatibilityLevel }; CompatibilityLevel = compatibilityLevel; database.Model = new TOM.Model(); SourceType = ModelSourceType.File; Source = "Model.bim"; Status = "Succesfully created new model."; Init(); UndoManager.Enabled = true; PowerBIGovernance.UpdateGovernanceMode(this); }
private void UpdateSettings() { PowerBIGovernance.UpdateGovernanceMode(this); _tree?.OnStructureChanged(); }