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
idstringThe resource identifier.
propertiesIReadOnlyDictionary<string, JsonElement>The properties.
representationsIReadOnlyList<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
InvalidIdCharsExpression
Gets a regular expression to find invalid characters in a resource identifier.
public static Regex InvalidIdCharsExpression { get; }
Property Value
InvalidIdStartCharsExpression
Gets a regular expression to find invalid start characters in a resource identifier.
public static Regex InvalidIdStartCharsExpression { get; }
Property Value
Properties
Gets the properties.
public IReadOnlyDictionary<string, JsonElement>? Properties { get; init; }
Property Value
Representations
Gets the list of representations.
public IReadOnlyList<Representation>? Representations { get; init; }
Property Value
ValidIdExpression
[GeneratedRegex("^[a-zA-Z_][a-zA-Z_0-9]*$")]
public static Regex ValidIdExpression { get; }
Property Value
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.