What is the best way to go about syncing the server poco/dto object definitions in my spa application? so if i have a class with a list of address then on client we would like to have an object template that we can use to create an address instance to insert into the address list. Obviously our object graph is much larger and changes a lot during development so keeping such things in sync by hand is not a winning solution.
c# dto class
puclic class dto{
dto()
{
addressList = new List<address>();
}
puclic List<address> addresses {get;set;}
public string otherField{get;set;}
}
public class address{
public string street{get;set;}
public string city {get;set;}
}
javascript objects
var AddressClass = function(){
this.street ="";
this.city = "";
};
var Dto = function(){
this.addressList = [];
this.otherField = "";
};
some where in scope add to the addressList array
$scope.dtoClass.AddressList.push (new AddressClass() );
so the goal is an address class on the server and an addressClass on the client.