Show / Hide Table of Contents

Class ListItemLookupHelper

This helper is used by the archives to quickly look up the value (name, tooltip, whatever) corresponding to a list item. It will take either a table number or a list name, look up the item, and cache the result. Various caching and override mechanisms are used to make lookups as fast as possible, and to work with some unconventional 'lists' like contact or person.

Inheritance
object
ListItemLookupHelper
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.dll
Syntax
[SoInject("Database")]
public class ListItemLookupHelper

Methods

Flush()

This helper is used by the archives to quickly look up the value (name, tooltip, whatever) corresponding to a list item. It will take either a table number or a list name, look up the item, and cache the result. Various caching and override mechanisms are used to make lookups as fast as possible, and to work with some unconventional 'lists' like contact or person.

Declaration
public void Flush()

GetCurrent()

This helper is used by the archives to quickly look up the value (name, tooltip, whatever) corresponding to a list item. It will take either a table number or a list name, look up the item, and cache the result. Various caching and override mechanisms are used to make lookups as fast as possible, and to work with some unconventional 'lists' like contact or person.

Declaration
public static ListItemLookupHelper GetCurrent()
Returns
Type Description
ListItemLookupHelper

LookupItemAsync(int, int, CancellationToken)

Look up an SoList item by list table number and ID. This overload works for lists that directly correspond to actual database tables, with the added restriction that those tables must have SoTable.SuperOffice.CRM.Data.SoTable.IsMDOList set to true.

If any condition is broken, or the list item does not exist, the generic blank item is returned.
Declaration
public Task<ISoListItem> LookupItemAsync(int listTableNumber, int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int listTableNumber

List table number in database

int id

ID to look up

CancellationToken cancellationToken
Returns
Type Description
Task<ISoListItem>

List item corresponding to table/ID, or blank

LookupItemAsync(string, int, CancellationToken)

Look up an SoList item by list name and ID. This overload works for ANY list that the SoListProviderFactory knows about, regardless of the origin of that list.

If the list is not found, or the list item does not exist, the generic blank item is returned.
Declaration
public Task<ISoListItem> LookupItemAsync(string listName, int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string listName
int id

ID to look up

CancellationToken cancellationToken
Returns
Type Description
Task<ISoListItem>

List item corresponding to table/ID, or blank

LookupItemAsync(string, string, string, CancellationToken)

Look up an item based on a string key instead of the usual int primarykey

Declaration
public Task<ISoListItem> LookupItemAsync(string listName, string listAdditionalInfo, string key, CancellationToken cancellationToken)
Parameters
Type Name Description
string listName

List name, to be passed on to the list provider factory

string listAdditionalInfo
string key

Key, matched to the ExtraInfo of each item

CancellationToken cancellationToken
Returns
Type Description
Task<ISoListItem>
Remarks

Some lists (ERP Connector related) use a string key instead of an int; the reason is that the source of the list may be external to the superoffice database. Such lists must have normal ISoListProviders implemented, and provide their key in the ExtraInfo field of each item.

This method lazy-loads the entire list of first reference, and performs dictionary looks later on. The cache is only cleared on Flush(). If the ExtraInfo keys are not in fact unique, then the last one wins (no crashes)

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top