Skip to content

breeze-client / entityTypeForCtor

Function: entityTypeForCtor() ​

entityTypeForCtor(entityCtor): EntityType

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

The EntityType a constructor stands for.

MetadataStore.registerEntityTypeCtor puts the type on the class's prototype, and that is what the constructor-taking overloads of EntityQuery.from, EntityManager.createEntity and the rest read. A class that was never registered has nothing to read, so this throws rather than letting the caller build a query against undefined.

ts
em.metadataStore.registerEntityTypeCtor('Customer', Customer);
entityTypeForCtor(Customer).defaultResourceName;   // 'Customers'

Parameters ​

entityCtor ​

Function

A constructor registered with a MetadataStore.

Returns ​

EntityType

Released under the MIT License.