Class Model
- Inheritance
-
Model
- Implements
- Inherited Members
- Namespace
- TabularEditor.TOMWrapper
- Assembly
- TOMWrapper.dll
A Tabular model created at compatibility level 1200 or above.
public sealed class Model : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, IDescriptionObject, IExtendedPropertyObject, ITranslatableObject, IAnnotationObject, ITabularObjectContainer, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, INamedObject
- Extension Methods
Properties
AllCalculationItems
Iterates all calculation items on all calculation groups of the model.
[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.
[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.
[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.
[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.
[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.
[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.
[Browsable(false)]
public IEnumerable<Partition> AllPartitions { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Partition> |
Annotations
The collection of Annotations on the current Model.
[Browsable(true)]
public AnnotationCollection Annotations { get; }
Property Value
Type | Description |
---|---|
AnnotationCollection |
AutomaticAggregationOptions
Protocol-specific options used to connect the data source
[Browsable(false)]
public Model.AutomaticAggregationOptionsImpl AutomaticAggregationOptions { get; }
Property Value
Type | Description |
---|---|
Model.AutomaticAggregationOptionsImpl |
CalculationGroups
Enumerate all calculation group tables on this model.
[Browsable(false)]
public IEnumerable<CalculationGroupTable> CalculationGroups { get; }
Property Value
Type | Description |
---|---|
IEnumerable<CalculationGroupTable> |
Collation
The collation sequence. Analysis Services uses Windows collations.
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.
[TypeConverter(typeof(CultureConverter))]
public string Culture { get; set; }
Property Value
Type | Description |
---|---|
string |
Cultures
The collection of Culture objects on this Model.
[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.
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.
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.
[Browsable(false)]
public DataSourceCollection DataSources { get; }
Property Value
Type | Description |
---|---|
DataSourceCollection |
Database
The database object of the model.
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.
public DataViewType DefaultDataView { get; set; }
Property Value
Type | Description |
---|---|
DataViewType |
DefaultMeasure
A reference to a default measure.
[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.
public ModeType DefaultMode { get; set; }
Property Value
Type | Description |
---|---|
ModeType |
DefaultPowerBIDataSourceVersion
Used by PBIX data source format conversion.
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.
[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.
public string Description { get; set; }
Property Value
Type | Description |
---|---|
string |
DirectLakeBehavior
Define the fallback behavior of Direct Lake tables.
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.
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.
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.
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.
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.
[TypeConverter(typeof(StringConverter))]
public NamedExpressionCollection Expressions { get; }
Property Value
Type | Description |
---|---|
NamedExpressionCollection |
ExtendedProperties
The collection of Extended Properties on the current Model.
public ExtendedPropertyCollection ExtendedProperties { get; }
Property Value
Type | Description |
---|---|
ExtendedPropertyCollection |
FastCombine
Gets or sets whether privacy settings on individual data sources should be ignored.
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.
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.
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
public bool LegacyRedirects { get; set; }
Property Value
Type | Description |
---|---|
bool |
MAttributes
The string that has M attributes.
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
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.
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.
[TypeConverter(typeof(StringConverter))]
public PerspectiveCollection Perspectives { get; }
Property Value
Type | Description |
---|---|
PerspectiveCollection |
QueryGroups
The collection of QueryGroup objects on this Model.
public QueryGroupCollection QueryGroups { get; }
Property Value
Type | Description |
---|---|
QueryGroupCollection |
Relationships
The collection of Relationship objects on this Model.
[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
public bool ReturnErrorValuesAsNull { get; set; }
Property Value
Type | Description |
---|---|
bool |
Roles
The collection of ModelRole objects on this Model.
[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.
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.
public string StorageLocation { get; set; }
Property Value
Type | Description |
---|---|
string |
Tables
The collection of Table objects on this Model.
[Browsable(false)]
public TableCollection Tables { get; }
Property Value
Type | Description |
---|---|
TableCollection |
TranslatedDescriptions
Collection of localized descriptions for this Model.
[Browsable(true)]
public TranslationIndexer TranslatedDescriptions { get; }
Property Value
Type | Description |
---|---|
TranslationIndexer |
TranslatedNames
Collection of localized names for this Model.
[Browsable(true)]
public TranslationIndexer TranslatedNames { get; }
Property Value
Type | Description |
---|---|
TranslationIndexer |
ValueFilterBehavior
Determines value filter behavior for SummarizeColumns
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.
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
AddCalculationGroup(string)
Alias for AddCalculationGroupTable(string)
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.
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.
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
AddExpression(string, string)
Alias for AddSharedExpression(string, string)
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
AddPerspective(string)
Adds a new Perspective to the Model.
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
AddRelationship()
Adds a new relationship to the Model.
public SingleColumnRelationship AddRelationship()
Returns
Type | Description |
---|---|
SingleColumnRelationship | A reference to the newly created relationship |
Exceptions
AddRole(string)
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.
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.
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
- 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)
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
AddTranslation(string)
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
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.
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. |
ApplyRefreshPolicy()
Applies refresh policy on all tables in the model, where Incremental Refresh Policy has been configured.
public void ApplyRefreshPolicy()
ApplyRefreshPolicy(IEnumerable<Table>)
Applies refresh policy on the specified tables.
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.
public void ClearAnnotations()
ClearExtendedProperties()
Removes all Extended Properties from this object.
public void ClearExtendedProperties()
GetAnnotation(int)
Gets the value of the annotation with the given index, assuming it exists.
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.
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.
public IEnumerable<string> GetAnnotations()
Returns
Type | Description |
---|---|
IEnumerable<string> |
GetAnnotationsCount()
Gets the number of annotations on the current Model.
public int GetAnnotationsCount()
Returns
Type | Description |
---|---|
int |
GetExtendedProperties()
Gets a collection of all ExtendedProperty names on the current object.
public IEnumerable<string> GetExtendedProperties()
Returns
Type | Description |
---|---|
IEnumerable<string> |
GetExtendedProperty(int)
Gets the value of the ExtendedProperty with the given index, assuming it exists.
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.
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.
public int GetExtendedPropertyCount()
Returns
Type | Description |
---|---|
int |
GetExtendedPropertyType(int)
Gets the type of the ExtendedProperty with the given index, assuming it exists.
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.
public ExtendedPropertyType GetExtendedPropertyType(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
ExtendedPropertyType |
GetNewAnnotationName()
Returns a unique name for a new annotation.
public string GetNewAnnotationName()
Returns
Type | Description |
---|---|
string |
GetNewExtendedPropertyName()
Returns a unique name for a new ExtendedProperty.
public string GetNewExtendedPropertyName()
Returns
Type | Description |
---|---|
string |
GetNewTableGroupName()
public string GetNewTableGroupName()
Returns
Type | Description |
---|---|
string |
GetTableGroups()
public IEnumerable<string> GetTableGroups()
Returns
Type | Description |
---|---|
IEnumerable<string> |
HasAnnotation(string)
Returns true if an annotation with the given name exists. Otherwise false.
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.
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
protected override void Init()
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.
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. |
RemoveAnnotation(string)
Remove an annotation by the given name.
public void RemoveAnnotation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
RemoveDeploymentMetadata()
Removes deployment metadata.
public void RemoveDeploymentMetadata()
RemoveExtendedProperty(string)
Remove an ExtendedProperty by the given name.
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.
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.
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.
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.
public void SetExtendedProperty(string name, string value, ExtendedPropertyType type)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
string | value | |
ExtendedPropertyType | type |
UpdateDeploymentMetadata()
Update deployment metadata.
public void UpdateDeploymentMetadata()