Table of Contents

Class Partition

Inheritance
Partition
Implements
Derived
Inherited Members
Namespace
TabularEditor.TOMWrapper
Assembly
TOMWrapper.dll

Represents a partition in a table. Partitions define the query against external data sources that return the rowsets of a Table.

public class Partition : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, ITomErrorMessageObject, ITabularTableObject, IDescriptionObject, IAnnotationObject, IExtendedPropertyObject, IClonableObject, IDaxDependantObject, IExpressionObject, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, INamedObject
Extension Methods

Properties

Annotations

The collection of Annotations on the current Partition.

[Browsable(true)]
public AnnotationCollection Annotations { get; }

Property Value

Type Description
AnnotationCollection

DataCoverageDefinition

A reference to an optional DataCoverageDefinition that provides the hint regarding the data that is covered by the partition.

[TypeConverter(typeof(DataCoverageDefinitionConverter))]
public DataCoverageDefinition DataCoverageDefinition { get; set; }

Property Value

Type Description
DataCoverageDefinition

DataCoverageDefinitionExpression

[Browsable(false)]
public string DataCoverageDefinitionExpression { get; set; }

Property Value

Type Description
string

DataSource

The Data Source used by this partition.

[TypeConverter(typeof(DataSourceConverter))]
public DataSource DataSource { get; set; }

Property Value

Type Description
DataSource

DataView

Determines which partitions should be selected to run queries against the model. The possible values are as follows. Full (0) - Partitions with DataView set to Default or Full are selected. Sample (1): Partitions with DataView set to Default or Sample are selected. SampleAndFull (2): All partitions are selected. Default (3) - Inherits from the default DataView of the Model object.

public DataViewType DataView { get; set; }

Property Value

Type Description
DataViewType

DefaultExpressionProperty

Gets the default expression property on the current object.

[Browsable(false)]
public virtual ExpressionProperty? DefaultExpressionProperty { get; }

Property Value

Type Description
ExpressionProperty?

DependsOn

Gets the list of objects that this measure depends on.

[Browsable(false)]
public DependsOnList DependsOn { get; }

Property Value

Type Description
DependsOnList

Description

The description of the partition, 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

ErrorMessage

The string that explains the error state associated with the current object. It is set by the engine only when the state of the object is one of these three values: SemanticError, DependencyError, or EvaluationError.This element applies only to partitions of the type Calculated.

public string ErrorMessage { get; }

Property Value

Type Description
string

Expression

The expression which is used to populate this partition with data.

public string Expression { get; set; }

Property Value

Type Description
string

ExtendedProperties

The collection of Extended Properties on the current Partition.

public ExtendedPropertyCollection ExtendedProperties { get; }

Property Value

Type Description
ExtendedPropertyCollection

Mode

Defines the method for making data available in the partition. Possible values are as follows. Import (0) Data will be imported from a data source. DirectQuery (1) Data will be queried dynamically from a data source. Default (2): Only partitions can use this value. When set, the partition will inherit the DefaultMode of the Model. Push (3): Data will be pushed into the partition. The Mode of a Partition can be set to Default (2), in which case it will inherit its Mode from the DefaultMode of the Model

public ModeType Mode { get; set; }

Property Value

Type Description
ModeType

Name

The name of this object. Warning: Changing the name can break formula logic, if Automatic Formula Fix-up is disabled.

public override string Name { get; set; }

Property Value

Type Description
string

Parent

The parent Table of the current Partition.

public Table Parent { get; }

Property Value

Type Description
Table

ProviderDataSource

[Browsable(false)]
public ProviderDataSource ProviderDataSource { get; }

Property Value

Type Description
ProviderDataSource

Query

The query which is executed on the Data Source to populate this partition with data. This is an alias for Expression

public string Query { get; set; }

Property Value

Type Description
string

QueryGroup

QueryGroup associated with the partition.

[TypeConverter(typeof(QueryGroupConverter))]
public QueryGroup QueryGroup { get; set; }

Property Value

Type Description
QueryGroup

Remarks

This property is only supported when the compatibility level of the database is at 1480 or above.

RefreshedTime

public DateTime RefreshedTime { get; }

Property Value

Type Description
DateTime

SourceType

The type of source used by the Partition. This is either a query against a DataSource, or for calculated tables, an expression.

public PartitionSourceType SourceType { get; }

Property Value

Type Description
PartitionSourceType

State

Provides information on the state of the partition. Possible values are as follows. Ready (1): The partition is queryable and has up-to-date data. NoData (3): The partition is queryable but has no data. This state applies only to partitions with a type other than Calculated. CalculationNeeded (4): The partition is not queryable and needs to be refreshed (that is, recalculated) to become functional. This state applies only to partitions of the type Calculated. SemanticError (5): The partition is in an error state because of an invalid expression and is not queryable. This state applies only to partitions of the type Calculated. EvaluationError (6): The partition is in an error state because of an error during expression evaluation. The partition is not queryable. This state applies only to partitions of the type Calculated. DependencyError (7): The partition is in an error state because some of its calculation dependencies are in an error state. The partition is not queryable. This state applies only to partitions of the type Calculated. Incomplete (8): Some parts of the partition have no data, and the partition needs to be refreshed to bring the data in. The partition is queryable. This state applies only to partitions of a type other than Calculated. SyntaxError (9): The partition is in an error state because of a syntax error in its expression. The partition is not queryable. This state applies only to partitions of the type Calculated.

public ObjectState State { get; }

Property Value

Type Description
ObjectState

StructuredDataSource

[Browsable(false)]
public StructuredDataSource StructuredDataSource { get; }

Property Value

Type Description
StructuredDataSource

Table

The parent table of the current Partition.

[Browsable(false)]
public Table Table { get; }

Property Value

Type Description
Table

Methods

AddDataCoverageDefinition()

public DataCoverageDefinition AddDataCoverageDefinition()

Returns

Type Description
DataCoverageDefinition

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.

ClearAnnotations()

Removes all annotations from this object.

public void ClearAnnotations()

ClearExtendedProperties()

Removes all Extended Properties from this object.

public void ClearExtendedProperties()

Clone(string, Table)

Creates an exact copy of this Partition object.

public virtual Partition Clone(string newName = null, Table newParent = null)

Parameters

Type Name Description
string newName
Table newParent

Returns

Type Description
Partition

CreateNew(Table, string)

Creates a new Partition and adds it to the parent Table. Also creates the underlying metadataobject and adds it to the TOM tree.

public static Partition CreateNew(Table parent, string name = null)

Parameters

Type Name Description
Table parent
string name

Returns

Type Description
Partition

CustomReinit()

protected override void CustomReinit()

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 Partition.

public IEnumerable<string> GetAnnotations()

Returns

Type Description
IEnumerable<string>

GetAnnotationsCount()

Gets the number of annotations on the current Partition.

public int GetAnnotationsCount()

Returns

Type Description
int

GetExpression(ExpressionProperty)

Gets the specified expression from the current object.

public virtual string GetExpression(ExpressionProperty expressionProperty)

Parameters

Type Name Description
ExpressionProperty expressionProperty

Returns

Type Description
string

Exceptions

InvalidEnumArgumentException

Thrown when the current object does not support the specified ExpressionProperty

GetExpressionProperties()

Gets all supported expression properties on the current object.

public virtual IEnumerable<ExpressionProperty> GetExpressionProperties()

Returns

Type Description
IEnumerable<ExpressionProperty>

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

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

OnPropertyChanged(string, object, object)

Fired after a property is changed

protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)

Parameters

Type Name Description
string propertyName
object oldValue
object newValue

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

RemoveDataCoverageDefinition()

public void RemoveDataCoverageDefinition()

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

SetExpression(ExpressionProperty, string)

Sets the specified expression on the current object.

public virtual void SetExpression(ExpressionProperty expressionProperty, string expression)

Parameters

Type Name Description
ExpressionProperty expressionProperty
string expression

Exceptions

InvalidEnumArgumentException

Thrown when the current object does not support the specified ExpressionProperty

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