Class RelationTargetRows
Definition of targets for a relation. Links a relation definition (RelDef) to source and target tables. In general, a relation can be created between any pair of tables. This table is used for specifying which table pairs a particular relation can be used for. A relation definition should have at least one row in this table, and can have more. Note: The 5.0 Maintenance and GUI only support contact and person as valid values for the source_table and destination_table fields, in any combination. Other relations will not be shown, and relation definitions pointing to other tables will not be editable from the Maintenance GUI; however, nothing will crash. Collection of RelationTargetRow. Each element of the collection represents one row in the RelationTarget table.
Inheritance
Implements
Inherited Members
Namespace: SuperOffice.CRM.Rows
Assembly: SoDataBase.dll
Syntax
public class RelationTargetRows : TableRowsBase, INestedPersist, IEnumerable<INestedPersist>, INotifyCollectionChanged, IBindingList, IList, ICollection, IEnumerable
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
Properties
this[int]
Get a RelationTargetRow given its index in the collection.
Declaration
public RelationTargetRow this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Index of the RelationTargetRow in the collection |
Property Value
| Type | Description |
|---|---|
| RelationTargetRow |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
Methods
Add(RelationTargetRow)
Add one RelationTargetRow to the collection.
Declaration
public int Add(RelationTargetRow row)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationTargetRow | row | An instance of RelationTargetRow to be added to the collection. |
Returns
| Type | Description |
|---|---|
| int | The index of the added RelationTargetRow. |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
AddNew()
Add a new instance of RelationTargetRow added to the collection.
Declaration
public RelationTargetRow AddNew()
Returns
| Type | Description |
|---|---|
| RelationTargetRow | A new instance of RelationTargetRow added to the collection. |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
AddRange(IEnumerable<RelationTargetRow>)
Add a range of RelationTargetRow to the collection.
Declaration
public RelationTargetRows AddRange(IEnumerable<RelationTargetRow> rows)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<RelationTargetRow> | rows |
Returns
| Type | Description |
|---|---|
| RelationTargetRows | The updated RelationTargetRows collection object. |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
CreateChild()
Create a new instance of RelationTargetRow
Declaration
protected override TableRowBase CreateChild()
Returns
| Type | Description |
|---|---|
| TableRowBase | New instance of RelationTargetRow |
Overrides
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
CreateNew()
Create a new instance of the RelationTargetRows object. This collection will contain no rows.
Declaration
public static RelationTargetRows CreateNew()
Returns
| Type | Description |
|---|---|
| RelationTargetRows | A new instance of the RelationTargetRows object. |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
Find(Predicate<RelationTargetRow>)
Apply the predicate to each element of the collection and return the first row that matches; if no match then return null
Declaration
public RelationTargetRow Find(Predicate<RelationTargetRow> condition)
Parameters
| Type | Name | Description |
|---|---|---|
| Predicate<RelationTargetRow> | condition |
Returns
| Type | Description |
|---|---|
| RelationTargetRow |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
FindAll(Predicate<RelationTargetRow>)
Return a new collection that contains only those elements that match the condition. Elements are shared, not clones! of the original collection
Declaration
public RelationTargetRows FindAll(Predicate<RelationTargetRow> condition)
Parameters
| Type | Name | Description |
|---|---|---|
| Predicate<RelationTargetRow> | condition |
Returns
| Type | Description |
|---|---|
| RelationTargetRows |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
ForEach(Action<RelationTargetRow>)
Method that iterates over all members and applies the action parameter to each of them
Declaration
public void ForEach(Action<RelationTargetRow> whatToDo)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<RelationTargetRow> | whatToDo |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
GetFromCustomSearchAsync(CustomSearch, CancellationToken)
Create a new instance of the RelationTargetRows object, and populate it with data from a custom search. If the search returns no results, an empty collection will be returned; if the result contains rows, a collection of RelationTargetRow objects representing each row will be returned.
Declaration
public static Task<RelationTargetRows> GetFromCustomSearchAsync(RelationTargetRows.CustomSearch query, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationTargetRows.CustomSearch | query | The custom search to execute against the database |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationTargetRows> | A new instance of the RelationTargetRows object, reflecting the result of the query. |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
GetFromIdxBidirectionalAsync(short, CancellationToken)
Create a new instance of the RelationTargetRow object, by querying the database table via the index 'IDXRelTargBidirectional'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationTargetRows> GetFromIdxBidirectionalAsync(short bidirectional, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | bidirectional | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationTargetRows> | Row object that represents the result of the search. IsNew will be true if the query did not match any row in the table |
Remarks
This method represents one of the unique indexes on the RelationTarget table. Non-unique indexes have corresponding inner classes and methods in the RelationTargetRows collection, since they may return more than one row.
GetFromIdxDestinationTableAsync(short, CancellationToken)
Create a new instance of the RelationTargetRow object, by querying the database table via the index 'IDXRelTargDestination_table'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationTargetRows> GetFromIdxDestinationTableAsync(short destinationTable, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | destinationTable | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationTargetRows> | Row object that represents the result of the search. IsNew will be true if the query did not match any row in the table |
Remarks
This method represents one of the unique indexes on the RelationTarget table. Non-unique indexes have corresponding inner classes and methods in the RelationTargetRows collection, since they may return more than one row.
GetFromIdxReldefIdAsync(int, CancellationToken)
Create a new instance of the RelationTargetRow object, by querying the database table via the index 'IDXRelTargReldef_id'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationTargetRows> GetFromIdxReldefIdAsync(int reldefId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | reldefId | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationTargetRows> | Row object that represents the result of the search. IsNew will be true if the query did not match any row in the table |
Remarks
This method represents one of the unique indexes on the RelationTarget table. Non-unique indexes have corresponding inner classes and methods in the RelationTargetRows collection, since they may return more than one row.
GetFromIdxSourceTableAsync(short, CancellationToken)
Create a new instance of the RelationTargetRow object, by querying the database table via the index 'IDXRelTargSource_table'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationTargetRows> GetFromIdxSourceTableAsync(short sourceTable, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | sourceTable | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationTargetRows> | Row object that represents the result of the search. IsNew will be true if the query did not match any row in the table |
Remarks
This method represents one of the unique indexes on the RelationTarget table. Non-unique indexes have corresponding inner classes and methods in the RelationTargetRows collection, since they may return more than one row.
GetFromReaderAsync(SoDataReader, RelationTargetTableInfo, CancellationToken)
Create a new instance of the RelationTargetRows object, and populate it with data from a reader. If the search returns no results, an empty collection will be returned; if the result contains rows, a collection of RelationTargetRow objects representing each row will be returned.
Note that the internal logic starts by calling reader.Read(), which is correct if you hand the method the result of an ExecuteReader(), but if the reader has already been advanced one or more rows, the current row will be skipped and collection population will start with the next row.Declaration
public static Task<RelationTargetRows> GetFromReaderAsync(SoDataReader reader, RelationTargetTableInfo tableInfo, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SoDataReader | reader | SoDataReader positioned to a valid database row. |
| RelationTargetTableInfo | tableInfo | RelationTargetTableInfo instance used in the query that is the source of the reader. The fields used from the reader will be those owned by this tableinfo object. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationTargetRows> |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
Remove(RelationTargetRow)
Removes the given RelationTargetRow from the collection
Declaration
public void Remove(RelationTargetRow row)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationTargetRow | row | the RelationTargetRow to be removed |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
ToArray()
Definition of targets for a relation. Links a relation definition (RelDef) to source and target tables. In general, a relation can be created between any pair of tables. This table is used for specifying which table pairs a particular relation can be used for. A relation definition should have at least one row in this table, and can have more. Note: The 5.0 Maintenance and GUI only support contact and person as valid values for the source_table and destination_table fields, in any combination. Other relations will not be shown, and relation definitions pointing to other tables will not be editable from the Maintenance GUI; however, nothing will crash. Collection of RelationTargetRow. Each element of the collection represents one row in the RelationTarget table.
Declaration
public RelationTargetRow[] ToArray()
Returns
| Type | Description |
|---|---|
| RelationTargetRow[] |
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
ToString()
For debugging: Number of members, and the first (up to) 5 items
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Remarks
Row collections can be created in several ways.
- Use the static CreateNew() method to create a new, empty collection. You can then add objects of type RelationTargetRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationTargetRows RelationTargetRows.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch method to apply the query to the database and obtain the result as a Rows object, with one item for each table row that matched your query.
- For each non-unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.