Class BaseGridRelatedCollectionController<TSingleItem, TCollection>
The base generic grid controller which works with the IBaseGridRelatedCollection<TParentSingleItem, TCollection> view and displays an entity type as rows in the grid that are all related to an other entity
This is the main base controller for creating grids, and dynamically creating their columns, for any entity in
the system that is related to another entity. It is different from
BaseGridRelatedAnyCollectionController<TSingleItem, TCollection> as that can display any object, and
BaseGridControllerAny<T> as that can have multiple different types of parent it is related to
where as this must be of type TSingleItem
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Views.Core
Assembly: LemonEdge.ClientCore.dll
Syntax
public abstract class BaseGridRelatedCollectionController<TSingleItem, TCollection> : BaseGridController<TCollection>, IBaseGridController, ICollectionExportable, INewGridItemImplementor<TCollection>, ICopyGridItemImplementor<TCollection>, IGrid, IDeleteGridItemImplementor<TCollection>, ISearchController, IModelViewController where TSingleItem : IBaseEntity where TCollection : IBaseEntity
Type Parameters
Name | Description |
---|---|
TSingleItem | An entity type inheriting from IBaseEntity |
TCollection | An entity type that are all related to the SingleItem in the query |
Constructors
BaseGridRelatedCollectionController(IBaseGridRelatedCollection<TSingleItem, TCollection>)
Creates a new BaseGridRelatedCollectionController with the specified instance of a default grid related collection view
Declaration
public BaseGridRelatedCollectionController(IBaseGridRelatedCollection<TSingleItem, TCollection> view)
Parameters
Type | Name | Description |
---|---|---|
IBaseGridRelatedCollection<TSingleItem, TCollection> | view | The instance of the default grid related collection view in the client application |
Properties
AllowIDFilter
Indicates this grids results are not filtered by any DisplayableItemDescriptorForCollectionParams, as it is not a top level collection of items
Declaration
protected override bool AllowIDFilter { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
AllowNewEntityFromLookupColumn
Declaration
public virtual bool AllowNewEntityFromLookupColumn { get; }
Property Value
Type | Description |
---|---|
bool |
CollectionRelationshipColumnName
This is the property on the TCollection
entities that holds a relationship value that points to the
SingleItem type
This controller will automatically use that to filter the correct entities for the grid in AlterQuery(QueryableExecuter<TCollection>)
Declaration
public abstract string CollectionRelationshipColumnName { get; }
Property Value
Type | Description |
---|---|
string |
PopulateNewFromLookupColumnName
Returns OpenFromRelatedColumnName
Declaration
public override string PopulateNewFromLookupColumnName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
SingleItem
The single item this grid is being displayed against and that all entities of type TCollection
in the
grid are related to
Declaration
public TSingleItem SingleItem { get; }
Property Value
Type | Description |
---|---|
TSingleItem |
Methods
AddRelationshipJoin(QueryableExecuter<TCollection>)
Alters the provided query by ensuring all entities returned are related to the SingleItem by having their CollectionRelationshipColumnName have the same value as the SingleItem ID
This can be overidden to customise how the entities of type TCollection
are precisely related to
the SingleItem if not directly through that join
Declaration
protected virtual QueryableExecuter<TCollection> AddRelationshipJoin(QueryableExecuter<TCollection> query)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<TCollection> | query | The existing query to return all the results that will populate the grid |
Returns
Type | Description |
---|---|
QueryableExecuter<TCollection> | An altered query that also ensures all entities returned are related to the SingleItem by having their CollectionRelationshipColumnName have the same value as the SingleItem ID |
AlterQuery(QueryableExecuter<TCollection>)
Additionally alters the base query alteration by ensuring all entities returned are related to the SingleItem by having their CollectionRelationshipColumnName have the same value as the SingleItem ID
This is achieved via AddRelationshipJoin(QueryableExecuter<TCollection>) which can be overidden to
customise how the entities of type TCollection
are precisely related to the
SingleItem if not directly through that join
Declaration
protected override QueryableExecuter<TCollection> AlterQuery(QueryableExecuter<TCollection> query)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<TCollection> | query | The existing query to return all the results that will populate the grid |
Returns
Type | Description |
---|---|
QueryableExecuter<TCollection> | An altered query that also ensures all entities returned are related to the SingleItem by having their CollectionRelationshipColumnName have the same value as the SingleItem ID |
Overrides
GetNewEntityFromLookupCommand()
Declaration
public virtual ViewCommand GetNewEntityFromLookupCommand()
Returns
Type | Description |
---|---|
ViewCommand |
InitCommands(IList<ViewCommand>)
Adds the following commands, if the associated AllowXXXCommand property returns true: A public toggle, multi-select row, open, column visiblitiy, transfer visible, search, view cancelled, view system, export, new, copy, move up/down, xml export, and delete commands
Declaration
protected override void InitCommands(IList<ViewCommand> commands)
Parameters
Type | Name | Description |
---|---|---|
IList<ViewCommand> | commands | The initial set of commands for this view |
Overrides
UpdateNewItem(TCollection)
Updates any new item created in this grid to also have the CollectionRelationshipColumnName property hold the value of the SingleItem ID
Declaration
protected override Task UpdateNewItem(TCollection item)
Parameters
Type | Name | Description |
---|---|---|
TCollection | item | The new item created for this grid |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |