Table of Contents

Class Resource

Namespace
Nexus.DataModel
Assembly
Nexus.Extensibility.dll

A resource is part of a resource catalog and holds a list of representations.

public record Resource : IEquatable<Resource>
Inheritance
Resource
Implements
Inherited Members

Constructors

Resource(string, IReadOnlyDictionary<string, JsonElement>?, IReadOnlyList<Representation>?)

Initializes a new instance of the Resource.

public Resource(string id, IReadOnlyDictionary<string, JsonElement>? properties = null, IReadOnlyList<Representation>? representations = null)

Parameters

id string

The resource identifier.

properties IReadOnlyDictionary<string, JsonElement>

The properties.

representations IReadOnlyList<Representation>

The list of representations.

Exceptions

ArgumentException

Thrown when the resource identifier is not valid.

Properties

Id

Gets the identifier.

public string Id { get; init; }

Property Value

string

InvalidIdCharsExpression

Gets a regular expression to find invalid characters in a resource identifier.

public static Regex InvalidIdCharsExpression { get; }

Property Value

Regex

InvalidIdStartCharsExpression

Gets a regular expression to find invalid start characters in a resource identifier.

public static Regex InvalidIdStartCharsExpression { get; }

Property Value

Regex

Properties

Gets the properties.

public IReadOnlyDictionary<string, JsonElement>? Properties { get; init; }

Property Value

IReadOnlyDictionary<string, JsonElement>

Representations

Gets the list of representations.

public IReadOnlyList<Representation>? Representations { get; init; }

Property Value

IReadOnlyList<Representation>

ValidIdExpression

[GeneratedRegex("^[a-zA-Z_][a-zA-Z_0-9]*$")]
public static Regex ValidIdExpression { get; }

Property Value

Regex

Remarks

Pattern:

^[a-zA-Z_][a-zA-Z_0-9]*$

Explanation:
○ Match if at the beginning of the string.
○ Match a character in the set [A-Z_a-z].
○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.
○ Match if at the end of the string or if before an ending newline.