Show:

DataProperty Class

Module: breeze

A DataProperty describes the metadata for a single property of an EntityType that contains simple data.

Instances of the DataProperty class are constructed automatically during Metadata retrieval. However it is also possible to construct them directly via the constructor.

Methods

<ctor> DataProperty

(
  • config
)

Parameters:

  • config Configuration Object
    • [name] String optional

      The name of this property.

    • [nameOnServer] String optional

      Same as above but the name is that defined on the server. Either this or the 'name' above must be specified. Whichever one is specified the other will be computed using the NamingConvention on the MetadataStore associated with the EntityType to which this will be added.

    • [dataType=DataType.String] DataType optional
    • [complexTypeName] String optional
    • [isNullable=true] Boolean optional
    • [isScalar=true] Boolean optional
    • [defaultValue] Any optional
    • [isPartOfKey=false] Boolean optional
    • [isUnmapped=false] Boolean optional
    • [concurrencyMode] String optional
    • [maxLength] Integer optional

      Only meaningfull for DataType.String

    • [validators] Array of Validator optional
    • [custom] Object optional

Example:

var lastNameProp = new DataProperty( {
    name: "lastName",
    dataType: DataType.String,
    isNullable: true,
    maxLength: 20
});
// assuming personEntityType is a newly constructed EntityType
personEntityType.addProperty(lastNameProperty);

setProperties

(
  • config
)

General purpose property set method

Parameters:

  • config Object

    [object]

    • [custom] Object optional

Example:

// assume em1 is an EntityManager
var prop = myEntityType.getProperty("myProperty");
prop.setProperties( {
    custom: { foo: 7, bar: "test" }
});

Properties

baseProperty

DataProperty

Property on the base type that this property is inherited from. Will be null if the property is not on the base type.

readOnly

complexTypeName

String

The name of the ComplexType associated with this property; may be null.

readOnly

concurrencyMode

String

Describe this

readOnly

custom

Object

A free form object that can be used to define any custom metadata for this DataProperty.

readOnly

dataType

DataType

The DataType of this property.

readOnly

defaultValue

Any

The default value for this property.

readOnly

displayName

String

The display name of this property

readOnly

isComplexProperty

Bool

Whether the contents of this property is an instance of a ComplexType.

readOnly

isDataProperty

Boolean

Is this a DataProperty? - always true here Allows polymorphic treatment of DataProperties and NavigationProperties.

readOnly

isNavigationProperty

Boolean

Is this a NavigationProperty? - always false here Allows polymorphic treatment of DataProperties and NavigationProperties.

readOnly

isNullable

Boolean

Whether this property is nullable.

readOnly

isPartOfKey

Boolean

Whether this property is a 'key' property.

readOnly

isScalar

Boolean

Whether this property is scalar (i.e., returns a single value).

readOnly

isUnmapped

Boolean

Whether this property is an 'unmapped' property.

readOnly

maxLength

Number

The maximum length for the value of this property.

readOnly

name

String

The name of this property

readOnly

nameOnServer

String

The name of this property on the server

readOnly

parentType

EntityType | ComplexType

The parent type that this property belongs to - will be either a EntityType or a ComplexType.

readOnly

relatedNavigationProperty

NavigationProperty

The navigation property related to this property. Will only be set if this is a foreign key property.

readOnly

validators

Array of Validator

The Validators that are associated with this property. Validators can be added and removed from this collection.

readOnly