Class BaseGridRelatedAnyCollectionController<TSingleItem, TCollection>
The base generic grid controller which works with the IBaseGridRelatedCollection<TParentSingleItem, TCollection> view and displays an object 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 object in
the system that is related to another entity. It is different from
BaseGridRelatedCollectionController<TSingleItem, TCollection> as that only displays entities, 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 BaseGridRelatedAnyCollectionController<TSingleItem, TCollection> : BaseGridControllerAny<TCollection>, IBaseGridController, ICollectionExportable, INewGridItemImplementor<TCollection>, ICopyGridItemImplementor<TCollection>, IGrid, IDeleteGridItemImplementor<TCollection>, ISearchController, IModelViewController where TSingleItem : IBaseEntity
Type Parameters
Name | Description |
---|---|
TSingleItem | An entity type inheriting from IBaseEntity |
TCollection | Any type that are all related to the SingleItem in the query |
Constructors
BaseGridRelatedAnyCollectionController(IBaseGridRelatedCollection<TSingleItem, TCollection>)
Creates a new BaseGridRelatedAnyCollectionController with the specified instance of a default grid related collection view
Declaration
protected BaseGridRelatedAnyCollectionController(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
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 overridden 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 |
AddRelationshipJoinSingleItem(QueryableExecuter<TSingleItem>)
Declaration
protected virtual QueryableExecuter<TSingleItem> AddRelationshipJoinSingleItem(QueryableExecuter<TSingleItem> query)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<TSingleItem> | query |
Returns
Type | Description |
---|---|
QueryableExecuter<TSingleItem> |
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
GetGridController(IBaseGridRelatedCollection<TSingleItem, TCollection>)
Creates the new default grid related view controller with the specified instance of a default grid related collection view
Either returns a BaseGridRelatedAnyCollectionController<TSingleItem, TCollection> or a BaseGridRelatedCollectionController<TSingleItem, TCollection>
Declaration
public static BaseGridControllerAny<TCollection> GetGridController(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 |
Returns
Type | Description |
---|---|
BaseGridControllerAny<TCollection> | A new default grid view related controller with the specified instance of a default grid related controller view |
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 |