Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Angular2 Extending Breeze Entities

I am using Angular2 along with the Breeze Metadata Generator. I have a person class and I want to extend the entity with some custom properties on the client.

Is this the right way to do it?

 import { EntityBase } from '../EntityBase';
import { ProfileFaculty } from './ProfileFaculty';
import { RoadRunner } from './RoadRunner';
import { Security } from './Security';
import { ProfileStudent } from './ProfileStudent';

/// <code-import> Place custom imports between <code-import> tags
import { EcLocalDataService } from "../../common/static"
/// </code-import>

export class Person extends EntityBase {
   // Generated code. Do not place code below this line.
   personId: number;
   isActive: boolean;
   bbUserId: string;
   bbUserName: string;
   lastName: string;
   firstName: string;
   avatarLocation: string;
   goByName: string;
   mpGender: string;
   mpAffiliation: string;
   mpPaygrade: string;
   mpComponent: string;
   email: string;
   registrationComplete: boolean;
   mpInstituteRole: string;
   modifiedById: number;
   modifiedDate: Date;
   faculty: ProfileFaculty;
   roadRunnerAddresses: RoadRunner[];
   security: Security;
   student: ProfileStudent;

   /// <code> Place custom code between <code> tags
   salutation: string;
   prettyInstituteRole: string;

   constructor() {
       super();
       this.salutation = EcLocalDataService.getSalutation(this.mpPaygrade, this.mpComponent, this.mpAffiliation);
       this.prettyInstituteRole = EcLocalDataService.prettyInstituteRole(this.mpInstituteRole);
   }
   /// </code>

}

Also I noticed in the Temphire example there is this piece of code. Each class had it but mine don't. What does this do?

static initializer(entity: PhoneNumber) { }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This worked.

import { EntityBase } from '../EntityBase';
import { ProfileFaculty } from './ProfileFaculty';
import { RoadRunner } from './RoadRunner';
import { Security } from './Security';
import { ProfileStudent } from './ProfileStudent';

/// <code-import> Place custom imports between <code-import> tags
import { EcLocalDataService } from "../../common/static"
/// </code-import>

export class Person extends EntityBase {
   // Generated code. Do not place code below this line.
   personId: number;
   isActive: boolean;
   bbUserId: string;
   bbUserName: string;
   lastName: string;
   firstName: string;
   avatarLocation: string;
   goByName: string;
   mpGender: string;
   mpAffiliation: string;
   mpPaygrade: string;
   mpComponent: string;
   email: string;
   registrationComplete: boolean;
   mpInstituteRole: string;
   modifiedById: number;
   modifiedDate: Date;
   faculty: ProfileFaculty;
   roadRunnerAddresses: RoadRunner[];
   security: Security;
   student: ProfileStudent;

   /// <code> Place custom code between <code> tags
   //salutation: string;
   //prettyInstituteRole: string;

   constructor() {
       super();
       //this.salutation = EcLocalDataService.getSalutation(this.mpPaygrade, this.mpComponent, this.mpAffiliation);
       //this.prettyInstituteRole = EcLocalDataService.prettyInstituteRole(this.mpInstituteRole);
   }

   get salutation():string {
       return EcLocalDataService.getSalutation(this.mpPaygrade, this.mpComponent, this.mpAffiliation)
   }

   get prettyInstituteRole(): string {
       return EcLocalDataService.prettyInstituteRole(this.mpInstituteRole);
   }

   get prettyName(): string {
       return `${this.salutation} ${this.firstName} ${this.lastName}`
   }

     /// [Initializer]
    static initializer(entity: Person) { }
   /// </code>

}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!