Class RelationsRows
Instance of a relation, in principle between any two records, as long as they are defined in RelationDefinition. All instances of relations are held in this table; their definitions are in the RelDef table (RelDef + RelTarg define which relations you can have, this table contains the relations the user has actually entered). From 6.1 all links between appointments, sales and documents are also stored in this tabel. Collection of RelationsRow. Each element of the collection represents one row in the Relations table.
Inheritance
Implements
Inherited Members
Namespace: SuperOffice.CRM.Rows
Assembly: SoDataBase.dll
Syntax
public class RelationsRows : 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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 RelationsRow given its index in the collection.
Declaration
public RelationsRow this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Index of the RelationsRow in the collection |
Property Value
| Type | Description |
|---|---|
| RelationsRow |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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(RelationsRow)
Add one RelationsRow to the collection.
Declaration
public int Add(RelationsRow row)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationsRow | row | An instance of RelationsRow to be added to the collection. |
Returns
| Type | Description |
|---|---|
| int | The index of the added RelationsRow. |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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 RelationsRow added to the collection.
Declaration
public RelationsRow AddNew()
Returns
| Type | Description |
|---|---|
| RelationsRow | A new instance of RelationsRow 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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<RelationsRow>)
Add a range of RelationsRow to the collection.
Declaration
public RelationsRows AddRange(IEnumerable<RelationsRow> rows)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<RelationsRow> | rows |
Returns
| Type | Description |
|---|---|
| RelationsRows | The updated RelationsRows 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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 RelationsRow
Declaration
protected override TableRowBase CreateChild()
Returns
| Type | Description |
|---|---|
| TableRowBase | New instance of RelationsRow |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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 RelationsRows object. This collection will contain no rows.
Declaration
public static RelationsRows CreateNew()
Returns
| Type | Description |
|---|---|
| RelationsRows | A new instance of the RelationsRows 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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<RelationsRow>)
Apply the predicate to each element of the collection and return the first row that matches; if no match then return null
Declaration
public RelationsRow Find(Predicate<RelationsRow> condition)
Parameters
| Type | Name | Description |
|---|---|---|
| Predicate<RelationsRow> | condition |
Returns
| Type | Description |
|---|---|
| RelationsRow |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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<RelationsRow>)
Return a new collection that contains only those elements that match the condition. Elements are shared, not clones! of the original collection
Declaration
public RelationsRows FindAll(Predicate<RelationsRow> condition)
Parameters
| Type | Name | Description |
|---|---|---|
| Predicate<RelationsRow> | condition |
Returns
| Type | Description |
|---|---|
| RelationsRows |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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<RelationsRow>)
Method that iterates over all members and applies the action parameter to each of them
Declaration
public void ForEach(Action<RelationsRow> whatToDo)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<RelationsRow> | 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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 RelationsRows 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 RelationsRow objects representing each row will be returned.
Declaration
public static Task<RelationsRows> GetFromCustomSearchAsync(RelationsRows.CustomSearch query, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationsRows.CustomSearch | query | The custom search to execute against the database |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | A new instance of the RelationsRows 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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.
GetFromIdxDestinationRecordAsync(int, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDXRelDestination_record'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxDestinationRecordAsync(int destinationRecord, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | destinationRecord | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxDestinationTableAsync(short, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDXRelDestination_table'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxDestinationTableAsync(short destinationTable, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | destinationTable | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxDestinationTableDestinationRecordAsync(short, int, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDestination_tableDestination_recordReversed'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxDestinationTableDestinationRecordAsync(short destinationTable, int destinationRecord, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | destinationTable | |
| int | destinationRecord | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxDestinationTableDestinationRecordReversedAsync(short, int, short, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDestination_tableDestination_recordReversed'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxDestinationTableDestinationRecordReversedAsync(short destinationTable, int destinationRecord, short reversed, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | destinationTable | |
| int | destinationRecord | |
| short | reversed | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxReldefIdAsync(int, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDXRelReldef_id'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxReldefIdAsync(int reldefId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | reldefId | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxReversedAsync(short, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDXRelReversed'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxReversedAsync(short reversed, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | reversed | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxSourceRecordAsync(int, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDXRelSource_record'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxSourceRecordAsync(int sourceRecord, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | sourceRecord | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxSourceTableAsync(short, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'IDXRelSource_table'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxSourceTableAsync(short sourceTable, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | sourceTable | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxSourceTableSourceRecordAsync(short, int, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'ISource_tableSource_recordReversed'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxSourceTableSourceRecordAsync(short sourceTable, int sourceRecord, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | sourceTable | |
| int | sourceRecord | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromIdxSourceTableSourceRecordReversedAsync(short, int, short, CancellationToken)
Create a new instance of the RelationsRow object, by querying the database table via the index 'ISource_tableSource_recordReversed'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Task<RelationsRows> GetFromIdxSourceTableSourceRecordReversedAsync(short sourceTable, int sourceRecord, short reversed, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| short | sourceTable | |
| int | sourceRecord | |
| short | reversed | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RelationsRows> | 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 Relations table. Non-unique indexes have corresponding inner classes and methods in the RelationsRows collection, since they may return more than one row.
GetFromReaderAsync(SoDataReader, RelationsTableInfo, CancellationToken)
Create a new instance of the RelationsRows 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 RelationsRow 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<RelationsRows> GetFromReaderAsync(SoDataReader reader, RelationsTableInfo tableInfo, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SoDataReader | reader | SoDataReader positioned to a valid database row. |
| RelationsTableInfo | tableInfo | RelationsTableInfo 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<RelationsRows> |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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(RelationsRow)
Removes the given RelationsRow from the collection
Declaration
public void Remove(RelationsRow row)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationsRow | row | the RelationsRow 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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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()
Instance of a relation, in principle between any two records, as long as they are defined in RelationDefinition. All instances of relations are held in this table; their definitions are in the RelDef table (RelDef + RelTarg define which relations you can have, this table contains the relations the user has actually entered). From 6.1 all links between appointments, sales and documents are also stored in this tabel. Collection of RelationsRow. Each element of the collection represents one row in the Relations table.
Declaration
public RelationsRow[] ToArray()
Returns
| Type | Description |
|---|---|
| RelationsRow[] |
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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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 RelationsRow to it, and use methods like Save to operate on the whole collection.
- You can create a (nested) RelationsRows RelationsRows.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.