Class PropertyCollectionBase<T>

Abstract base class for creating properties with a value that is a collection of items.

Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
Namespace: EPiServer.Commerce.SpecializedProperties
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
public abstract class PropertyCollectionBase<T> : PropertyLongString, IEnumerable<T>, IEnumerable where T : ICloneable
Type Parameters
Name Description
T

The type of item in the collection.

Constructors

PropertyCollectionBase()

Initializes a new instance of the PropertyCollectionBase<T> class.

Declaration
protected PropertyCollectionBase()

PropertyCollectionBase(ItemCollection<T>)

Initializes a new instance of the PropertyCollectionBase<T> class.

Declaration
protected PropertyCollectionBase(ItemCollection<T> items)
Parameters
Type Name Description
ItemCollection<T> items

The items.

Exceptions
Type Condition
System.ArgumentNullException

items

Properties

IsModified

Check if property has been modified.

Declaration
public override bool IsModified { get; set; }
Property Value
Type Description
System.Boolean

IsNull

Check for null property (no value has been set or the collection is empty).

Declaration
public override bool IsNull { get; }
Property Value
Type Description
System.Boolean

true if this property is null; otherwise, false.

Items

Gets or sets the collection of items in the property.

Declaration
public ItemCollection<T> Items { get; set; }
Property Value
Type Description
ItemCollection<T>

PropertyValueType

Returns the type of the collection by getting the type.

Declaration
public override Type PropertyValueType { get; }
Property Value
Type Description
System.Type
Remarks

Override this method and return the actual type to be sure.

SerializerFactory

Gets or sets the serializer factory.

Declaration
protected virtual Injected<IObjectSerializerFactory> SerializerFactory { get; set; }
Property Value
Type Description
EPiServer.ServiceLocation.Injected<EPiServer.Framework.Serialization.IObjectSerializerFactory>

Value

Gets or sets the value.

Declaration
public override object Value { get; set; }
Property Value
Type Description
System.Object

The item collection as an System.Object instance.

Methods

CreateInstance()

Creates a new instance of the property. Defaults to create from the current type.

Declaration
protected virtual PropertyCollectionBase<T> CreateInstance()
Returns
Type Description
PropertyCollectionBase<T>

CreateWritableClone()

Creates a writable clone of the property.

Declaration
public override PropertyData CreateWritableClone()
Returns
Type Description
EPiServer.Core.PropertyData

A writable copy of the property.

FromLongString(String)

"Deserializes" an item collection from its string representation into this instance using a json serializer from SerializerFactory. Override this method and ToLongString() to user custom serialization.

Declaration
protected virtual void FromLongString(string str)
Parameters
Type Name Description
System.String str

GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>

An System.Collections.IEnumerator object that can be used to iterate through the collection.

LoadData(Object)

Sets the internal representation from what is stored in the database. "Deserialize".

Declaration
public override void LoadData(object value)
Parameters
Type Name Description
System.Object value

The internal value.

MakeReadOnly()

Makes the instance read only.

Declaration
public override void MakeReadOnly()

ParseToObject(String)

Parses the string representation of the colleciton into a new instance of this class.

Declaration
public override PropertyData ParseToObject(string str)
Parameters
Type Name Description
System.String str

The string representation of the collection.

Returns
Type Description
EPiServer.Core.PropertyData

ParseToSelf(String)

Parses the string representation of the colleciton into the current instance.

Declaration
public override void ParseToSelf(string str)
Parameters
Type Name Description
System.String str

The string representation of the collection.

SaveData(PropertyDataCollection)

Get the data representation suitable for storing to the database. "Serialize".

Declaration
public override object SaveData(PropertyDataCollection properties)
Parameters
Type Name Description
EPiServer.Core.PropertyDataCollection properties

The properties for the current page.

Returns
Type Description
System.Object

A string representation of the item collection.

SetDefaultValue()

Sets the default value for this property.

Declaration
protected override void SetDefaultValue()

ToLongString()

"Serializes" the item collection to a string using a json serializer from SerializerFactory. Override this method and FromLongString(String) to user custom serialization.

Declaration
protected virtual string ToLongString()
Returns
Type Description
System.String

A string representation of the item collection.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

An System.Collections.IEnumerator object that can be used to iterate through the collection.

Implements

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable