Interface IMetadataOf
A provider for metadata for something. So if an IEntity or an App has metadata, this will provide it.
[PublicApi]
public interface IMetadataOf : IEnumerable<IEntity>, IEnumerable, IHasPermissions
- Inherited Members
Remarks
You can either loop through this object (since it's an IEnumerable
) or ask for values of the metadata,
no matter on what sub-entity the value is stored on.
Properties
Target
The identifier which was used to retrieve the Metadata. It can be used as an address for creating further Metadata for the same target.
ITarget Target { get; }
Property Value
- ITarget
Remarks
Added in v13
Methods
GetBestValue<TVal>(string, string)
Get the best matching value in ALL the metadata items.
TVal GetBestValue<TVal>(string name, string typeName = null)
Parameters
name
stringattribute name we're looking for
typeName
stringoptional type-name, if provided, will only look at metadata of that type; otherwise (or if null) will look at all metadata items and pick first match
Returns
- TVal
A typed value.
Type Parameters
TVal
expected type, like string, int etc.
GetBestValue<TVal>(string, string[])
Get the best matching value in the metadata items.
TVal GetBestValue<TVal>(string name, string[] typeNames)
Parameters
name
stringattribute name we're looking for
typeNames
string[]list of type-name in the order to check. if one of the values is null, it will then check all items no matter what type
Returns
- TVal
A typed value.
Type Parameters
TVal
expected type, like string, int etc.
HasType(string)
Determine if something has metadata of the specified type
bool HasType(string typeName)
Parameters
typeName
stringType Name
Returns
- bool
True if there is at least one item of this type
Remarks
Added in v13
OfType(string)
Get all Metadata items of a specific type
IEnumerable<IEntity> OfType(string typeName)
Parameters
typeName
stringType Name
Returns
Remarks
Added in v13