Skip to content

breeze-client / NavigationProperty

Class: NavigationProperty ​

Defined in: src/metadata/entity-metadata.ts:2631

A NavigationProperty describes the metadata for a single property of an EntityType that return instances of other EntityTypes.

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

Constructors ​

Constructor ​

new NavigationProperty(config): NavigationProperty

Defined in: src/metadata/entity-metadata.ts:2717

NavigationProperty constructor

ts
const homeAddressProp = new NavigationProperty({
    name: "homeAddress",
    entityTypeName: "Address:#myNamespace",
    isScalar: true,
    associationName: "address_person",
    foreignKeyNames: ["homeAddressId"]
});
const homeAddressIdProp = new DataProperty({
    name: "homeAddressId",
    dataType: DataType.Int32
});
// assuming personEntityType is a newly constructed EntityType
personEntityType.addProperty(homeAddressProp);
personEntityType.addProperty(homeAddressIdProp);

Parameters ​

config ​

NavigationPropertyConfig

A configuration object.

Returns ​

NavigationProperty

Properties ​

associationName ​

associationName: string

Defined in: src/metadata/entity-metadata.ts:2673

The name of the association to which that this property belongs. This associationName will be shared with this properties 'inverse'. Read Only


baseProperty? ​

optional baseProperty?: NavigationProperty

Defined in: src/metadata/entity-metadata.ts:2660

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


custom ​

custom: any

Defined in: src/metadata/entity-metadata.ts:2696

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


displayName ​

displayName: string

Defined in: src/metadata/entity-metadata.ts:2691

The display name of this property. Read Only


entityType ​

entityType: EntityType

Defined in: src/metadata/entity-metadata.ts:2652

The EntityType returned by this property. Read Only


entityTypeName ​

entityTypeName: string

Defined in: src/metadata/entity-metadata.ts:2654

The name of the EntityType returned by this property. Read Only


foreignKeyNames ​

foreignKeyNames: string[]

Defined in: src/metadata/entity-metadata.ts:2676

The names of the foreign key DataProperties associated with this NavigationProperty. There will usually only be a single DataProperty associated with a Navigation property except in the case of entities with multipart keys. Read Only


foreignKeyNamesOnServer ​

foreignKeyNamesOnServer: string[]

Defined in: src/metadata/entity-metadata.ts:2679

The server side names of the foreign key DataProperties associated with this NavigationProperty. There will usually only be a single DataProperty associated with a Navigation property except in the case of entities with multipart keys. Read Only


formatName ​

formatName: () => string = DataProperty.prototype.formatName

Defined in: src/metadata/entity-metadata.ts:2643

Returns the qualified name of the parent type and the property name, joined by --. See DataProperty.formatName; applications do not normally need it.

Returns a name that identifies this property across the store: the qualified name of its parent type and the property name, joined by --. Breeze uses it in error messages and to generate association names; applications do not normally need it.

Returns ​

string


getAllValidators ​

getAllValidators: () => Validator[] = DataProperty.prototype.getAllValidators

Defined in: src/metadata/entity-metadata.ts:2646

Returns the validators that apply to this property, including those inherited from base types. See DataProperty.getAllValidators.

Returns the validators that apply to this property: its own DataProperty.validators followed by those of the properties it inherits from on base types. Returns a new array.

Returns ​

Validator[]


invForeignKeyNames ​

invForeignKeyNames: string[]

Defined in: src/metadata/entity-metadata.ts:2681

The names of the foreign key DataProperties at the other end of the relationship. Read Only


invForeignKeyNamesOnServer ​

invForeignKeyNamesOnServer: string[]

Defined in: src/metadata/entity-metadata.ts:2683

The server side names of the foreign key DataProperties at the other end of the relationship. Read Only


isDataProperty ​

isDataProperty: boolean = false

Defined in: src/metadata/entity-metadata.ts:2636

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


isNavigationProperty ​

isNavigationProperty: boolean = true

Defined in: src/metadata/entity-metadata.ts:2639

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


isScalar ​

