Show / Hide Table of Contents

Class QueryProviderBase<RowType>

This is the base class for ArchiveProviders that use a database query to get their data. Other ways of making archive providers exist, such as , where the data source is something else and the data are simply buffered by the base class.

Inheritance
Object
ExtensibleColumnsBase
QueryProviderBase<RowType>
ListItemsProvider
ParticipantsSubProviderBase
ProjectMemberAssociateProvider
RelationQueryProviderBase<SourceExtenderType, TargetExtenderType>
ReportLabelLayoutProvider
SelectionCombinedContactProviderBase<Extender>
TimeZonesProvider
TypedQueryProviderBase<RowType, RootExtender>
Implements
IArchiveProviderQueryMapping
IArchiveQueryProvider
IArchiveProviderExtensible
IArchiveProvider
IArchiveProviderHasRows
IArchiveProviderHasColumns
IArchiveProviderHasEntities
Inherited Members
ExtensibleColumnsBase._minuteFields
ExtensibleColumnsBase.Visible
ExtensibleColumnsBase.Invisible
ExtensibleColumnsBase.AllowOrderBy
ExtensibleColumnsBase.DenyOrderBy
ExtensibleColumnsBase.GetAllRestriction
ExtensibleColumnsBase.GetNoneRestriction
ExtensibleColumnsBase.InnerPopulateRowFromReader(SoDataReader, ArchiveRow)
ExtensibleColumnsBase.SetParent(IArchiveProviderExtensible)
ExtensibleColumnsBase.AddAvailableColumn(ArchiveColumnInfo[])
ExtensibleColumnsBase.GetAvailableColumns()
ExtensibleColumnsBase.SetOrderByMapping(String, String[])
ExtensibleColumnsBase.SetOrderByMapping(ArchiveColumnInfo, ArchiveColumnInfo[])
ExtensibleColumnsBase.SetPrefixes(String, String)
ExtensibleColumnsBase.SetLocalAbsolutePrefixes(String, String)
ExtensibleColumnsBase.SetIconHint(String)
ExtensibleColumnsBase.AddLocalRestriction(ArchiveRestrictionInfo[])
ExtensibleColumnsBase.AddExtensionProvider(IArchiveExtender)
ExtensibleColumnsBase.GetExtensionProviders()
ExtensibleColumnsBase.GetTableInfosFromExtensionProviders()
ExtensibleColumnsBase.PopulateRowFromReader(SoDataReader, ArchiveRow)
ExtensibleColumnsBase.SuppressTableResults(SoDataReader, TableInfo)
ExtensibleColumnsBase.SuppressDeepTableResults(SoDataReader, TableInfo)
ExtensibleColumnsBase.AddColumnNameOverride(String, String)
ExtensibleColumnsBase.ApplyColumnNameOverrides(ArchiveRow)
ExtensibleColumnsBase.AddSubExtenderMapping(String, ExtensibleColumnsBase[])
ExtensibleColumnsBase.WantColumnForOutput(String[])
ExtensibleColumnsBase.WantColumnForOutput(ArchiveColumnInfo[])
ExtensibleColumnsBase.WantColumnForOutput(List<ArchiveColumnInfo>)
ExtensibleColumnsBase.WantColumnForRestriction(String[])
ExtensibleColumnsBase.WantColumnForRestriction(ArchiveColumnInfo[])
ExtensibleColumnsBase.WantColumnForOrderBy(String[])
ExtensibleColumnsBase.GetColumnOrderBy(String)
ExtensibleColumnsBase.WantColumnForOrderBy(ArchiveColumnInfo[])
ExtensibleColumnsBase.WantColumnForAnything(String[])
ExtensibleColumnsBase.WantColumnForAnything(ArchiveColumnInfo[])
ExtensibleColumnsBase.IsQueryNeeded()
ExtensibleColumnsBase.IsQueryRestriction()
ExtensibleColumnsBase.GetLeftOuterOrInnerJoin(Equal)
ExtensibleColumnsBase.GetLeftOuterOrInnerJoin(Equal, Restriction)
ExtensibleColumnsBase.SetLeftOuterOrInnerJoin(Equal)
ExtensibleColumnsBase.SetLeftOuterOrInnerJoin(Equal, Restriction)
ExtensibleColumnsBase.MapReturnField(ArchiveSelect, FieldInfo, Boolean, String, ArchiveColumnInfo[])
ExtensibleColumnsBase.MapIdField(FieldInfo)
ExtensibleColumnsBase.MapAssociateField(FieldInfo, ArchiveColumnInfo)
ExtensibleColumnsBase.MapEjUserField(FieldInfo, ArchiveColumnInfo)
ExtensibleColumnsBase.MapSimpleReturnField(FieldInfo, ArchiveColumnInfo[])
ExtensibleColumnsBase.MapSimpleImageField(FieldInfo, ArchiveColumnInfo, Int32, Int32)
ExtensibleColumnsBase.MapPictureBlob(FieldInfo, ArchiveColumnInfo, BlobLinkType, Int32, Int32, Int32)
ExtensibleColumnsBase.MapSimpleCustomField(FieldInfo, ArchiveColumnInfo[])
ExtensibleColumnsBase.MapSimpleListReturnField(FieldInfo, String, ArchiveColumnInfo[])
ExtensibleColumnsBase.MapOrderByField(FieldInfo, ArchiveColumnInfo)
ExtensibleColumnsBase.ActivateAsLinkField(String, ArchiveColumnInfo[])
ExtensibleColumnsBase.HasAvailableColumn(String)
ExtensibleColumnsBase.AddAndInitializeExtensionProvider<ExtenderType>(ExtenderType, String, String)
ExtensibleColumnsBase.AddAndInitializeExtensionProvider<ExtenderType>(ExtenderType)
ExtensibleColumnsBase.HasRestriction(String)
ExtensibleColumnsBase.ExtractRestrictions(String)
ExtensibleColumnsBase.ExtractRestrictions(ArchiveColumnInfo)
ExtensibleColumnsBase.ExtractRestriction(String)
ExtensibleColumnsBase.ExtractRestriction(ArchiveColumnInfo)
ExtensibleColumnsBase.ProcessRestrictions()
ExtensibleColumnsBase.ProcessOrderBy()
ExtensibleColumnsBase.PopulateSimpleFields(SoDataReader, ArchiveRow)
ExtensibleColumnsBase.CalculateOrderbyValue(String, SoDataReader, ArchiveColumnData)
ExtensibleColumnsBase.AddDbInfo(ArchiveColumnData, FieldInfo)
ExtensibleColumnsBase.AddDbInfo(ArchiveColumnData, Int32)
ExtensibleColumnsBase.ForceDisable()
ExtensibleColumnsBase.GetAssociateData(Int32)
ExtensibleColumnsBase.GetEjUserData(Int32)
ExtensibleColumnsBase.GetColumnIndex(ArchiveColumnInfo)
ExtensibleColumnsBase.GetColumnIndexFromReader(SoDataReader, FieldInfo, Int32)
ExtensibleColumnsBase.ConvertDbTypeToString(Object, ExtensibleColumnsBase.DbColumnBinding)
ExtensibleColumnsBase.GetStandardTooltipHint(SoDataReader, FieldInfo)
ExtensibleColumnsBase.GetLinkHint(SoDataReader, String)
ExtensibleColumnsBase.SetNonZeroBoolRestriction(ArchiveColumnInfo)
ExtensibleColumnsBase.AddUpdatedByMapping(ArchiveColumnInfo, FieldInfo, FieldInfo)
ExtensibleColumnsBase.AddRegisteredMapping(ArchiveColumnInfo, FieldInfo, ArchiveColumnInfo, FieldInfo)
ExtensibleColumnsBase.AddLastUpdatedMapping(ArchiveColumnInfo, FieldInfo, FieldInfo)
ExtensibleColumnsBase.AddUpdatedBy(SoDataReader, ArchiveRow, ArchiveColumnInfo, FieldInfo, FieldInfo)
ExtensibleColumnsBase.AddUpdatedDate(SoDataReader, ArchiveRow, ArchiveColumnInfo, FieldInfo, FieldInfo)
ExtensibleColumnsBase.AddAssociateFullName(SoDataReader, ArchiveRow, ArchiveColumnInfo, FieldInfo[])
ExtensibleColumnsBase.GetIdFieldTag(SoDataReader)
ExtensibleColumnsBase.GetArchiveColumnName(SoField)
ExtensibleColumnsBase.ExtensibleHelper
ExtensibleColumnsBase.ColumnHelper
ExtensibleColumnsBase.RestrictionHelper
ExtensibleColumnsBase.Parent
ExtensibleColumnsBase.DisableSubtreeIfNoRestriction
ExtensibleColumnsBase.RestrictionSetForSubtree
ExtensibleColumnsBase.ForceQueryNeeded
ExtensibleColumnsBase.ForceRestriction
ExtensibleColumnsBase.BlockOrderBy
ExtensibleColumnsBase.IdField
ExtensibleColumnsBase.LastSubExtenderWins
ExtensibleColumnsBase.ParentPrimaryKey
ExtensibleColumnsBase.QuoteAlternativeId
ExtensibleColumnsBase.SaleId
ExtensibleColumnsBase.NamePrefix
ExtensibleColumnsBase.DisplayNamePrefix
ExtensibleColumnsBase.PopulateDisplayValue
ExtensibleColumnsBase.PopulateTooltipHint
ExtensibleColumnsBase.DebugXML
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
public abstract class QueryProviderBase<RowType> : ExtensibleColumnsBase, IArchiveProviderQueryMapping, IArchiveQueryProvider, IArchiveProviderExtensible, IArchiveProvider, IArchiveProviderHasRows, IArchiveProviderHasColumns, IArchiveProviderHasEntities, IPlugin where RowType : ArchiveRow, new()
Type Parameters
Name Description
RowType
Remarks

