Class NamedObjectEditableCollection<T>
Provides a set of methods for changing multiple object properties at once, as well as accessing specific items by name.
Inherited Members
Namespace: TabularEditor.Shared.Interaction
Assembly: TabularEditor3.Shared.dll
Syntax
public class NamedObjectEditableCollection<T> : IEnumerable<T>, IEnumerable where T : ITabularNamedObject
Type Parameters
Name | Description |
---|---|
T |
Properties
Count
Gets the number of objects in this collection
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Description
Sets the Description property of all objects in the collection at once.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
string |
DisplayFolder
Sets the DisplayFolder property of all objects in the collection at once.
Declaration
public virtual string DisplayFolder { get; set; }
Property Value
Type | Description |
---|---|
string |
Expression
Sets the Expression property of all objects in the collection at once.
Declaration
public string Expression { get; set; }
Property Value
Type | Description |
---|---|
string |
FormatString
Sets the FormatString property of all objects in the collection at once.
Declaration
public string FormatString { set; }
Property Value
Type | Description |
---|---|
string |
IsActive
Sets the IsActive property of all relationships in the collection at once.
Declaration
public bool IsActive { set; }
Property Value
Type | Description |
---|---|
bool |
IsHidden
Sets the IsHidden property of all objects in the collection at once.
Declaration
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]
Declaration
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).
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
Delete()
Deletes all objects in the collection.
Declaration
public void Delete()
ForEach(Action<T>)
Provide a lambda statement that is executed once for each object in the collection.
Declaration
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
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> |
HideInAllPerspectives()
Removes all objects in the collection from all perspectives of the model.
Declaration
public void HideInAllPerspectives()
HideInPerspective(string)
Removes all objects in the collection from the given perspective.
Declaration
public void HideInPerspective(string perspectiveName)
Parameters
Type | Name | Description |
---|---|---|
string | perspectiveName |
HideInPerspective(Perspective)
Removes all objects in the collection from the given perspective.
Declaration
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.
Declaration
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.
Declaration
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.
Declaration
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.
Declaration
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
Declaration
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
Declaration
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.
Declaration
public void ShowInAllPerspectives()
ShowInPerspective(string)
Adds all objects in the collection to the given perspective.
Declaration
public void ShowInPerspective(string perspectiveName)
Parameters
Type | Name | Description |
---|---|---|
string | perspectiveName |
ShowInPerspective(Perspective)
Adds all objects in the collection to the given perspective.
Declaration
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.
Declaration
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 == "")