Class PropertyDecimal

Property type for storing decimal values

Inheritance
System.Object
PropertyDecimal
Namespace: EPiServer.Commerce.SpecializedProperties
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
public class PropertyDecimal : PropertyData
Remarks

Will store the value in the string column in the database

Constructors

PropertyDecimal()

Initializes a new instance of the PropertyDecimal class.

Declaration
public PropertyDecimal()

PropertyDecimal(Decimal)

Initializes a new instance of the PropertyDecimal class.

Declaration
public PropertyDecimal(decimal value)
Parameters
Type Name Description
System.Decimal value

The decimal value.

Properties

Decimal

Get or sets the value of the property typed as a Decimal.

Declaration
public decimal? Decimal { get; set; }
Property Value
Type Description
System.Nullable<System.Decimal>

PropertyValueType

Gets the System.Type of the property value.

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

Type

Get the data type for this property.

Declaration
public override PropertyDataType Type { get; }
Property Value
Type Description
EPiServer.Core.PropertyDataType

Returns EPiServer.Core.PropertyDataType.String.

Remarks

The recommended practice is to use typeof() constructs instead of relying on this property.

Value

Gets or sets the value of the property.

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

The value of the property.

Remarks

Value returns null if the property has no value defined.

Methods

CreatePropertyControl()

Creates the property control. Will use a simple string editing control for the legacy edit mode.

Declaration
[Obsolete("Use IPropertyControlFactory to cretate property controls. Will remain at least until July 2018.")]
public override IPropertyControl CreatePropertyControl()
Returns
Type Description
EPiServer.Core.IPropertyControl

A EPiServer.Web.PropertyControls.PropertyStringControl

Parse(String)

Create a new instance of PropertyDecimal from a string.

Declaration
public static PropertyDecimal Parse(string value)
Parameters
Type Name Description
System.String value

The string to create a PropertyDecimal from.

Returns
Type Description
PropertyDecimal

A new instance of PropertyDecimal.

Remarks

If the string is null or Empty an empty PropertyDecimal is returned. If the string cannot be parsed as a decimal an EPiServer.Core.InvalidPropertyValueException is thrown.

ParseToObject(String)

A wrapper for Parse(String) to return a generic PropertyData object.

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

The value for the new PropertyDecimal.

Returns
Type Description
EPiServer.Core.PropertyData

A new instance of PropertyDecimal.

Remarks

If the string is null or Empty an empty PropertyDecimal is returned. If the string cannot be parsed as a decimal an EPiServer.Core.InvalidPropertyValueException is thrown.

ParseToSelf(String)

Replace the internal decimal with the parsed value.

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

The string to parse into this object.

SaveData(PropertyDataCollection)

Prepares the data in a format for persisting ("serialize").

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

The properties.

Returns
Type Description
System.Object

SetDefaultValue()

Sets the default value for this property.

Declaration
protected override void SetDefaultValue()

ToString()

Get the property's display string.

Declaration
public override string ToString()
Returns
Type Description
System.String