Class AnyTableListProviderBase
Base class for flat "MDO Lists" for any tables, that does not support filtering through group and heading link, etc...
Inheritance
Inherited Members
Namespace: SuperOffice.CRM.Lists
Assembly: SoDataBase.dll
Syntax
public abstract class AnyTableListProviderBase : ISoListProvider, ISoList
Constructors
AnyTableListProviderBase()
Default Constructor
Declaration
protected AnyTableListProviderBase()
Fields
_historyListSize
Base class for flat "MDO Lists" for any tables, that does not support filtering through group and heading link, etc...
Declaration
protected int _historyListSize
Field Value
| Type | Description |
|---|---|
| int |
Properties
AdditionalInfo
Additional information to provider
Declaration
protected string AdditionalInfo { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ExcludeHistory
if true, history will be excluded.
Declaration
protected bool ExcludeHistory { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ForceFlatList
If true, the returned list will be flat, though it will still be filtered if grouping/filtering has been set up for the list.
Declaration
protected bool ForceFlatList { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
HistoryIDs
Array of history ID's; if non-null, this will BE the history; a non-null but empty array will disable reading of history altogether; a null parameter will cause history to be read from the database.
Declaration
protected int[] HistoryIDs { get; set; }
Property Value
| Type | Description |
|---|---|
| int[] |
HistoryInfo
History information for the supported list
Declaration
public virtual HistoryInfo HistoryInfo { get; }
Property Value
| Type | Description |
|---|---|
| HistoryInfo |
ListName
List name (though note that as implemented by MDOProviderBase, this actually has to be a real table name, so subclasses should override and convert from their list name to a real table name) (yes it's a bit messy)
Declaration
protected string ListName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
OnlyReadHistory
if true, only history will be read.
Declaration
protected bool OnlyReadHistory { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SearchValue
If non-null, the returned list will be flat and only consist of search matches.
Declaration
protected string SearchValue { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
TableInfo
The main table info of the query. This is used by subclasses (e.g. this class) when restricting history data.
Declaration
protected abstract TableInfo TableInfo { get; }
Property Value
| Type | Description |
|---|---|
| TableInfo |
Methods
ClearHistoryItems()
Clears the history items
Declaration
public void ClearHistoryItems()
ConstructAsync(string, string, int[], bool, string, bool, CancellationToken)
Phase two of two-stage list construction. To be called right after the constructor, at which point all constructors have run, and the class hierarchy is initialized.
Declaration
public Task ConstructAsync(string listName, string additionalInfo, int[] historyIDs, bool onlyReadHistory, string searchValue, bool forceFlatList, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | listName | List name (though note that as implemented by MDOProviderBase, this actually has to be a real table name, so subclasses should override and convert from their list name to a real table name) (yes it's a bit messy) |
| string | additionalInfo | Additional information to provider |
| int[] | historyIDs | Array of history ID's; if non-null, this will BE the history; a non-null but empty array will disable reading of history altogether; a null parameter will cause history to be read from the database. |
| bool | onlyReadHistory | if true, only history will be read. |
| string | searchValue | If non-null, the returned list will be flat and only consist of search matches |
| bool | forceFlatList | If true, the returned list will be flat, though it will still be filtered if grouping/filtering has been set up for the list |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ExecuteQueryAsync(Select, List<ISoListItem>, CancellationToken)
Execute the query in the database.
Declaration
protected virtual Task ExecuteQueryAsync(Select sql, List<ISoListItem> resultCollection, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Select | sql | The query to execute in the database. |
| List<ISoListItem> | resultCollection | Collection holding the results of the query. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ExecuteReaderAsync(SoCommand, CancellationToken)
Perform the execute reader on the command fetching the first 500 items.
Override this methid if filters on the amount returned needs to be handled.
Declaration
protected virtual Task<SoDataReader> ExecuteReaderAsync(SoCommand cmd, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SoCommand | cmd | The command toe perform the execute reader on. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<SoDataReader> | The reader resulted from the execute reader method. |
GetHeadingItemsAsync(CancellationToken)
This list will never have headings.
Declaration
public Task<List<ISoListHeading>> GetHeadingItemsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<List<ISoListHeading>> |
GetHistoryItemsAsync(CancellationToken)
History items for the "MDO" list.
Declaration
public Task<List<ISoListItem>> GetHistoryItemsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<List<ISoListItem>> |
GetHistoryItemsFromDbAsync(CancellationToken)
Get all the history items from the database
Declaration
protected virtual Task<List<ISoListItem>> GetHistoryItemsFromDbAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<List<ISoListItem>> | Root items. |
GetMainQueryAsync(CancellationToken)
Get the main query for the list.
Declaration
protected abstract Task<Select> GetMainQueryAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Select> |
GetRootItemsAsync()
Get all the root items from the database
Declaration
protected virtual Task<List<ISoListItem>> GetRootItemsAsync()
Returns
| Type | Description |
|---|---|
| Task<List<ISoListItem>> | History items. |
GetRootItemsAsync(CancellationToken)
Root items (e.g. items) for the "MDO List".
Declaration
public Task<List<ISoListItem>> GetRootItemsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<List<ISoListItem>> |
InitAsync(CancellationToken)
Initiate the provider after the ConstructAsync(string, string, int[], bool, string, bool, CancellationToken) method is called.
Declaration
protected abstract Task InitAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
OnPostGetRootItemsAsync(List<ISoListItem>)
Event raised by GetRootItemsAsync(CancellationToken) after values are fetched from the database.
Declaration
protected virtual Task OnPostGetRootItemsAsync(List<ISoListItem> items)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ISoListItem> | items | List of items returned from GetRootItemsAsync(CancellationToken). |
Returns
| Type | Description |
|---|---|
| Task |
OnPreGetRootItemsAsync(List<ISoListItem>)
Event raised by GetRootItemsAsync(CancellationToken) before values are fetched from the database.
Declaration
protected virtual Task OnPreGetRootItemsAsync(List<ISoListItem> items)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ISoListItem> | items | List of items returned from GetRootItemsAsync(CancellationToken). |
Returns
| Type | Description |
|---|---|
| Task |
OnRead(SoDataReader, short)
Raised every time a new row has been read from the database.
The implementation should read tthe results from the reader
and populate an object implementing ISoListItem.
Declaration
protected abstract ISoListItem OnRead(SoDataReader reader, short lastRank)
Parameters
| Type | Name | Description |
|---|---|---|
| SoDataReader | reader | Reader to reaf from. |
| short | lastRank | Value of the last rank populated. |
Returns
| Type | Description |
|---|---|
| ISoListItem | Data read from the reader. |
SetHistoryListSizeFromPreference()
Base class for flat "MDO Lists" for any tables, that does not support filtering through group and heading link, etc...
Declaration
protected void SetHistoryListSizeFromPreference()
SetHistoryRestriction(Select)
Set History restriction to the query. TableInfo is used when manipulating the query.
Declaration
protected virtual void SetHistoryRestriction(Select sql)
Parameters
| Type | Name | Description |
|---|---|---|
| Select | sql | The query to modify. |
SetSearchRestrictionAsync(Select, string)
Set the search restriction on the list.
Declaration
protected abstract Task SetSearchRestrictionAsync(Select sql, string searchValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Select | sql | Query to set the search restriction on. |
| string | searchValue | The value of the search restriction. |
Returns
| Type | Description |
|---|---|
| Task |