using Microsoft.AnalysisServices.Tabular; using Tom=Microsoft.AnalysisServices.Tabular; namespace BismNormalizer.TabularCompare.TabularMetadata { /// /// Abstraction of a tabular model [model] with properties and methods for comparison purposes. /// public class Model : TabularObject { #region Private Members private TabularModel _parentTabularModel; private Tom.Model _tomModel; #endregion #region Constructors /// /// Initializes a new instance of the Model class using multiple parameters. /// /// TabularModel object that the Model object belongs to. /// Tabular Object Model Model object abtstracted by the Model class. public Model(TabularModel parentTabularModel, Tom.Model tomModel) : base(tomModel, parentTabularModel) { _parentTabularModel = parentTabularModel; _tomModel = tomModel; PopulateProperties(); } #endregion #region Properties /// /// TabularModel object that the Model object belongs to. /// public TabularModel ParentTabularModel => _parentTabularModel; /// /// Tabular Object Model Model object abtstracted by the Model class. /// public Tom.Model TomModel => _tomModel; public override string ToString() => this.GetType().FullName; #endregion private void PopulateProperties() { string customObjectDefinition = "{ "; if (!string.IsNullOrEmpty(_tomModel.Description)) { customObjectDefinition += $"\"description\": \"{_tomModel.Description}\", "; } customObjectDefinition += $"\"defaultMode\": \"{_tomModel.DefaultMode.ToString().ToLower()}\", "; customObjectDefinition += $"\"discourageImplicitMeasures\": {_tomModel.DiscourageImplicitMeasures.ToString().ToLower()} }}"; base.SetCustomObjectDefinition(customObjectDefinition); } } }