Class DynamicStructureService
- Namespace
- Dynamicweb.Indexing.DynamicStructuring
- Assembly
- Dynamicweb.Core.dll
Queries and persists the dynamic structures that drive the product view hierarchy in PIM, and resolves the levels a structure offers below any given scope.
public class DynamicStructureService
- Inheritance
-
DynamicStructureService
- Inherited Members
Methods
ClearCache()
Drops every cached dynamic structure, so that the next read loads them all again.
public virtual void ClearCache()
Delete(IEnumerable<Guid>)
Deletes dynamic structures along with their levels.
public virtual void Delete(IEnumerable<Guid> dynamicStructureIds)
Parameters
dynamicStructureIdsIEnumerable<Guid>The ids of the dynamic structures to delete. Nothing is deleted when this is
null.
Delete(IEnumerable<string>)
Deletes dynamic structures along with their levels.
public virtual void Delete(IEnumerable<string> dynamicStructureIds)
Parameters
dynamicStructureIdsIEnumerable<string>The ids of the dynamic structures to delete. Nothing is deleted when this is
null.
Delete(Guid)
Deletes a dynamic structure along with its levels.
public virtual void Delete(Guid dynamicStructureId)
Parameters
dynamicStructureIdGuidThe id of the dynamic structure to delete.
Delete(string)
Deletes a dynamic structure along with its levels.
public virtual void Delete(string dynamicStructureId)
Parameters
dynamicStructureIdstringThe id of the dynamic structure to delete.
DeleteStructureLevel(string, int)
Deletes a single level of a dynamic structure.
public virtual void DeleteStructureLevel(string dynamicStructureId, int levelId)
Parameters
dynamicStructureIdstringThe id of the dynamic structure holding the level.
levelIdintThe id of the level to delete.
DeleteStructureLevels(string)
Deletes every level of a dynamic structure, leaving the structure itself in place.
public virtual void DeleteStructureLevels(string dynamicStructureId)
Parameters
dynamicStructureIdstringThe id of the dynamic structure whose levels are deleted.
GetAll()
Gets every dynamic structure.
public virtual IEnumerable<DynamicStructure> GetAll()
Returns
- IEnumerable<DynamicStructure>
All dynamic structures, in no particular order.
GetById(Guid)
Gets a dynamic structure by its id.
public virtual DynamicStructure? GetById(Guid dynamicStructureId)
Parameters
dynamicStructureIdGuidThe id of the dynamic structure.
Returns
- DynamicStructure
The dynamic structure, or
nullwhen no structure has that id.
GetById(string)
Gets a dynamic structure by its id.
public virtual DynamicStructure? GetById(string dynamicStructureId)
Parameters
dynamicStructureIdstringThe id of the dynamic structure, in any format TryParse(string, out Guid) accepts.
Returns
- DynamicStructure
The dynamic structure, or
nullwhen the id is not well-formed or no structure has it.
GetDynamicStructureChildLevels(DynamicStructure, DynamicStructureLevelScope)
Gets the levels available below the given scope, each carrying the number of results behind it.
public static IEnumerable<DynamicStructureLevel> GetDynamicStructureChildLevels(DynamicStructure dynamicStructure, DynamicStructureLevelScope scope)
Parameters
dynamicStructureDynamicStructureThe dynamic structure holding the levels.
scopeDynamicStructureLevelScopeThe level scope holding the values chosen for the levels above.
Returns
- IEnumerable<DynamicStructureLevel>
The child levels of the current scope, empty when the scope is already at the last level or the structure has no usable query.
GetDynamicStructureScopeParameters(DynamicStructureLevelScope)
Gets the query parameters that a level scope resolves to.
public virtual Dictionary<string, string> GetDynamicStructureScopeParameters(DynamicStructureLevelScope scope)
Parameters
scopeDynamicStructureLevelScopeThe level scope holding the values chosen for the levels above.
Returns
- Dictionary<string, string>
The source field of each level mapped to its chosen value, empty when the scope names no known structure.
GetDynamicStructureScopeParameters(List<DynamicStructureLevel>, List<string>)
Gets the query parameters that a set of level values resolves to.
public static Dictionary<string, string> GetDynamicStructureScopeParameters(List<DynamicStructureLevel> dynamicStructureLevels, List<string> values)
Parameters
dynamicStructureLevelsList<DynamicStructureLevel>The levels of the structure, in any order.
valuesList<string>The value chosen for each level, in level order.
Returns
- Dictionary<string, string>
The source field of each level mapped to its chosen value. Levels without a source field, and values beyond the last level, are skipped.
GetNoMatchLevel(DynamicStructure, DynamicStructureLevelScope)
Gets the level that collects the results with no value for the next level in the scope.
public static DynamicStructureLevel? GetNoMatchLevel(DynamicStructure dynamicStructure, DynamicStructureLevelScope structureScope)
Parameters
dynamicStructureDynamicStructureThe dynamic structure holding the levels.
structureScopeDynamicStructureLevelScopeThe level scope holding the values chosen for the levels above.
Returns
- DynamicStructureLevel
A 'No match' level when the scope has results with empty values, otherwise
null.
Save(DynamicStructure)
Inserts the dynamic structure when it is new, and updates it otherwise, along with its levels. A new structure gets its Id and AutoId assigned.
public virtual void Save(DynamicStructure dynamicStructure)
Parameters
dynamicStructureDynamicStructureThe dynamic structure to persist.
Exceptions
- ArgumentNullException
dynamicStructureisnull.
UpdateStructureLevelsSourceField(IEnumerable<DynamicStructure>, string, string)
Finds a source field in the levels of the given dynamic structures and replaces it with a new one. Every structure that changes is saved, and the index cache of its query is cleared.
public virtual void UpdateStructureLevelsSourceField(IEnumerable<DynamicStructure> dynamicStructures, string sourceField, string newSourceField)
Parameters
dynamicStructuresIEnumerable<DynamicStructure>The dynamic structures to update. Nothing is updated when this is
null.sourceFieldstringThe source field to find. Nothing is updated when this is empty.
newSourceFieldstringThe source field to replace it with. Nothing is updated when this is empty.
UpdateStructureLevelsSourceField(string, string)
Finds a source field in the levels of every dynamic structure and replaces it with a new one.
public virtual void UpdateStructureLevelsSourceField(string sourceField, string newSourceField)