Interface IMetadataOf
A provider for metadata for something. So if an IEntity or an App has metadata, this will provide it.
Namespace: ToSic.Eav.Metadata
Assembly: ToSic.Eav.Core.dll
Syntax
[PublicApi_Stable_ForUseInYourCode]
public interface IMetadataOf : IEnumerable<IEntity>, IEnumerable, IHasPermissions
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
| Improve this Doc View SourceTarget
The identifier which was used to retrieve the Metadata. It can be used as an address for creating further Metadata for the same target.
Declaration
ITarget Target { get; }
Property Value
Type | Description |
---|---|
ITarget |
Remarks
Added in v13
Methods
| Improve this Doc View SourceGetBestValue<TVal>(string, string)
Get the best matching value in ALL the metadata items.
Declaration
TVal GetBestValue<TVal>(string name, string typeName = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | attribute name we're looking for |
string | typeName | optional 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
Type | Description |
---|---|
TVal | A typed value. |
Type Parameters
Name | Description |
---|---|
TVal | expected type, like string, int etc. |
GetBestValue<TVal>(string, string[])
Get the best matching value in the metadata items.
Declaration
TVal GetBestValue<TVal>(string name, string[] typeNames)
Parameters
Type | Name | Description |
---|---|---|
string | name | attribute name we're looking for |
string[] | typeNames | 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
Type | Description |
---|---|
TVal | A typed value. |
Type Parameters
Name | Description |
---|---|
TVal | expected type, like string, int etc. |
HasType(string)
Determine if something has metadata of the specified type
Declaration
bool HasType(string typeName)
Parameters
Type | Name | Description |
---|---|---|
string | typeName | Type Name |
Returns
Type | Description |
---|---|
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
Declaration
IEnumerable<IEntity> OfType(string typeName)
Parameters
Type | Name | Description |
---|---|---|
string | typeName | Type Name |
Returns
Type | Description |
---|---|
IEnumerable<IEntity> |
Remarks
Added in v13