Class Model
A Tabular model created at compatibility level 1200 or above.
Implements
Inherited Members
Namespace: TabularEditor.TOMWrapper
Assembly: TOMWrapper.dll
Syntax
public sealed class Model : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, IDescriptionObject, IExtendedPropertyObject, ITranslatableObject, IAnnotationObject, ITabularObjectContainer, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, INamedObject
Properties
AllCalculationItems
Iterates all calculation items on all calculation groups of the model.
Declaration
[Browsable(false)]
public IEnumerable<CalculationItem> AllCalculationItems { get; }
Property Value
Type | Description |
---|---|
IEnumerable<CalculationItem> |
AllColumns
A collection of every column across all tables in the model.
Declaration
[Browsable(false)]
public IEnumerable<Column> AllColumns { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Column> |
AllHierarchies
A collection of every hierarchy across all tables in the model.
Declaration
[Browsable(false)]
public IEnumerable<Hierarchy> AllHierarchies { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Hierarchy> |
AllKPIs
A collection of every KPI across all tables in the model.
Declaration
[Browsable(false)]
public IEnumerable<KPI> AllKPIs { get; }
Property Value
Type | Description |
---|---|
IEnumerable<KPI> |
AllLevels
Iterates all levels on all hierarchies on all tables of the model.
Declaration
[Browsable(false)]
public IEnumerable<Level> AllLevels { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Level> |
AllMeasures
A collection of every measure across all tables in the model.
Declaration
[Browsable(false)]
public IEnumerable<Measure> AllMeasures { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Measure> |
AllPartitions
A collection of every partition across all tables in the model.
Declaration
[Browsable(false)]
public IEnumerable<Partition> AllPartitions { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Partition> |
Annotations
The collection of Annotations on the current Model.
Declaration
[Browsable(true)]
public AnnotationCollection Annotations { get; }
Property Value
Type | Description |
---|---|
AnnotationCollection |
AutomaticAggregationOptions
Protocol-specific options used to connect the data source
Declaration
[Browsable(false)]
public Model.AutomaticAggregationOptionsImpl AutomaticAggregationOptions { get; }
Property Value
Type | Description |
---|---|
Model.AutomaticAggregationOptionsImpl |
CalculationGroups
Enumerate all calculation group tables on this model.
Declaration
[Browsable(false)]
public IEnumerable<CalculationGroupTable> CalculationGroups { get; }
Property Value
Type | Description |
---|---|
IEnumerable<CalculationGroupTable> |
Collation
The collation sequence. Analysis Services uses Windows collations.
Declaration
public string Collation { get; set; }
Property Value
Type | Description |
---|---|
string |
Culture
The name of the Culture used for formatting. Once it's used by a child object, this value can't be changed.
Declaration
[TypeConverter(typeof(CultureConverter))]
public string Culture { get; set; }
Property Value
Type | Description |
---|---|
string |
Cultures
The collection of Culture objects on this Model.
Declaration
[TypeConverter(typeof(StringConverter))]
public CultureCollection Cultures { get; }
Property Value
Type | Description |
---|---|
CultureCollection |
DataSourceDefaultMaxConnections
DataSourceDefaultMaxConnections will be used for connections to a data source if MaxConnections is set to -1 on the data source object or if there is no corresponding data source object for the data source.
Declaration
public int DataSourceDefaultMaxConnections { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
This property is only supported when the compatibility level of the database is at 1510 or above.
DataSourceVariablesOverrideBehavior
Controls whether this model allows data source variables to be overriden.
Declaration
public DataSourceVariablesOverrideBehaviorType DataSourceVariablesOverrideBehavior { get; set; }
Property Value
Type | Description |
---|---|
DataSourceVariablesOverrideBehaviorType |
Remarks
This property is only supported when the compatibility level of the database is at 1475 or above.
DataSources
The collection of DataSource objects on this Model.
Declaration
[Browsable(false)]
public DataSourceCollection DataSources { get; }
Property Value
Type | Description |
---|---|
DataSourceCollection |
Database
The database object of the model.
Declaration
public Database Database { get; }
Property Value
Type | Description |
---|---|
Database |
DefaultDataView
Used by partitions in the model to determine the type of query that retrieves data. A Full dataview retrieves an unfiltered rowset, used for in-memory models and deployed DirectQuery models. A Sample data view is a subset of data used during DirectQuery model design.
Declaration
public DataViewType DefaultDataView { get; set; }
Property Value
Type | Description |
---|---|
DataViewType |
DefaultMeasure
A reference to a default measure.
Declaration
[TypeConverter(typeof(MeasureConverter))]
public Measure DefaultMeasure { get; set; }
Property Value
Type | Description |
---|---|
Measure |
Remarks
This property is only supported when the compatibility level of the database is at 1400 or above.
DefaultMode
The default method for making data available in the partition.
Declaration
public ModeType DefaultMode { get; set; }
Property Value
Type | Description |
---|---|
ModeType |
DefaultPowerBIDataSourceVersion
Used by PBIX data source format conversion.
Declaration
public PowerBIDataSourceVersion DefaultPowerBIDataSourceVersion { get; set; }
Property Value
Type | Description |
---|---|
PowerBIDataSourceVersion |
Remarks
This property is only supported when the compatibility level of the database is at 1450 or above.
DeploymentMetadata
Metadata related to the latest deployment performed on this model using Tabular Editor.
Declaration
[Browsable(false)]
public DeploymentMetadata DeploymentMetadata { get; set; }
Property Value
Type | Description |
---|---|
DeploymentMetadata |
Description
The description of the model, visible to developers at design time and to administrators in management tools, such as SQL Server Management Studio.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
string |
DirectLakeBehavior
Define the fallback behavior of Direct Lake tables.
Declaration
public DirectLakeBehavior DirectLakeBehavior { get; set; }
Property Value
Type | Description |
---|---|
DirectLakeBehavior |
Remarks
This property is only supported when the compatibility level of the database is at 1604 or above.
DisableSystemDefaultExpression
Disable system defined default expression behavior for calculation groups.
Declaration
public bool DisableSystemDefaultExpression { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This property is only supported when the compatibility level of the database is at Preview or above.
DiscourageCompositeModels
Determines whether to discourage composite models.
Declaration
public bool DiscourageCompositeModels { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This property is only supported when the compatibility level of the database is at 1560 or above.
DiscourageImplicitMeasures
Determines whether to discourage the implicit measures.
Declaration
public bool DiscourageImplicitMeasures { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This property is only supported when the compatibility level of the database is at 1470 or above.
DiscourageReportMeasures
Determines whether to discourage the report measures.
Declaration
public bool DiscourageReportMeasures { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This property is only supported when the compatibility level of the database is at Internal or above.
Expressions
The collection of NamedExpression objects on this Model.
Declaration
[TypeConverter(typeof(StringConverter))]
public NamedExpressionCollection Expressions { get; }
Property Value
Type | Description |
---|---|
NamedExpressionCollection |
ExtendedProperties
The collection of Extended Properties on the current Model.
Declaration
public ExtendedPropertyCollection ExtendedProperties { get; }
Property Value
Type | Description |
---|---|
ExtendedPropertyCollection |
FastCombine
Gets or sets whether privacy settings on individual data sources should be ignored.
Declaration
public bool FastCombine { get; set; }
Property Value
Type | Description |
---|---|
bool |
ForceUniqueNames
Determines whether measures can have the same names as any column in the model.
Declaration
public bool ForceUniqueNames { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This property is only supported when the compatibility level of the database is at 1465 or above.
HasLocalChanges
Gets an indication if the model has local changes that have not been saved to the engine yet.
Declaration
public bool HasLocalChanges { get; }
Property Value
Type | Description |
---|---|
bool | True, if the model has local changes; otherwise, false. |
Remarks
A disconnected model, will always return a value of false.
LegacyRedirects
Gets or sets whether unsafe legacy redirects from HTTPS to HTTP should be enabled
Declaration
public bool LegacyRedirects { get; set; }
Property Value
Type | Description |
---|---|
bool |
MAttributes
The string that has M attributes.
Declaration
public string MAttributes { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
This property is only supported when the compatibility level of the database is at 1535 or above.
MaxParallelismPerQuery
Maximum degree of parallelism for query in formula engine
Declaration
public int MaxParallelismPerQuery { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
This property is only supported when the compatibility level of the database is at 1569 or above.
MaxParallelismPerRefresh
Determines the max possible number of parallel tasks in data refresh, within the resource constraints of the hosting service.
Declaration
public int MaxParallelismPerRefresh { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
This property is only supported when the compatibility level of the database is at 1568 or above.
Perspectives
The collection of Perspective objects on this Model.
Declaration
[TypeConverter(typeof(StringConverter))]
public PerspectiveCollection Perspectives { get; }
Property Value
Type | Description |
---|---|
PerspectiveCollection |
QueryGroups
The collection of QueryGroup objects on this Model.
Declaration
public QueryGroupCollection QueryGroups { get; }
Property Value
Type | Description |
---|---|
QueryGroupCollection |
Relationships
The collection of Relationship objects on this Model.
Declaration
[Browsable(false)]
public RelationshipCollection Relationships { get; }
Property Value
Type | Description |
---|---|
RelationshipCollection |
ReturnErrorValuesAsNull
Gets or sets whether individual query errors should be returned as nulls in the query result instead of failing the query
Declaration
public bool ReturnErrorValuesAsNull { get; set; }
Property Value
Type | Description |
---|---|
bool |
Roles
The collection of ModelRole objects on this Model.
Declaration
[TypeConverter(typeof(StringConverter))]
public ModelRoleCollection Roles { get; }
Property Value
Type | Description |
---|---|
ModelRoleCollection |
SourceQueryCulture
The name of the Culture used for formatting during refresh through Mashup.
Declaration
public string SourceQueryCulture { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
This property is only supported when the compatibility level of the database is at 1520 or above.
StorageLocation
The location on disk to place the model.
Declaration
public string StorageLocation { get; set; }
Property Value
Type | Description |
---|---|
string |
Tables
The collection of Table objects on this Model.
Declaration
[Browsable(false)]
public TableCollection Tables { get; }
Property Value
Type | Description |
---|---|
TableCollection |
TranslatedDescriptions
Collection of localized descriptions for this Model.
Declaration
[Browsable(true)]
public TranslationIndexer TranslatedDescriptions { get; }
Property Value
Type | Description |
---|---|
TranslationIndexer |
TranslatedNames
Collection of localized names for this Model.
Declaration
[Browsable(true)]
public TranslationIndexer TranslatedNames { get; }
Property Value
Type | Description |
---|---|
TranslationIndexer |
ValueFilterBehavior
Determines value filter behavior for SummarizeColumns
Declaration
public ValueFilterBehaviorType ValueFilterBehavior { get; set; }
Property Value
Type | Description |
---|---|
ValueFilterBehaviorType |
Remarks
This property is only supported when the compatibility level of the database is at 1606 or above.
Methods
AddCalculatedTable(string, string)
Adds a new CalculatedTable to the Model.
Declaration
public CalculatedTable AddCalculatedTable(string name = null, string expression = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new table to add |
string | expression | The expression to assign to the calculated table |
Returns
Type | Description |
---|---|
CalculatedTable | A reference to the newly added calculated table |
Remarks
Tabular Editor 3 automatically populates the columns on the calculated table based on its DAX Expression.
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AddCalculationGroup(string)
Alias for AddCalculationGroupTable(string)
Declaration
public CalculationGroupTable AddCalculationGroup(string name = null)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
CalculationGroupTable |
AddCalculationGroupTable(string)
Adds a new CalculationGroupTable to the Model.
Declaration
public CalculationGroupTable AddCalculationGroupTable(string name = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new calculation group table to add. |
Returns
Type | Description |
---|---|
CalculationGroupTable | A reference to the newly added calculation group table |
Remarks
Use the AddCalculationItem(string, string) method to add calculation items to the calculation group.
AddDataSource(string)
Adds a new ProviderDataSource (aka. Legacy Data Source) to the Model.
Declaration
public ProviderDataSource AddDataSource(string name = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new data source to add |
Returns
Type | Description |
---|---|
ProviderDataSource | A reference to the newly created data source |
Remarks
Use the AddStructuredDataSource(string) method to add a structured aka. Power Query data source.
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AddExpression(string, string)
Alias for AddSharedExpression(string, string)
Declaration
public NamedExpression AddExpression(string name = null, string expression = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new shared expression |
string | expression | The M/Power Query string to add to the shared expression |
Returns
Type | Description |
---|---|
NamedExpression | The newly added shared expression |
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AddPerspective(string)
Adds a new Perspective to the Model.
Declaration
public Perspective AddPerspective(string name = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new perspective to add |
Returns
Type | Description |
---|---|
Perspective | The newly added perspective. |
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AddRelationship()
Adds a new relationship to the Model.
Declaration
public SingleColumnRelationship AddRelationship()
Returns
Type | Description |
---|---|
SingleColumnRelationship | A reference to the newly created relationship |
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AddRole(string)
Declaration
public ModelRole AddRole(string name = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new role to add |
Returns
Type | Description |
---|---|
ModelRole | A reference to the newly created role |
AddSharedExpression(string, string)
Adds a new NamedExpression (aka. Shared Expression) to the Model.
Declaration
public NamedExpression AddSharedExpression(string name = null, string expression = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new shared expression |
string | expression | The M/Power Query string to add to the shared expression |
Returns
Type | Description |
---|---|
NamedExpression | The newly added shared expression |
AddStructuredDataSource(string)
Adds a new StructuredDataSource to the Model.
Declaration
public StructuredDataSource AddStructuredDataSource(string name = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the new data source to add |
Returns
Type | Description |
---|---|
StructuredDataSource | A reference to the newly created data source |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception is thrown when attempting to add a structured data source to a model with a CompatibilityLevel less than 1400. |
PowerBIGovernanceException |
AddTable(string, bool)
Declaration
public Table AddTable(string name = null, bool createPartition = true)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the new table to create |
bool | createPartition | Set to false if the table should be created without partitions |
Returns
Type | Description |
---|---|
Table | A reference to the newly created table |
Remarks
This is a regular (Imported or DirectQuery) table. Use AddCalculatedTable(string, string) or AddCalculationGroupTable(string) to create other types of tables.
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AddTranslation(string)
Declaration
public Culture AddTranslation(string cultureId)
Parameters
Type | Name | Description |
---|---|---|
string | cultureId | The culture ID, for example "en-US" |
Returns
Type | Description |
---|---|
Culture | A reference to the newly created culture |
Exceptions
Type | Condition |
---|---|
PowerBIGovernanceException |
AllowDelete(out string)
Derived classes should override this method to prevent an object from being deleted. If left un-overridden, always returns TRUE and sets message to null.
Declaration
protected override bool AllowDelete(out string message)
Parameters
Type | Name | Description |
---|---|---|
string | message | If an object CANNOT be deleted, this string should provide a reason why. If an object CAN be deleted, this string may optionally provide a suitable warning message that applies if the object is deleted immediately after the call to CanDelete. |
Returns
Type | Description |
---|---|
bool | True if an object can be deleted. False otherwise. |
Overrides
ApplyRefreshPolicy()
Applies refresh policy on all tables in the model, where Incremental Refresh Policy has been configured.
Declaration
public void ApplyRefreshPolicy()
ApplyRefreshPolicy(IEnumerable<Table>)
Applies refresh policy on the specified tables.
Declaration
public void ApplyRefreshPolicy(IEnumerable<Table> tables)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Table> | tables | The tables on which to apply refresh policy |
ClearAnnotations()
Removes all annotations from this object.
Declaration
public void ClearAnnotations()
ClearExtendedProperties()
Removes all Extended Properties from this object.
Declaration
public void ClearExtendedProperties()
GetAnnotation(int)
Gets the value of the annotation with the given index, assuming it exists.
Declaration
public string GetAnnotation(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
string |
GetAnnotation(string)
Gets the value of the annotation with the given name. Returns null if no such annotation exists.
Declaration
public string GetAnnotation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
string |
GetAnnotations()
Gets a collection of all annotation names on the current Model.
Declaration
public IEnumerable<string> GetAnnotations()
Returns
Type | Description |
---|---|
IEnumerable<string> |
GetAnnotationsCount()
Gets the number of annotations on the current Model.
Declaration
public int GetAnnotationsCount()
Returns
Type | Description |
---|---|
int |
GetExtendedProperties()
Gets a collection of all ExtendedProperty names on the current object.
Declaration
public IEnumerable<string> GetExtendedProperties()
Returns
Type | Description |
---|---|
IEnumerable<string> |
GetExtendedProperty(int)
Gets the value of the ExtendedProperty with the given index, assuming it exists.
Declaration
public string GetExtendedProperty(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
string |
GetExtendedProperty(string)
Gets the value of the ExtendedProperty with the given name. Returns null if no such ExtendedProperty exists.
Declaration
public string GetExtendedProperty(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
string |
GetExtendedPropertyCount()
Gets the number of ExtendedProperties on the current object.
Declaration
public int GetExtendedPropertyCount()
Returns
Type | Description |
---|---|
int |
GetExtendedPropertyType(int)
Gets the type of the ExtendedProperty with the given index, assuming it exists.
Declaration
public ExtendedPropertyType GetExtendedPropertyType(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
ExtendedPropertyType |
GetExtendedPropertyType(string)
Gets the type of the ExtendedProperty with the given name, assuming it exists.
Declaration
public ExtendedPropertyType GetExtendedPropertyType(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
ExtendedPropertyType |
GetNewAnnotationName()
Returns a unique name for a new annotation.
Declaration
public string GetNewAnnotationName()
Returns
Type | Description |
---|---|
string |
GetNewExtendedPropertyName()
Returns a unique name for a new ExtendedProperty.
Declaration
public string GetNewExtendedPropertyName()
Returns
Type | Description |
---|---|
string |
GetNewTableGroupName()
Declaration
public string GetNewTableGroupName()
Returns
Type | Description |
---|---|
string |
GetTableGroups()
Declaration
public IEnumerable<string> GetTableGroups()
Returns
Type | Description |
---|---|
IEnumerable<string> |
HasAnnotation(string)
Returns true if an annotation with the given name exists. Otherwise false.
Declaration
public bool HasAnnotation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
bool |
HasExtendedProperty(string)
Returns true if an ExtendedProperty with the given name exists. Otherwise false.
Declaration
public bool HasExtendedProperty(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
bool |
Init()
Derived members should override this method to instantiate child objects
Declaration
protected override void Init()
Overrides
OnPropertyChanging(string, object, ref bool, ref bool)
Called before a property is changed on an object. Derived classes can control how the change is handled. Throw ArgumentException within this method, to display an error message in the UI.
Declaration
protected override void OnPropertyChanging(string propertyName, object newValue, ref bool undoable, ref bool cancel)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | Name of the changed property. |
object | newValue | New value assigned to the property. |
bool | undoable | Return false if automatic undo of the property change is not needed. |
bool | cancel | Return true if the property change should not apply. |
Overrides
RemoveAnnotation(string)
Remove an annotation by the given name.
Declaration
public void RemoveAnnotation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
RemoveDeploymentMetadata()
Removes deployment metadata.
Declaration
public void RemoveDeploymentMetadata()
RemoveExtendedProperty(string)
Remove an ExtendedProperty by the given name.
Declaration
public void RemoveExtendedProperty(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
SetAnnotation(int, string)
Sets the value of the annotation with the given index, assuming it exists.
Declaration
public void SetAnnotation(int index, string value)
Parameters
Type | Name | Description |
---|---|---|
int | index | |
string | value |
SetAnnotation(string, string)
Sets the value of the annotation having the given name. If no such annotation exists, it will be created. If value is set to null, the annotation will be removed.
Declaration
public void SetAnnotation(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
string | value |
SetExtendedProperty(int, string, ExtendedPropertyType)
Sets the value of the ExtendedProperty with the given index, optionally specifiying the type (string or JSON) of the ExtendedProperty.
Declaration
public void SetExtendedProperty(int index, string value, ExtendedPropertyType type)
Parameters
Type | Name | Description |
---|---|---|
int | index | |
string | value | |
ExtendedPropertyType | type |
SetExtendedProperty(string, string, ExtendedPropertyType)
Sets the value of the ExtendedProperty having the given name. If no such ExtendedProperty exists, it will be created. If value is set to null, the ExtendedProperty will be removed.
Declaration
public void SetExtendedProperty(string name, string value, ExtendedPropertyType type)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
string | value | |
ExtendedPropertyType | type |
UpdateDeploymentMetadata()
Update deployment metadata.
Declaration
public void UpdateDeploymentMetadata()