Class SetItemInfo
A helper class used for holding all the information for importing/exporting a LemonEdge entity and all its related child items
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Core
Assembly: API.dll
Syntax
[DataContract(IsReference = true)]
public class SetItemInfo : ISetItemInfo
Constructors
SetItemInfo(IEnumerable<ISetItemInfo>)
Creates a new SetItemInfo that holds the specified collection of items as children
Declaration
public SetItemInfo(IEnumerable<ISetItemInfo> children)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISetItemInfo> | children | The items to be children of this SetItemInfo |
Properties
Children
A list of all the child items of this SetItemInfo
Declaration
public List<SetItemInfo> Children { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<SetItemInfo> |
CopiedEntity
During importing, this holds a new item that has been created as a copy of the SourceEntity with all the relevant relationships/etc updated accordingly
Declaration
public IBaseEntity CopiedEntity { get; set; }
Property Value
Type | Description |
---|---|
IBaseEntity |
Remarks
For instance if this SourceEntity references child items then the CopiedEntity would have those references updated to point to the new CopiedEntity for those child items rather than the original
GetAllItems
Returns all items, including this one itself, in the tree through all child items
Declaration
public IEnumerable<SetItemInfo> GetAllItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<SetItemInfo> |
InvalidRelationships
During importing, a list of relationships that can't be linked to as they don't exist in this database
Declaration
public IEnumerable<EntityRelationship> InvalidRelationships { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EntityRelationship> |
InvalidVersion
Indicates this SetItemInfo can't be imported as it has a version lower than the one currently in the system
Declaration
public bool InvalidVersion { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
InvalidVersionEntity
During importing, this holds the item that has an invalid version and can't be imported as the current item has a higher version number
Declaration
public IBaseEntity InvalidVersionEntity { get; set; }
Property Value
Type | Description |
---|---|
IBaseEntity |
Root
The top most item we are importing, or the root record, that holds all the children records that we are also that importing
Declaration
public SetItemInfo Root { get; }
Property Value
Type | Description |
---|---|
SetItemInfo |
RootSetItem
A root item we are importing which has child records. This may not be the root of the tree, if multiple items are being imported or if the root item has sub items that are importable themselves (like a query with sub-queries in it) we need to get hold of these sub-root records to know if they themselves are being imported as new, or updating an existing record i.e. a query may be being imported as new, but a sub-query it contains may just be being updated
Declaration
public SetItemInfo RootSetItem { get; }
Property Value
Type | Description |
---|---|
SetItemInfo |
SourceEntity
The source LemonEdge entity this SetItemInfo holds a definition of for copying
Declaration
[DataMember]
public IBaseEntity SourceEntity { get; set; }
Property Value
Type | Description |
---|---|
IBaseEntity |
Methods
GetCopyInfo(IEntityUpdater, IBaseEntity)
Creates a SetItemInfo for the specified item. Will navigate all related items to this entity that should be included in a Set and create an ISetItemInfo for them too.
Declaration
public static Task<ISetItemInfo> GetCopyInfo(IEntityUpdater host, IBaseEntity item)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdater | host | The host context to load related items with |
IBaseEntity | item | The item to wrap in an ISetItemInfo |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ISetItemInfo> | SetItemInfo for the specified item. Will navigate all related items to this entity that should be included in a Set and create an ISetItemInfo for them too. |
Remarks
Related items that are included come from the EntityRelationship attribute.
Marking a property relationship as PartOfParentSet would mean an item with that property pointing to this item would be included in this SetItemInfo as a child item
Any property on this item itself with a relationship marked as LinkToItemInSet would include the refernced item in this SetItemInfo as a chil item
Explicit Interface Implementations
ISetItemInfo.GetAllItems
Declaration
IEnumerable<ISetItemInfo> ISetItemInfo.GetAllItems { get; }
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISetItemInfo> |
ISetItemInfo.Import(IEntityUpdater, UserInfo, IReadOnlyCache, Boolean)
Imports all items defined in this SetItemInfo into the specified host
context
Declaration
Task ISetItemInfo.Import(IEntityUpdater host, UserInfo user, IReadOnlyCache cache, bool forceNewItem)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdater | host | The host context to import all items defined in this SetItemInfo into |
UserInfo | user | The user performing this import routine, and thus the permissions they have will be used |
IReadOnlyCache | cache | A local cache |
System.Boolean | forceNewItem | Indicates regardless of any current matching item, this will force the creation of a new item when importing this definition |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The task indicating when this operation is complete |