Search Results for

    Show / Hide Table of Contents
    View Source

    Class Udi

    Represents an entity identifier.

    Inheritance
    object
    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 Source

    Udi(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.

    View Source

    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 Source

    EntityType

    Gets the entity type part of the identifier.

    Declaration
    public string EntityType { get; }
    Property Value
    Type Description
    string
    View Source

    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.

    View Source

    UriValue

    Gets the URI representation of this Udi.

    Declaration
    public Uri UriValue { get; }
    Property Value
    Type Description
    Uri

    Methods

    View Source

    CompareTo(Udi?)

    Declaration
    public int CompareTo(Udi? other)
    Parameters
    Type Name Description
    Udi other
    Returns
    Type Description
    int
    View Source

    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.

    View Source

    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.

    View Source

    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.

    View Source

    Create(Uri)

    Creates a Udi from a URI.

    Declaration
    public static Udi Create(Uri uri)
    Parameters
    Type Name Description
    Uri uri

    The URI to create the Udi from.

    Returns
    Type Description
    Udi

    The Udi for the specified URI.

    Exceptions
    Type Condition
    ArgumentException

    The URI is not a valid Udi or the entity type is unknown.

    View Source

    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.

    View Source

    EnsureType(params string[])

    Ensures that this Udi is of one of the specified entity types.

    Declaration
    public void EnsureType(params string[] validTypes)
    Parameters
    Type Name Description
    string[] validTypes

    The valid entity types.

    Exceptions
    Type Condition
    Exception

    When the entity type is not one of the valid types.

    View Source

    Equals(object?)

    Declaration
    public override bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    Operators

    View Source

    operator ==(Udi?, Udi?)

    Determines whether two Udi instances are equal.

    Declaration
    public static bool operator ==(Udi? udi1, Udi? udi2)
    Parameters
    Type Name Description
    Udi udi1

    The first Udi to compare.

    Udi udi2

    The second Udi to compare.

    Returns
    Type Description
    bool

    true if the instances are equal; otherwise, false.

    View Source

    operator !=(Udi?, Udi?)

    Determines whether two Udi instances are not equal.

    Declaration
    public static bool operator !=(Udi? udi1, Udi? udi2)
    Parameters
    Type Name Description
    Udi udi1

    The first Udi to compare.

    Udi udi2

    The second Udi to compare.

    Returns
    Type Description
    bool

    true if the instances are not equal; otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX