The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

XPMemberInfo.MappingFieldSize Property

Gets the maximum number of characters that can be stored in a field which the member is mapped to.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v19.1.dll

Declaration

public int MappingFieldSize { get; }
Public ReadOnly Property MappingFieldSize As Integer
public int MappingFieldSize { get; }
Public ReadOnly Property MappingFieldSize As Integer

Property Value

Type Description
Int32

An integer value which specifies the maximum number of characters that can be stored. 0 if the type in which the member's value is saved to a data store isn't a string.

Property Value

Type Description
Int32

An integer value which specifies the maximum number of characters that can be stored. 0 if the type in which the member's value is saved to a data store isn't a string.

Remarks

To specify the size of the mapping field, the SizeAttribute must be applied to a property or a field. Otherwise, if this attribute isn't applied, the default size is specified which equals to 100.

Examples

The following example applies the SizeAttribute to the FullName and Background properties. The maximum number of characters that can be stored in a database column which the FullName property is mapped to is 128. As for the Background property the unlimited size of the column it is mapped to is specified.

using DevExpress.Xpo;

class Customer : XPObject {
    private string fullName;
    private string background;

    [Size(128)]
    public string FullName {
        get { return fullName; }
        set { SetPropertyValue<string>("FullName", ref fullName, value); }
    }

    [Size(SizeAttribute.Unlimited)]
    public string Background {
        get { return background; }
        set { SetPropertyValue<string>("Background", ref background, value); }
    }
}
See Also