Table of Contents

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

dynamicStructureIds IEnumerable<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

dynamicStructureIds IEnumerable<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

dynamicStructureId Guid

The id of the dynamic structure to delete.

Delete(string)

Deletes a dynamic structure along with its levels.

public virtual void Delete(string dynamicStructureId)

Parameters

dynamicStructureId string

The 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

dynamicStructureId string

The id of the dynamic structure holding the level.

levelId int

The 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

dynamicStructureId string

The 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

dynamicStructureId Guid

The id of the dynamic structure.

Returns

DynamicStructure

The dynamic structure, or null when no structure has that id.

GetById(string)

Gets a dynamic structure by its id.

public virtual DynamicStructure? GetById(string dynamicStructureId)

Parameters

dynamicStructureId string

The id of the dynamic structure, in any format TryParse(string, out Guid) accepts.

Returns

DynamicStructure

The dynamic structure, or null when 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

dynamicStructure DynamicStructure

The dynamic structure holding the levels.

scope DynamicStructureLevelScope

The 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

scope DynamicStructureLevelScope

The 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

dynamicStructureLevels List<DynamicStructureLevel>

The levels of the structure, in any order.

values List<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

dynamicStructure DynamicStructure

The dynamic structure holding the levels.

structureScope DynamicStructureLevelScope

The 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

dynamicStructure DynamicStructure

The dynamic structure to persist.

Exceptions

ArgumentNullException

dynamicStructure is null.

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

dynamicStructures IEnumerable<DynamicStructure>

The dynamic structures to update. Nothing is updated when this is null.

sourceField string

The source field to find. Nothing is updated when this is empty.

newSourceField string

The 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)

Parameters

sourceField string

The source field to find.

newSourceField string

The source field to replace it with.

To top