Class MetadataAttribute
The MetadataAttribute is used to decoreate a property that should be populated with a metadata value. The attribute is used to describe the MetadataDefinition that it should represent.
Inheritance
Implements
Inherited Members
Namespace: ImageVault.Client.Descriptors
Assembly: ImageVault.Client.dll
Syntax
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class MetadataAttribute : Attribute, _Attribute
Remarks
The type of the decorated propery (int, string, DateTime) should be of the same type as the expected value of the MetadataDefinition (MetadataInteger, MetadataString, MetadataDateTime etc.). If a value cannot be converted to the target type, a runtime error will occur when populating the metadata.
2011-09-05 dan: Created
Examples
You can match a MetadataDefinition by id, name or name and type.
[Metadata(Id=3)]
public string Title {get;set;}
[Metadata(Name="Description")
public string Description {get;set;}
[Metadata(Name="Photographer",Type=MetadataDefinitionTypes.Iptc)]
public string Photographer {get;set;}
Constructors
MetadataAttribute()
Initializes a new instance of the MetadataAttribute class.
Declaration
public MetadataAttribute()
MetadataAttribute(Int32)
Initializes a new instance of the MetadataAttribute class.
Declaration
public MetadataAttribute(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The id of the MetadataDefintion that the attribute should match |
MetadataAttribute(String, MetadataDefinitionTypes)
Initializes a new instance of the MetadataAttribute class.
Declaration
public MetadataAttribute(string name, MetadataDefinitionTypes type = MetadataDefinitionTypes.User)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the MetadataDefintion that we should match |
MetadataDefinitionTypes | type | The MetadataDefinitionTypes of the definition to match. If omitted, User will be used. |
Properties
Id
Get/Sets the Id of the MetadataAttribute
Declaration
public int Id { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The id of the metadata definition to get |
IsAltText
Get/Sets the IsAltText of the MetadataAttribute TODO:remove
Declaration
public bool IsAltText { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTitle
Get/Sets the IsTitle of the MetadataAttribute TODO:remove
Declaration
public bool IsTitle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Get/sets the name of the medatata definition to map
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the medatata definition to map |
Type
Get/Sets the Type of the MetadataAttribute
Declaration
public MetadataDefinitionTypes Type { get; set; }
Property Value
Type | Description |
---|---|
MetadataDefinitionTypes | The MetadataDefinitionTypes of metadata definition. Default is User. |