Class UniqueValueGenerator
Generates values for fields that needs to be unique.
Inheritance
System.Object
UniqueValueGenerator
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Catalog.Data
Assembly: Mediachase.Commerce.dll
Version: 12.17.2Syntax
public class UniqueValueGenerator
Constructors
UniqueValueGenerator(ICatalogSystem, IUrlSegmentGenerator)
Initializes a new instance of the UniqueValueGenerator class.
Declaration
public UniqueValueGenerator(ICatalogSystem catalogContext, IUrlSegmentGenerator urlSegmentGenerator)
Parameters
Type | Name | Description |
---|---|---|
ICatalogSystem | catalogContext | The catalog context. |
EPiServer.Web.IUrlSegmentGenerator | urlSegmentGenerator | The URL segment generator. |
Methods
GenerateCode(String)
Generates a unique code for the specified name
.
Declaration
public virtual string GenerateCode(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
Returns
Type | Description |
---|---|
System.String |
GenerateSeoUri(String, String, Func<String, Boolean>)
Generates a unique seo URI based on the specified name
and languageCode
.
Declaration
[Obsolete("In order to improve the performance when saving Entry/Node, we have introduced the UniqueSeoGenerator, which generates Uri and Uri segment, and guarantees uniqueness. So use, overwrite UniqueSeoGenerator instead. This method will be removed in version 10.")]
public virtual string GenerateSeoUri(string name, string languageCode, Func<string, bool> additionalValidator)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.String | languageCode | The language code. |
System.Func<System.String, System.Boolean> | additionalValidator | If non null, the result will be validated with the function. |
Returns
Type | Description |
---|---|
System.String |
SuggestSeoUri(String, String, Int32, String)
Suggests an URL that will be validated for uniqueness.
Declaration
[Obsolete("In order to improve the performance when saving Entry/Node, we have introduced the UniqueSeoGenerator, which generates Uri and Uri segment, and guarantees uniqueness. So use, overwrite UniqueSeoGenerator instead. This method will be removed in version 10.")]
protected virtual string SuggestSeoUri(string name, string languageCode, int index, string duplicateUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name that can be used to create the url. |
System.String | languageCode | The language code. |
System.Int32 | index | A number that will be incremented for each validation. |
System.String | duplicateUrl | The previously validated uri that is confirmed to be a duplicate. Will be null on the first iteration. |
Returns
Type | Description |
---|---|
System.String |