isScalar: boolean

Defined in: src/metadata/entity-metadata.ts:2670

Whether this property returns a single entity as opposed to an array of entities. Read Only


isUnmapped ​

isUnmapped: boolean

Defined in: src/metadata/entity-metadata.ts:2694

Always undefined: a NavigationProperty cannot be unmapped. Declared so that isUnmapped can be read from any EntityProperty. Read Only


name ​

name: string

Defined in: src/metadata/entity-metadata.ts:2665

The name of this property. Read Only


nameOnServer ​

nameOnServer: string

Defined in: src/metadata/entity-metadata.ts:2667

The name of this property on the server. Read Only


parentEntityType ​

parentEntityType: EntityType

Defined in: src/metadata/entity-metadata.ts:2658

The EntityType that this property belongs to. ( same as entityType). Read Only


parentType ​

parentType: EntityType

Defined in: src/metadata/entity-metadata.ts:2656

The EntityType that this property belongs to. ( same as entityType). Read Only


relatedDataProperties ​

relatedDataProperties: DataProperty[]

Defined in: src/metadata/entity-metadata.ts:2686

The 'foreign key' DataProperties associated with this NavigationProperty. There will usually only be a single DataProperty associated with a Navigation property except in the case of entities with multipart keys. Read Only


resolveProperty ​

resolveProperty: (propName) => any = DataProperty.prototype.resolveProperty

Defined in: src/metadata/entity-metadata.ts:2649

Returns the value of the named field of this property, falling back to the property it inherits from on a base type. See DataProperty.resolveProperty.

Returns the value of the named field of this property, such as "displayName". If it is null or undefined here, the value is taken from the property this one inherits from on a base type (see DataProperty.baseProperty), and so on up the hierarchy. Validation uses it to find a property's display name.

Parameters ​

propName ​

string

Returns ​

any


validators ​

validators: Validator[]

Defined in: src/metadata/entity-metadata.ts:2689

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

Accessors ​

inverse ​

Get Signature ​

get inverse(): NavigationProperty | undefined

Defined in: src/metadata/entity-metadata.ts:2780

The inverse of this NavigationProperty. The NavigationProperty that represents a navigation in the opposite direction to this NavigationProperty. May be undefined for a undirectional NavigationProperty. Read Only

Returns ​

NavigationProperty | undefined

Methods ​

setInverse() ​

setInverse(inverseNp): void

Defined in: src/metadata/entity-metadata.ts:2803

Makes the specified navigation property, on the type this property returns, the inverse of this one. Both get the same NavigationProperty.associationName: this property's if it has one, otherwise the other's, otherwise a generated one. For metadata built by hand; metadata from the server already pairs inverses by association name. Also available as the inverse option of NavigationProperty.setProperties. Both types must already be in the same MetadataStore.

Parameters ​

inverseNp ​

string | NavigationProperty

The inverse NavigationProperty, or its name on the type this property returns. Throws if it is not found, does not point back at this property's parent type, or either property already has an inverse.

Returns ​

void


setProperties() ​

setProperties(config): void

Defined in: src/metadata/entity-metadata.ts:2751

General purpose property set method

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

Parameters ​

config ​

A config object

custom? ​

any

displayName? ​

string

foreignKeyNames? ​

string[]

inverse? ​

string | NavigationProperty

invForeignKeyNames? ​

string[]

Returns ​

void


toJSON() ​

toJSON(): Object

Defined in: src/metadata/entity-metadata.ts:2855

Returns this property's metadata as a plain object in Breeze's native JSON metadata format, leaving out default values. Only client-side names are written. Used when MetadataStore.exportMetadata serializes the store.

Returns ​

Object


fromJSON() ​

static fromJSON(json): NavigationProperty

Defined in: src/metadata/entity-metadata.ts:2871

Creates a NavigationProperty from the JSON form that NavigationProperty.toJSON produces. Used by MetadataStore.importMetadata. Modifies the object passed in.

Parameters ​

json ​

any

Returns ​

NavigationProperty

Released under the MIT License.