Skip to content
Advertisement

Storing multiple fields of address in entity class

I need to store multiple addresses, like address1 , address2 and zipcode etc. Should I declare all the fields individually?

for instance:

class A{
      // many fields
     Address1:string;
     Address2:string;
     zipCode:number;
     city:String;
   }

or is there any better way to declare them in entity class? I have been told creating entity classes is the best practice.

enter image description here

Advertisement

Answer

If only the addresses are multiple, it seems you have this situation:

class A {
  AddressList: string[];
  zipCode: number;
  city: String;
}
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement