Class Partition
Represents a partition in a table. Partitions define the query against external data sources that return the rowsets of a Table.
Assembly: TOMWrapper.dll
Syntax
public class Partition : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, ITomErrorMessageObject, ITabularTableObject, IDescriptionObject, IAnnotationObject, IExtendedPropertyObject, IClonableObject, IDaxDependantObject, IExpressionObject, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, INamedObject
Properties
Annotations
The collection of Annotations on the current Partition.
Declaration
[Browsable(true)]
public AnnotationCollection Annotations { get; }
Property Value
DataCoverageDefinition
A reference to an optional DataCoverageDefinition that provides the hint regarding the data that is covered by the partition.
Declaration
[TypeConverter(typeof(DataCoverageDefinitionConverter))]
public DataCoverageDefinition DataCoverageDefinition { get; set; }
Property Value
DataCoverageDefinitionExpression
Declaration
[Browsable(false)]
public string DataCoverageDefinitionExpression { get; set; }
Property Value
DataSource
The Data Source used by this partition.
Declaration
[TypeConverter(typeof(DataSourceConverter))]
public DataSource DataSource { get; set; }
Property Value
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.
Declaration
public DataViewType DataView { get; set; }
Property Value
DefaultExpressionProperty
Gets the default expression property on the current object.
Declaration
[Browsable(false)]
public virtual ExpressionProperty? DefaultExpressionProperty { get; }
Property Value
DependsOn
Gets the list of objects that this measure depends on.
Declaration
[Browsable(false)]
public DependsOnList DependsOn { get; }
Property Value
Description
The description of the partition, 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
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.
Declaration
public string ErrorMessage { get; }
Property Value
Expression
The expression which is used to populate this partition with data.
Declaration
public string Expression { get; set; }
Property Value
ExtendedProperties
The collection of Extended Properties on the current Partition.
Declaration
public ExtendedPropertyCollection ExtendedProperties { get; }
Property Value
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
Declaration
public ModeType Mode { get; set; }
Property Value
Name
The name of this object. Warning: Changing the name can break formula logic, if Automatic Formula Fix-up is disabled.
Declaration
public override string Name { get; set; }
Property Value
Overrides
Parent
The parent Table of the current Partition.
Declaration
public Table Parent { get; }
Property Value
ProviderDataSource
Declaration
[Browsable(false)]
public ProviderDataSource ProviderDataSource { get; }
Property Value
Query
The query which is executed on the Data Source to populate this partition with data. This is an alias for Expression
Declaration
public string Query { get; set; }
Property Value
QueryGroup
QueryGroup associated with the partition.
Declaration
[TypeConverter(typeof(QueryGroupConverter))]
public QueryGroup QueryGroup { get; set; }
Property Value
RefreshedTime
Declaration
public DateTime RefreshedTime { get; }
Property Value
SourceType
The type of source used by the Partition. This is either a query against a DataSource, or for calculated tables, an expression.
Declaration
public PartitionSourceType SourceType { get; }
Property Value
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.
Declaration
public ObjectState State { get; }
Property Value
StructuredDataSource
Declaration
[Browsable(false)]
public StructuredDataSource StructuredDataSource { get; }
Property Value
Table
The parent table of the current Partition.
Declaration
[Browsable(false)]
public Table Table { get; }
Property Value
Methods
AddDataCoverageDefinition()
Declaration
public DataCoverageDefinition AddDataCoverageDefinition()
Returns
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
ClearAnnotations()
Removes all annotations from this object.
Declaration
public void ClearAnnotations()
ClearExtendedProperties()
Removes all Extended Properties from this object.
Declaration
public void ClearExtendedProperties()
Clone(string, Table)
Creates an exact copy of this Partition object.
Declaration
public virtual Partition Clone(string newName = null, Table newParent = null)
Parameters
Returns
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.
Declaration
public static Partition CreateNew(Table parent, string name = null)
Parameters
Returns
CustomReinit()
Declaration
protected override void CustomReinit()
Overrides
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
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
GetAnnotations()
Gets a collection of all annotation names on the current Partition.
Declaration
public IEnumerable<string> GetAnnotations()
Returns
GetAnnotationsCount()
Gets the number of annotations on the current Partition.
Declaration
public int GetAnnotationsCount()
Returns
GetExpression(ExpressionProperty)
Gets the specified expression from the current object.
Declaration
public virtual string GetExpression(ExpressionProperty expressionProperty)
Parameters
Returns
Exceptions
GetExpressionProperties()
Gets all supported expression properties on the current object.
Declaration
public virtual IEnumerable<ExpressionProperty> GetExpressionProperties()
Returns
GetExtendedProperties()
Gets a collection of all ExtendedProperty names on the current object.
Declaration
public IEnumerable<string> GetExtendedProperties()
Returns
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
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
GetExtendedPropertyCount()
Gets the number of ExtendedProperties on the current object.
Declaration
public int GetExtendedPropertyCount()
Returns
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
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
GetNewAnnotationName()
Returns a unique name for a new annotation.
Declaration
public string GetNewAnnotationName()
Returns
GetNewExtendedPropertyName()
Returns a unique name for a new ExtendedProperty.
Declaration
public string GetNewExtendedPropertyName()
Returns
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
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
Init()
Derived members should override this method to instantiate child objects
Declaration
protected override void Init()
Overrides
OnPropertyChanged(string, object, object)
Fired after a property is changed
Declaration
protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
Parameters
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 |
|
RemoveDataCoverageDefinition()
Declaration
public void RemoveDataCoverageDefinition()
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
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
SetExpression(ExpressionProperty, string)
Sets the specified expression on the current object.
Declaration
public virtual void SetExpression(ExpressionProperty expressionProperty, string expression)
Parameters
Exceptions
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
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
Implements
Extension Methods