Table of Contents

Class NamedObjectEditableCollection<T>

Inheritance
NamedObjectEditableCollection<T>
Implements
Derived
Inherited Members
Namespace
TabularEditor.Shared.Interaction
Assembly
TabularEditor3.Shared.dll

Provides a set of methods for changing multiple object properties at once, as well as accessing specific items by name.

public class NamedObjectEditableCollection<T> : IEnumerable<T>, IEnumerable where T : ITabularNamedObject

Type Parameters

Name Description
T
Extension Methods

Properties

Count

Gets the number of objects in this collection

public int Count { get; }

Property Value

Type Description
int

Description

Sets the Description property of all objects in the collection at once.

public string Description { get; set; }

Property Value

Type Description
string

DisplayFolder

Sets the DisplayFolder property of all objects in the collection at once.

public virtual string DisplayFolder { get; set; }

Property Value

Type Description
string

Expression

Sets the Expression property of all objects in the collection at once.

public string Expression { get; set; }

Property Value

Type Description
string

FormatString

Sets the FormatString property of all objects in the collection at once.

public string FormatString { set; }

Property Value

Type Description
string

IsActive

Sets the IsActive property of all relationships in the collection at once.

public bool IsActive { set; }

Property Value

Type Description
bool

IsHidden

Sets the IsHidden property of all objects in the collection at once.

public bool IsHidden { set; }

Property Value

Type Description
bool

this[string]

Finds an object in the collection by name, using DAX syntax: [Measure Name] 'Table Name'[Column Name]

public T this[string search] { get; }

Parameters

Type Name Description
string search

Property Value

Type Description
T

Name

Sets the name of the object (provided the collection only contains a single object).

public string Name { get; set; }

Property Value

Type Description
string

Methods

Delete()

Deletes all objects in the collection.

public void Delete()

ForEach(Action<T>)

Provide a lambda statement that is executed once for each object in the collection.

public void ForEach(Action<T> action)

Parameters

Type Name Description
Action<T> action

The action to perform on each object in the collection

Examples

.ForEach(obj => obj.Name += " OLD");

GetEnumerator()

Returns an enumerator that iterates through the collection

public IEnumerator<T> GetEnumerator()

Returns

Type Description
IEnumerator<T>

HideInAllPerspectives()

Removes all objects in the collection from all perspectives of the model.

public void HideInAllPerspectives()

HideInPerspective(string)

Removes all objects in the collection from the given perspective.

public void HideInPerspective(string perspectiveName)

Parameters

Type Name Description
string perspectiveName

HideInPerspective(Perspective)

Removes all objects in the collection from the given perspective.

public void HideInPerspective(Perspective perspective)

Parameters

Type Name Description
Perspective perspective

Rename(string, string, bool, bool, bool, bool)

Specify a search pattern and a replacement value, that will be applied to the Names of the objects in the collection.

public void Rename(string pattern, string replacement, bool regex = false, bool includeNameTranslations = false, bool matchCase = false, bool wholeWordsOnly = false)

Parameters

Type Name Description
string pattern

Search pattern (i.e. what to find)

string replacement

Replacement (the text to replace)

bool regex

Set to true if the search pattern and replacement strings use regular expressions

bool includeNameTranslations

Set to true if the replacement should be performed in the metadata name translations as well

bool matchCase

Set to true to perform a case-sensitive search

bool wholeWordsOnly

Set to true to search for whole words only

Rename(string, string, List<T>, bool, bool, bool, bool)

Specify a search pattern and a replacement value, that will be applied to the Names of the objects in the collection.

protected void Rename(string pattern, string replacement, List<T> objects, bool regex = false, bool includeNameTranslations = false, bool matchCase = false, bool wholeWordsOnly = false)

Parameters

Type Name Description
string pattern

Search pattern (i.e. what to find)

string replacement

Replacement (the text to replace)

List<T> objects
bool regex

Set to true if the search pattern and replacement strings use regular expressions

bool includeNameTranslations

Set to true if the replacement should be performed in the metadata name translations as well

bool matchCase

Set to true to perform a case-sensitive search

bool wholeWordsOnly

Set to true to search for whole words only

ReplaceExpression(string, string, bool)

Specify a search pattern and a replacement value, that will be applied to the Expression of the objects in the collection.

public void ReplaceExpression(string pattern, string replacement, bool regex = false)

Parameters

Type Name Description
string pattern

The search pattern

string replacement

The replacement value

bool regex

Set to true to perform search and replace using regular expressions

ReplaceExpression(ExpressionProperty, string, string, bool)

Specify a search pattern and a replacement value, that will be applied to the Expression of the objects in the collection.

public void ReplaceExpression(ExpressionProperty property, string pattern, string replacement, bool regex = false)

Parameters

Type Name Description
ExpressionProperty property

The Expression property to replace

string pattern

The search pattern

string replacement

The replacement value

bool regex

Set to true to perform search and replace using regular expressions

ReplaceFolder(string, string)

Move objects in this collection from one root display folder to another

public virtual void ReplaceFolder(string before, string after)

Parameters

Type Name Description
string before
string after

ReplaceFolder(string, string, Culture)

Move objects in this collection from one root display folder to another, for a specific translation

public virtual void ReplaceFolder(string before, string after, Culture culture)

Parameters

Type Name Description
string before
string after
Culture culture

ShowInAllPerspectives()

Adds all objects in the collection to all perspectives of the model.

public void ShowInAllPerspectives()

ShowInPerspective(string)

Adds all objects in the collection to the given perspective.

public void ShowInPerspective(string perspectiveName)

Parameters

Type Name Description
string perspectiveName

ShowInPerspective(Perspective)

Adds all objects in the collection to the given perspective.

public void ShowInPerspective(Perspective perspective)

Parameters

Type Name Description
Perspective perspective

Where(Func<T, bool>)

Filters the collection using a lambda expression which should return true.

public NamedObjectEditableCollection<T> Where(Func<T, bool> predicate)

Parameters

Type Name Description
Func<T, bool> predicate

The filter predicate.

Returns

Type Description
NamedObjectEditableCollection<T>

The filtered list of objects that satisfy the predicate.

Examples

.Where(Measure => Measure.Description == "")