Classes derived from this class will generally have the following structure:

    An archive provider can have functionality ranging from trivial to extremely complex, and there are a number of ways to compose, extend and factor the query buildup and processing. Refer to the SDK documentation for more details.

    Constructors

    QueryProviderBase()

    Declaration
    protected QueryProviderBase()

    Fields

    _colGetAllRows

    Dummy column present in all archives; used in restrictions to specifically request a non-restricted read from the database.

    Declaration
    protected ArchiveColumnInfo _colGetAllRows
    Field Value
    Type Description
    ArchiveColumnInfo

    _colGetNoRows

    Declaration
    protected ArchiveColumnInfo _colGetNoRows
    Field Value
    Type Description
    ArchiveColumnInfo

    _pageNumber

    Declaration
    protected int _pageNumber
    Field Value
    Type Description
    Int32

    _pageSize

    Declaration
    protected int _pageSize
    Field Value
    Type Description
    Int32

    Properties

    DropTablesFromPhaseTwo

    The fields in this enumeration will be dropped from a Phase Two query; that may also cause one or more tables to be dropped. A useful optimization in a very small number of cases (where fields/joins are only used for Phase One/AcceptRow processing)

    Declaration
    protected virtual TableInfo[] DropTablesFromPhaseTwo { get; }
    Property Value
    Type Description
    TableInfo[]

    HaveReadToEnd

    If all subproviders have been read all the way, then this is set to true

    Declaration
    protected bool HaveReadToEnd { get; }
    Property Value
    Type Description
    Boolean

    InhibitDistinctPrimaryKeys

    Override this property and return TRUE if you wish to disable the check for distinct primary keys. This will save some time and space, at the cost of potential duplicate rows that would otherwise have been discarded

    Declaration
    public virtual bool InhibitDistinctPrimaryKeys { get; }
    Property Value
    Type Description
    Boolean

    InhibitTwoPhaseQuery

    Queries are usually run in two phases, one to determine the result set and the other to actually include all joins and fields. This can be inhibited if needed

    Declaration
    protected bool InhibitTwoPhaseQuery { get; set; }
    Property Value
    Type Description
    Boolean

    OrderBySlots

    The Order By storage system of this archive provider

    Declaration
    public override OrderByStorage OrderBySlots { get; }
    Property Value
    Type Description
    OrderByStorage
    Overrides
    ExtensibleColumnsBase.OrderBySlots

    PrimaryKey

    The primary key, whose values are used by the duplicate eliminator

    Declaration
    protected FieldInfo PrimaryKey { get; set; }
    Property Value
    Type Description
    FieldInfo

    PrimaryTable

    The primary table of this archive provider, from the derived class

    Declaration
    public abstract TableInfo PrimaryTable { get; }
    Property Value
    Type Description
    TableInfo

    Query

    The main query of this archive provider, from the derived class

    Declaration
    public abstract ArchiveSelect Query { get; }
    Property Value
    Type Description
    ArchiveSelect

    RootExtenders

    Implement this property to return the extender(s) that form the root of the query tree, or null if that is not meaningful. This property is used by the dynamic column processing, which will fail and throw an exception if null is returned here (no problem if dynamic column syntax is not used)

    Declaration
    protected abstract List<IArchiveExtender> RootExtenders { get; }
    Property Value
    Type Description
    List<IArchiveExtender>

    RootQuery

    The main query of this archive provider

    Declaration
    public override ArchiveSelect RootQuery { get; }
    Property Value
    Type Description
    ArchiveSelect
    Overrides
    ExtensibleColumnsBase.RootQuery

    TableToExtend

    The primary table of this archive provider

    Declaration
    public override TableInfo TableToExtend { get; }
    Property Value
    Type Description
    TableInfo
    Overrides
    ExtensibleColumnsBase.TableToExtend

    ValueOverrides

    Declaration
    protected Dictionary<string, string> ValueOverrides { get; }
    Property Value
    Type Description
    Dictionary<String, String>

    Methods

    AcceptRow(SoDataReader)

    Decide whether the current row of the passed-in _reader should be accepted or not. If false is returned, this row is skipped by the base class and never seen by the client. This method is called very early, before any ArchiveRow population, and can only rely on fields directly accessible in the Reader. On the other hand, that makes is reasonably cheap to skip rows.

    If you implement this method, you MUST aslo implement RequiredPhaseOneFields() to tell the query rewriter about fields you need, otherwise they will not be present in the phase one query and you will crash.

    Declaration
    protected virtual bool AcceptRow(SoDataReader reader)
    Parameters
    Type Name Description
    SoDataReader reader
    Returns
    Type Description
    Boolean

    true if the current row should be further processed

    AddInhibitedStyleHint(String)

    Add a style hint to the list of style hints that should be hidden (not be present in the final result rows)

    Declaration
    public void AddInhibitedStyleHint(string stylehint)
    Parameters
    Type Name Description
    String stylehint

    Close()

    Call this method after the last desired row has been read; this gives the provider the chance to close and free any underlying queries.

    Declaration
    public virtual void Close()

    ConvertToTypedRows(IEnumerable<ArchiveRow>)

    Convert a generic ArchiveRow into some typed subclass, provided the passed-in rows are actually castable

    Declaration
    protected IEnumerable<RowType> ConvertToTypedRows(IEnumerable<ArchiveRow> genericRows)
    Parameters
    Type Name Description
    IEnumerable<ArchiveRow> genericRows

    Enumerable of generic rows that are actually a typed subclass

    Returns
    Type Description
    IEnumerable<RowType>

    Enumerable of case, typed rows

    CreateArchiveRow(String, Int32)

    Create the archive row object. Providers that offer a strongly typed interface should override this method and create their strongly typed row instead of leaving this generic implementation to make the generic one.

    Declaration
    protected virtual RowType CreateArchiveRow(string entityName, int primaryKey)
    Parameters
    Type Name Description
    String entityName

    name of entity represented by this row

    Int32 primaryKey

    Primary key value of this row

    Returns
    Type Description
    RowType

    Empty row

    GetAvailableEntities()

    Get all entities declared by this provider and its extenders

    Declaration
    public virtual List<ArchiveRowTypeInfo> GetAvailableEntities()
    Returns
    Type Description
    List<ArchiveRowTypeInfo>

    List of available entities

    GetEntityName(SoDataReader)

    Return the entity name of the current row. The default implementation statically assigns the name of the first registered entity to all rows. Subclasses may override this method if they wish to set other entity names, possibly dependent on data.

    Declaration
    protected virtual string GetEntityName(SoDataReader _reader)
    Parameters
    Type Name Description
    SoDataReader _reader

    _reader with the current data row

    Returns
    Type Description
    String

    Entity name

    GetFinalRowCount()

    Actual number of rows in query, valid only when HaveReadToEnd = true; otherwise you get -1

    Declaration
    protected int GetFinalRowCount()
    Returns
    Type Description
    Int32

    GetReader(String)

    Declaration
    public virtual IDataReader GetReader(string options)
    Parameters
    Type Name Description
    String options
    Returns
    Type Description
    IDataReader

    GetResultInformation()

    Get additional information about the result, such as row count or other optional items. This method should be called some time after GetRows, but before Close. Delaying calls to this method as long as possible will give its (asynchronous) internal counterpart more time to complete and lessen the response-time impact of calling it.

    Declaration
    public ArchiveResultInformation GetResultInformation()
    Returns
    Type Description
    ArchiveResultInformation

    GetRows(String)

    Pass the built-up query to the database; perform paging; and pass populated rows back to the caller.

    Declaration
    public virtual IEnumerable<ArchiveRow> GetRows(string options)
    Parameters
    Type Name Description
    String options
    Returns
    Type Description
    IEnumerable<ArchiveRow>
    Remarks

    This method calls the following derived-class overrides, in the following order:

    HandleDynamicExtenders(IArchiveExtender)

    Declaration
    protected virtual void HandleDynamicExtenders(IArchiveExtender dynamicTree)
    Parameters
    Type Name Description
    IArchiveExtender dynamicTree

    InnerMapFields()

    Override this method to map query fields to columns, add additional return fields to the query, and set up custom restriction handling

    Declaration
    public virtual void InnerMapFields()

    InnerSetRestriction(ArchiveRestrictionInfo[])

    Override this method to implement custom processing during SetRestriction, without killing the default implementation

    Declaration
    public virtual bool InnerSetRestriction(ArchiveRestrictionInfo[] restrictions)
    Parameters
    Type Name Description
    ArchiveRestrictionInfo[] restrictions

    Incoming array of restrictions

    Returns
    Type Description
    Boolean

    True if at least one active restriction matched a known column and was processed

    OverrideValueIfBlank(ArchiveRow, String, String)

    Declaration
    protected bool OverrideValueIfBlank(ArchiveRow row, string columnToOverride, string alternativeSource)
    Parameters
    Type Name Description
    ArchiveRow row
    String columnToOverride
    String alternativeSource
    Returns
    Type Description
    Boolean

    PostProcessQuery()

    This method is called after ModifyQuery has been called on all extenders, but before the query is executed. It is used for processing that needs the query to be 'complete' from the extenders, and gives the opportunity to tweak it, for instance by adding return fields needed for some particular functionality.

    Declaration
    public virtual void PostProcessQuery()

    PostProcessRow(SoDataReader, ArchiveRow)

    This method is a hook that can be used by derived classes to post-process rows. It is called after all extenders have fetched their data and populated the row.

    Declaration
    protected virtual void PostProcessRow(SoDataReader _reader, ArchiveRow row)
    Parameters
    Type Name Description
    SoDataReader _reader
    ArchiveRow row

    RegisterEntity(ArchiveRowTypeInfo)

    Register an entity on this provider

    Declaration
    protected ArchiveRowTypeInfo RegisterEntity(ArchiveRowTypeInfo entity)
    Parameters
    Type Name Description
    ArchiveRowTypeInfo entity

    Entity to register

    Returns
    Type Description
    ArchiveRowTypeInfo

    The same entity, so you can go on doing things to it

    RequiredPhaseOneFields()

    Return the FieldInfo fields needed by AcceptRow(SoDataReader), so that the query rewriter does not drop them. Implement this method IFF you implement AcceptRow.

    Declaration
    protected virtual FieldInfo[] RequiredPhaseOneFields()
    Returns
    Type Description
    FieldInfo[]

    SetDesiredColumns(String[])

    Set the desired columns, by saving them in an internal data structures. Duplicates are gracefully ignored.

    Declaration
    public override void SetDesiredColumns(params string[] columnIds)
    Parameters
    Type Name Description
    String[] columnIds
    Overrides
    ExtensibleColumnsBase.SetDesiredColumns(String[])

    SetDesiredEntities(String[])

    Set the desired entities

    Declaration
    public virtual void SetDesiredEntities(params string[] entities)
    Parameters
    Type Name Description
    String[] entities

    Names of desired entities

    SetOrderBy(ArchiveOrderByInfo[])

    Declaration
    public override void SetOrderBy(ArchiveOrderByInfo[] orderBy)
    Parameters
    Type Name Description
    ArchiveOrderByInfo[] orderBy
    Overrides
    ExtensibleColumnsBase.SetOrderBy(ArchiveOrderByInfo[])

    SetPagingInfo(Int32, Int32)

    Verify the paging information, and set page size and number

    Declaration
    public void SetPagingInfo(int pageSize, int pageNumber)
    Parameters
    Type Name Description
    Int32 pageSize

    Page size in rows, 1-2000 or int.MaxValue to disable paging

    Int32 pageNumber

    0-based page number

    SetRestriction(ArchiveRestrictionInfo[])

    Set the restriction by calling the base class and InnerSetRestriction; take this opportunity to note that a restriction has actually been set, so we can report cases of totally missing restrictions (which is not acceptable as it might end up fetching the whole database)

    Declaration
    public override bool SetRestriction(params ArchiveRestrictionInfo[] restrictions)
    Parameters
    Type Name Description
    ArchiveRestrictionInfo[] restrictions
    Returns
    Type Description
    Boolean
    Overrides
    ExtensibleColumnsBase.SetRestriction(ArchiveRestrictionInfo[])

    Implements

    IArchiveProviderQueryMapping
    IArchiveQueryProvider
    IArchiveProviderExtensible
    IArchiveProvider
    IArchiveProviderHasRows
    IArchiveProviderHasColumns
    IArchiveProviderHasEntities

    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