Table of Contents

Class Item

Namespace
Dynamicweb.Content.Items
Assembly
Dynamicweb.dll

Represents an item whose fields can be dynamically added and removed at run time. This class cannot be inherited.

public sealed class Item : ItemEntry, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
Inheritance
Item
Implements
Inherited Members
Extension Methods

Remarks

For implementing your own item types, use ItemEntry as a base type.

Constructors

Item()

Initializes a new instance of an object.

public Item()

Item(ItemEntry)

Initializes a new instance of an object.

public Item(ItemEntry item)

Parameters

item ItemEntry

Item whose data is used to fill this object with.

Item(IDictionary<string, object>)

Initializes a new instance of an object.

public Item(IDictionary<string, object> fields)

Parameters

fields IDictionary<string, object>

Fields to fill this object with.

Item(DataRow)

Initializes a new instance of an object.

public Item(DataRow row)

Parameters

row DataRow

A data row to reader fields from.

Item(IDataReader)

Initializes a new instance of an object.

public Item(IDataReader reader)

Parameters

reader IDataReader

A data reader to read fields from.

Item(string)

Initializes a new instance of an object.

public Item(string systemName)

Parameters

systemName string

Item system name.

Item(string, string)

Initializes a new instance of an object.

public Item(string systemName, string id)

Parameters

systemName string

Item system name.

id string

Item Id.

Fields

SortColumnName

public const string SortColumnName = "Sort"

Field Value

string

Properties

Count

Gets the total number of fields within the given item.

public int Count { get; }

Property Value

int

Id

Gets or sets the item Id.

public override string Id { get; set; }

Property Value

string

IsReadOnly

Gets value indicating whether this item is read-only and no more fields can be added or removed.

public bool IsReadOnly { get; }

Property Value

bool

this[string]

Gets or sets the field with the given name.

public object this[string key] { get; set; }

Parameters

key string

Field name.

Property Value

object

Field value.

Names

Gets all field names.

public ICollection<string> Names { get; }

Property Value

ICollection<string>

Sort

Gets or sets the number indicating the position of the item within a list of items.

public override int Sort { get; set; }

Property Value

int

SystemName

Gets or sets the system name of the associated item type.

public string SystemName { get; set; }

Property Value

string

Values

Gets all field values.

public ICollection<object> Values { get; }

Property Value

ICollection<object>

Methods

Add(KeyValuePair<string, object>)

Adds new field to this item.

public void Add(KeyValuePair<string, object> item)

Parameters

item KeyValuePair<string, object>

Field to add.

Remarks

If the field with the given name already exists, its value will be overwritten.

Clear()

Removes all fields from this item.

public void Clear()

Contains(KeyValuePair<string, object>)

Returns value indicating whether the given field is defined on a given item.

public bool Contains(KeyValuePair<string, object> item)

Parameters

item KeyValuePair<string, object>

Field to search for.

Returns

bool

Value indicating whether the given field is defined on a given item.

ContainsKey(string)

Returns value indicating whether item contains the field with the given name.

public bool ContainsKey(string key)

Parameters

key string

Field name.

Returns

bool

Value indicating whether item contains the field with the given name.

CopyTo(KeyValuePair<string, object>[], int)

Copies all fields from the given item into the given array.

public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)

Parameters

array KeyValuePair<string, object>[]

Array to copy to.

arrayIndex int

Array index.

DeserializeFrom(ItemEntry)

Deserializes the state of the current object from a given item.

public void DeserializeFrom(ItemEntry item)

Parameters

item ItemEntry

Item to to deserialize this object from.

DeserializeFrom(IDictionary<string, object>)

Deserializes the state of the current object from a given set of key-value pairs.

public override void DeserializeFrom(IDictionary<string, object> dictionary)

Parameters

dictionary IDictionary<string, object>

A set of key-value pairs to deserialize this object from.

DeserializeFrom(DataRow)

Deserializes the state of the current object from a given data row.

public void DeserializeFrom(DataRow row)

Parameters

row DataRow

A data row to deserialize this object from.

DeserializeFrom(IDataReader)

Deserializes the state of the current object from a given data reader.

public void DeserializeFrom(IDataReader reader)

Parameters

reader IDataReader

A data reader to deserialize this object from.

GetEnumerator()

Returns an enumerator object that is used to iterate over the fields of this item.

public IEnumerator<KeyValuePair<string, object>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<string, object>>

An enumerator object that is used to iterate over the fields of this item.

GetItemById(string, string)

Returns the item by its Id.

public static Item GetItemById(string itemType, string id)

Parameters

itemType string

Item type.

id string

Item Id.

Returns

Item

The item.

Remove(KeyValuePair<string, object>)

Removes the given field from the item.

public bool Remove(KeyValuePair<string, object> item)

Parameters

item KeyValuePair<string, object>

Field to remove.

Returns

bool

Value indicating whether field has been removed successfully.

SerializeTo(IDictionary<string, object>)

Serializes the state of the current object into the given dictionary.

public override void SerializeTo(IDictionary<string, object> dictionary)

Parameters

dictionary IDictionary<string, object>

Dictionary to serialize this object into.

SerializeTo(DataRow)

Serializes the state of the current object into the given data row.

public void SerializeTo(DataRow row)

Parameters

row DataRow

Data row to serialize this object into.

SetDefaultValues()

public void SetDefaultValues()

SetDefaultValues(ItemType)

public void SetDefaultValues(ItemType itemType)

Parameters

itemType ItemType

SetDefaultValues(ItemType, bool)

public void SetDefaultValues(ItemType itemType, bool force)

Parameters

itemType ItemType
force bool

TryGetValue(string, out object)

Tries to get the value of a given field.

public bool TryGetValue(string key, out object value)

Parameters

key string

Field name.

value object

Field value.

Returns

bool

Value indicating whether field value was successfully retrieved.

To top