Quantcast
Channel: Question and Answer » web-services
Viewing all articles
Browse latest Browse all 136

Keeping client side model and server side in sync in SPAs

$
0
0

Since SPAs have most of their domain logic client side, how do you keep your domain model in sync with the back end?

For example, let’s say I have a .NET WebAPI web service that uses the Entity Framework to communicate with SQL Server and one of my classes is called Product. Most of Product’s domain logic will be client side.

Now I add a ProductType table to my DB, and I add a ProductTypeID column to my Products table. My EF Product class now has a new property called ProductTypeID. Do I now manually go into my JS files, find the definition for Product and add the ProductTypeID property?

While the client side doesn’t need to know server side implementation specifics, it will need to know the shape of the model. How do you keep that in sync between server side and client side? Is it completely manual? How do you avoid errors like property name typos in JS?


Viewing all articles
Browse latest Browse all 136

Trending Articles