Class UrlTreeBuilder
- Namespace
- Dynamicweb.Frontend.UrlHandling
- Assembly
- Dynamicweb.dll
UrlTreeBuilder is a helper class for bulding url tree structures.
Url nodes can be created with ID and ParentID structure using the Add(string, string, string, string, string, string, bool, bool) methods and when the object has been filled with data,
call the MakeTree(). After that call a tree of UrlNode is available from the RootNodes property.
public class UrlTreeBuilder
- Inheritance
-
UrlTreeBuilder
- Inherited Members
Properties
RootNodes
Gets the root nodes of the UrlNodes in the resulting tree. Only contains values after MakeTree() has been called.
public List<UrlNode> RootNodes { get; }
Property Value
Methods
Add(int, int, string, string, int, string, bool, bool)
Adds a UrlNode to the tree builder instance.
public void Add(int id, int parentId, string name, string queryStringParameter, int queryStringValue, string pathExact, bool ignoreInChildPath, bool ignoreParentPath)
Parameters
id
int- The Id of the item in the tree, i.e. "1" or "Group1".
parentId
int- The parentid of the item, i.e. "0" or "" if a rootnode or i.e. "2" for nodes that has a parent.
name
string- The name of the item, i.e. the name of the page, product or group. Used for this elements name in the resulting URL path.
queryStringParameter
string- The query string parameter for this node, i.e. "ID" or "GroupID".
queryStringValue
int- The query string value for this node, i.e. "1" for a page or "Group1" for a group.
pathExact
string- The exact path for this node if needed - overwrites the auto generated path to this item with a specific value, i.e. "/MyProduct" instead of "/Products/TheGroup/MyProduct".
ignoreInChildPath
bool- if set to
true
this items name is not part of children urlnode paths. ignoreParentPath
bool- if set to
true
this item will not include the parent path structure for its path.
Add(int, int, string, string, string, string, bool, bool)
Adds a UrlNode to the tree builder instance.
public void Add(int id, int parentId, string name, string queryStringParameter, string queryStringValue, string pathExact, bool ignoreInChildPath, bool ignoreParentPath)
Parameters
id
int- The Id of the item in the tree, i.e. "1" or "Group1".
parentId
int- The parentid of the item, i.e. "0" or "" if a rootnode or i.e. "2" for nodes that has a parent.
name
string- The name of the item, i.e. the name of the page, product or group. Used for this elements name in the resulting URL path.
queryStringParameter
string- The query string parameter for this node, i.e. "ID" or "GroupID".
queryStringValue
string- The query string value for this node, i.e. "1" for a page or "Group1" for a group.
pathExact
string- The exact path for this node if needed - overwrites the auto generated path to this item with a specific value, i.e. "/MyProduct" instead of "/Products/TheGroup/MyProduct".
ignoreInChildPath
bool- if set to
true
this items name is not part of children urlnode paths. ignoreParentPath
bool- if set to
true
this item will not include the parent path structure for its path.
Add(string, string, string, string, string, string, bool, bool)
Adds a UrlNode to the tree builder instance.
public void Add(string id, string parentId, string name, string queryStringParameter, string queryStringValue, string pathExact, bool ignoreInChildPath, bool ignoreParentPath)
Parameters
id
string- The Id of the item in the tree, i.e. "1" or "Group1".
parentId
string- The parentid of the item, i.e. "0" or "" if a rootnode or i.e. "2" for nodes that has a parent.
name
string- The name of the item, i.e. the name of the page, product or group. Used for this elements name in the resulting URL path.
queryStringParameter
string- The query string parameter for this node, i.e. "ID" or "GroupID".
queryStringValue
string- The query string value for this node, i.e. "1" for a page or "Group1" for a group.
pathExact
string- The exact path for this node if needed - overwrites the auto generated path to this item with a specific value, i.e. "/MyProduct" instead of "/Products/TheGroup/MyProduct".
ignoreInChildPath
bool- if set to
true
this items name is not part of children urlnode paths. ignoreParentPath
bool- if set to
true
this item will not include the parent path structure for its path.
Add(string, string, string, string, string, string, bool, bool, string, bool)
[Obsolete("Use AddNode instead.")]
public void Add(string id, string parentId, string name, string queryStringParameter, string queryStringValue, string pathExact, bool ignoreInChildPath, bool ignoreParentPath, string queryStringExact, bool ignoreParentQuerystring)
Parameters
id
stringparentId
stringname
stringqueryStringParameter
stringqueryStringValue
stringpathExact
stringignoreInChildPath
boolignoreParentPath
boolqueryStringExact
stringignoreParentQuerystring
bool
AddNode(UrlDataNode)
public void AddNode(UrlDataNode nodeData)
Parameters
nodeData
UrlDataNode
AddNode(string, string, string, string, string, string, bool, bool, string, bool)
Adds a UrlNode to the tree builder instance.
public void AddNode(string id, string parentId, string name, string queryStringParameter, string queryStringValue, string pathExact, bool ignoreInChildPath, bool ignoreParentPath, string queryStringExact, bool ignoreParentQueryString)
Parameters
id
string- The Id of the item in the tree, i.e. "1" or "Group1".
parentId
string- The parentid of the item, i.e. "0" or "" if a rootnode or i.e. "2" for nodes that has a parent.
name
string- The name of the item, i.e. the name of the page, product or group. Used for this elements name in the resulting URL path.
queryStringParameter
string- The query string parameter for this node, i.e. "ID" or "GroupID".
queryStringValue
string- The query string value for this node, i.e. "1" for a page or "Group1" for a group.
pathExact
string- The exact path for this node if needed - overwrites the auto generated path to this item with a specific value, i.e. "/MyProduct" instead of "/Products/TheGroup/MyProduct".
ignoreInChildPath
bool- if set to
true
this items name is not part of children urlnode paths. ignoreParentPath
bool- if set to
true
this item will not include the parent path structure for its path. queryStringExact
string- The exact querystring - to override the automatic generated querystring.
ignoreParentQueryString
bool- if set to
true
the querystring elements of the parent nodes are ignored. I.e. True for pages, but false for products since they also need their Groups querystring and value.
Exceptions
AddNode(string, string, string, string, string, string, bool, bool, string, bool, bool)
Adds a UrlNode to the tree builder instance.
public void AddNode(string id, string parentId, string name, string queryStringParameter, string queryStringValue, string pathExact, bool ignoreInChildPath, bool ignoreParentPath, string queryStringExact, bool ignoreParentQueryString, bool IncludeInSitemapXml)
Parameters
id
string- The Id of the item in the tree, i.e. "1" or "Group1".
parentId
string- The parentid of the item, i.e. "0" or "" if a rootnode or i.e. "2" for nodes that has a parent.
name
string- The name of the item, i.e. the name of the page, product or group. Used for this elements name in the resulting URL path.
queryStringParameter
string- The query string parameter for this node, i.e. "ID" or "GroupID".
queryStringValue
string- The query string value for this node, i.e. "1" for a page or "Group1" for a group.
pathExact
string- The exact path for this node if needed - overwrites the auto generated path to this item with a specific value, i.e. "/MyProduct" instead of "/Products/TheGroup/MyProduct".
ignoreInChildPath
bool- if set to
true
this items name is not part of children urlnode paths. ignoreParentPath
bool- if set to
true
this item will not include the parent path structure for its path. queryStringExact
string- The exact querystring - to override the automatic generated querystring.
ignoreParentQueryString
bool- if set to
true
the querystring elements of the parent nodes are ignored. I.e. True for pages, but false for products since they also need their Groups querystring and value. IncludeInSitemapXml
bool- if set to
true
the node will be included in sitemap xml, otherwise ignored. Children will still be included
Exceptions
MakeTree()
Makes the tree structure based on the IDs and ParentIds and adds the rootnodes to the RootNodes properties
public void MakeTree()