Skip to content Skip to sidebar Skip to footer

Extending A Breeze Entity Using Typescript

I am developing a website using HotTowel and TypeScript. In John Papa's excellent PluralSight course, he extended a breezejs entity by creating a constructor and using 'Object.def

Solution 1:

Typescript support accessor out of the box. The TypeScript code you asked could be :

function registerPerson(metadataStore) {
    metadataStore.registerEntityTypeCtor('Person', Person);
}
class Person {
    public firstName: string;
    public lastName: string;

    constructor(public isPartial=false, public isSpeaker=false) {
    }

    get fullName():string {
        return `${this.firstName} ${this.lastName}`;
    }
}

Post a Comment for "Extending A Breeze Entity Using Typescript"