Class BaseGridControllerWrapper<TWrapper, TMain, TPivot>
The base wrapper grid controller which works with the IBaseGridWrapperCollection<TWrapper, TMain, TPivot> view displaying wrapped items with pivotted columns in the wrapper
This is the main controller for creating grids of any wrapped item in the system that holds pivotted columns of another item in the system
Both this controller and the BaseDefaultSingleViewController<T> view have a similar mechanism for creating controls dynamically within the UIImplements
Inherited Members
Namespace: LemonEdge.Client.Core.Views.Core
Assembly: LemonEdge.ClientCore.dll
Syntax
public abstract class BaseGridControllerWrapper<TWrapper, TMain, TPivot> : BaseGridControllerAny<TWrapper>, IBaseGridController, ICollectionExportable, INewGridItemImplementor<TWrapper>, ICopyGridItemImplementor<TWrapper>, IGrid, IDeleteGridItemImplementor<TWrapper>, ISearchController, IModelViewController where TWrapper : class, IWrapper, new() where TMain : IBaseEntity where TPivot : IBaseEntity
Type Parameters
Name | Description |
---|---|
TWrapper | The type that wraps the main and pivotted classes. Must implement all the properties of
|
TMain | The main item that is displayed in the grid via the |
TPivot | The type of entity that holds additional properties to be pivotted on the wrapper |
Constructors
BaseGridControllerWrapper(IBaseGridWrapperCollection<TWrapper, TMain, TPivot>)
Creates a new base grid wrapper view controller with the specified instance of a default wrapper grid view
Declaration
public BaseGridControllerWrapper(IBaseGridWrapperCollection<TWrapper, TMain, TPivot> view)
Parameters
Type | Name | Description |
---|---|---|
IBaseGridWrapperCollection<TWrapper, TMain, TPivot> | view | The instance of the default wrapper grid view in the client application |
Properties
AllowIDFilter
If true indicates that the TMain
results of this grid can be altered by parameters of type
DisplayableItemDescriptorForCollectionParams against the
ItemParams
The default is true, but is overridden for grids that display sub sets of information related to other items
Declaration
protected virtual bool AllowIDFilter { get; }
Property Value
Type | Description |
---|---|
bool |
DefaultRowCount
If PivotQueryDependsOnMain is true then alters the default row count to 100 if it is less than the base default row count
Default is lowered as the query to load pivot information can be quite costly if it depends on the main results, and is better with less total rows.
Declaration
public override int DefaultRowCount { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Headers
All the columns loaded to hold the extra properties on the TWrapper
type
Declaration
protected IEnumerable<IBaseEntity> Headers { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IBaseEntity> |
PivotColumnInfo
The details of the indexed property on the TWrapper
type that holds all the values for the
pivotted properties
This is used for every pivotted column created just with a different index for the different items from LoadPivotColumnHeaders()
Declaration
protected abstract (string Name, string GeneralDescription, ColumnType ColType, Type Type) PivotColumnInfo { get; }
Property Value
Type | Description |
---|---|
(string Name, string GeneralDescription, ColumnType ColType, Type Type) |
PivotQueryDependsOnMain
Indicates the pivot query depends on the main results, often filtering the pivot results by the main results
The default is true, but can be overridden for better performance
Declaration
protected virtual bool PivotQueryDependsOnMain { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
AlterMainQuery(QueryableExecuter<TMain>)
Provides the inheriting controller an opportunity to modify the query used to load the data for these
TMain
items
Default implementation does nothing unless the type TMain
is an entity with a property
with a SequenceStart, in which case it is ordered by that
Declaration
protected virtual QueryableExecuter<TMain> AlterMainQuery(QueryableExecuter<TMain> query)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<TMain> | query | The query for this grid to always be altered before being executed |
Returns
Type | Description |
---|---|
QueryableExecuter<TMain> | The query to be used to execute results for this grid |
AlterPivotQuery(QueryableExecuter<TPivot>, IEnumerable<TMain>)
Provides the inheriting controller an opportunity to modify the query used to load the data for these
TPivot
items
Default implementation does nothing unless the type TPivot
is an entity with a property
with a SequenceStart, in which case it is ordered by that
Declaration
protected virtual QueryableExecuter<TPivot> AlterPivotQuery(QueryableExecuter<TPivot> query, IEnumerable<TMain> mainItems)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<TPivot> | query | The query for this grid to always be altered before being executed |
IEnumerable<TMain> | mainItems |
Returns
Type | Description |
---|---|
QueryableExecuter<TPivot> | The query to be used to execute results for this grid |
GetGridController(IBaseGridWrapperCollection<TWrapper, TMain, TPivot>)
Creates the new default wrapper grid view controller with the specified instance of a default wrapper grid view
Declaration
public static BaseGridControllerWrapper<TWrapper, TMain, TPivot> GetGridController(IBaseGridWrapperCollection<TWrapper, TMain, TPivot> view)
Parameters
Type | Name | Description |
---|---|---|
IBaseGridWrapperCollection<TWrapper, TMain, TPivot> | view | The instance of the default wrapper grid view in the client application |
Returns
Type | Description |
---|---|
BaseGridControllerWrapper<TWrapper, TMain, TPivot> | A new default wrapper grid view controller with the specified instance of a default wrapper grid view |
GetGridSourceItems()
Loads the source items (TMain
) along with all the associated pivot information for those
items (TPivot
) and then returns the created TWrapper
for displaying
all that
Declaration
public override Task<IEnumerable<TWrapper>> GetGridSourceItems()
Returns
Type | Description |
---|---|
Task<IEnumerable<TWrapper>> | The combined loaded data of the |
Overrides
GetInternalDescriptor()
Returns the entity descriptor for the type TMain
Declaration
protected override EntityDescriptor GetInternalDescriptor()
Returns
Type | Description |
---|---|
EntityDescriptor | The entity descriptor for the type |
Overrides
GetMainCreationQuery()
Returns the main intial query to return all entities of type TMain
Includes any filtering requested from parameters of type DisplayableItemDescriptorForCollectionParams against the ItemParams if AllowIDFilter is true
Also applies any paging requiredDeclaration
protected virtual QueryableExecuter<TMain> GetMainCreationQuery()
Returns
Type | Description |
---|---|
QueryableExecuter<TMain> | The main intial query to return all entities of type |
GetMainCurrentQuery()
Returns the GetMainCreationQuery() for this entity type, with the AlterMainQuery(QueryableExecuter<TMain>) and ApplyGridSettingsToFilter(QueryableExecuter) applied
Declaration
public QueryableExecuter<TMain> GetMainCurrentQuery()
Returns
Type | Description |
---|---|
QueryableExecuter<TMain> | The GetMainCreationQuery() for this entity type, with the AlterMainQuery(QueryableExecuter<TMain>) and ApplyGridSettingsToFilter(QueryableExecuter) applied |
GetPivotCreationQuery(IEnumerable<TMain>)
Returns the main intial query to return all entities of type TPivot
The default implementation filters the TPivot
items returned by those referencing the
specified mainItems
. Requires PivotQueryDependsOnMain to be true.
Declaration
protected virtual QueryableExecuter<TPivot> GetPivotCreationQuery(IEnumerable<TMain> mainItems)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TMain> | mainItems |
Returns
Type | Description |
---|---|
QueryableExecuter<TPivot> | The pivot intial query to return all entities of type |
GetPivotCurrentQuery(IEnumerable<TMain>)
Returns the GetPivotCreationQuery(IEnumerable<TMain>) for this entity type, with the AlterPivotQuery(QueryableExecuter<TPivot>, IEnumerable<TMain>)
Declaration
public QueryableExecuter<TPivot> GetPivotCurrentQuery(IEnumerable<TMain> mainItems)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TMain> | mainItems |
Returns
Type | Description |
---|---|
QueryableExecuter<TPivot> | The GetPivotCreationQuery(IEnumerable<TMain>) for this entity type, with the AlterPivotQuery(QueryableExecuter<TPivot>, IEnumerable<TMain>) |
GetQueryForExcelResults()
The query for the results to export from this grid is the same as those to display the items -> GetMainCurrentQuery()
This is achieved if the TMain
has the appropriate
EntityHasPivotAttribute associated with it
Declaration
public override QueryableExecuter GetQueryForExcelResults()
Returns
Type | Description |
---|---|
QueryableExecuter | The query for the results to export from this grid is the same as those to display the items -> GetMainCurrentQuery() |
Overrides
LoadAdditionalColumns()
Loads the columns required for the pivot properties on the wrapper
Declaration
protected override Task LoadAdditionalColumns()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
LoadPivotColumnHeaders()
Loads the list of entities that should be the headers of the pivot columns for each extra column in the grid
represented as an indexed property on TWrapper
Declaration
protected abstract Task<IEnumerable<IBaseEntity>> LoadPivotColumnHeaders()
Returns
Type | Description |
---|---|
Task<IEnumerable<IBaseEntity>> | The list of entities that should be the headers of the pivot columns for each extra column in the grid
represented as an indexed property on |
PivotColumns(short)
Loads all the pivot columns to be added to the columns displayed against the IBaseGridWrapperCollection<TWrapper, TMain, TPivot>
Declaration
protected override IEnumerable<ControlDisplayInfo> PivotColumns(short index)
Parameters
Type | Name | Description |
---|---|---|
short | index | The index of all the columns added to the grid so far |
Returns
Type | Description |
---|---|
IEnumerable<ControlDisplayInfo> | All the pivot columns to be added to the columns displayed against the IBaseGridWrapperCollection<TWrapper, TMain, TPivot> |