Skip to main content

UtcDateTimeConverter.StorageType Property

Gets the type that the property’s value will be converted to when it’s saved in a data store.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v24.2.dll

NuGet Package: DevExpress.Xpo

#Declaration

public override Type StorageType { get; }

#Property Value

Type Description
Type

A Type which represents the type that the property’s value will be converted to when it’s saved in a data store.

#Remarks

The StorageType property returns the Type object for a DateTime type.

#Example

The following example shows how to convert the value of the Date property from the local time to the current coordinated universal time (UTC) when persisting it in a data store.

using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
// ...
public class SampleUtc : XPObject {
    private DateTime date;
    [ValueConverter(typeof(UtcDateTimeConverter))]
    public DateTime Date {
        get { return date; }
        set { SetPropertyValue(nameof(Date), ref date, value); }
    }
}
See Also