Class Udi
Represents an entity identifier.
Inheritance
Namespace: Umbraco.Cms.Core
Assembly: Umbraco.Core.dll
Syntax
[TypeConverter(typeof(UdiTypeConverter))]
public abstract class Udi
Remarks
An Udi can be fully qualified or "closed" eg umb://document/{guid} or "open" eg umb://document.
Constructors
View SourceUdi(string, string)
Initializes a new instance of the Udi class.
Declaration
protected Udi(string entityType, string stringValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entityType | The entity type part of the identifier. |
| string | stringValue | The string value of the identifier. |
Udi(Uri)
Initializes a new instance of the Udi class.
Declaration
protected Udi(Uri uriValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uriValue | The uri value of the identifier. |
Properties
View SourceEntityType
Gets the entity type part of the identifier.
Declaration
public string EntityType { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsRoot
Gets a value indicating whether this Udi is a root Udi.
Declaration
public abstract bool IsRoot { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
A root Udi points to the "root of all things" for a given entity type, e.g. the content tree root.
UriValue
Declaration
public Uri UriValue { get; }
Property Value
| Type | Description |
|---|---|
| Uri |
Methods
View SourceCompareTo(Udi?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Declaration
public int CompareTo(Udi? other)
Parameters
| Type | Name | Description |
|---|---|---|
| Udi | other | An object to compare with this instance. |
Returns
| Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| int | A value that indicates the relative order of the objects being compared. The return value has these meanings:
|
Create(string)
Creates a root Udi for an entity type.
Declaration
public static Udi Create(string entityType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entityType | The entity type. |
Returns
| Type | Description |
|---|---|
| Udi | The root Udi for the entity type. |
Create(string?, Guid)
Creates a Guid Udi.
Declaration
public static Udi Create(string? entityType, Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entityType | The entity type. |
| Guid | id | The identifier. |
Returns
| Type | Description |
|---|---|
| Udi | The Guid Udi for the entity type and identifier. |
Create(string, string)
Creates a string Udi.
Declaration
public static Udi Create(string entityType, string id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entityType | The entity type. |
| string | id | The identifier. |
Returns
| Type | Description |
|---|---|
| Udi | The string Udi for the entity type and identifier. |
Create(Uri)
Declaration
public static Udi Create(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri |
Returns
| Type | Description |
|---|---|
| Udi |
EnsureNotRoot()
Ensures that this Udi is not a root Udi.
Declaration
public Udi EnsureNotRoot()
Returns
| Type | Description |
|---|---|
| Udi | This Udi. |
Exceptions
| Type | Condition |
|---|---|
| Exception | When this Udi is a Root Udi. |
EnsureType(params string[])
Declaration
public void EnsureType(params string[] validTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | validTypes |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string that represents the current object. |
Operators
View Sourceoperator ==(Udi?, Udi?)
Declaration
public static bool operator ==(Udi? udi1, Udi? udi2)
Parameters
| Type | Name | Description |
|---|---|---|
| Udi | udi1 | |
| Udi | udi2 |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(Udi?, Udi?)
Declaration
public static bool operator !=(Udi? udi1, Udi? udi2)
Parameters
| Type | Name | Description |
|---|---|---|
| Udi | udi1 | |
| Udi | udi2 |
Returns
| Type | Description |
|---|---|
| bool |