I have been writing web services for about a year now and it seems that the process I use to get data from the Database all the way to display to the user and back again has some inefficiencies.
The purpose of this question is to make sure that I am following best practices and not just adding extra work in.
Here is the path for data from the DB, to the end user and back.
- Service gets it from the database into a Data Access Layer (DAL) object.
- Service Converts it to a DataContract to send to the client.
- Client gets the DataContract and converts it to a client side object
- Client displays the object / the user makes changes / objects are added
- Client converts the client side object to a DataContact and sends it to the Service
- Service recives the DataContract and converts it to a Data Access Layer object.
- Service updates the Database with the changes/new objects.
If you were keeping track the object is converted 4 times (DAL->Contract->Client Object->Contract->DAL). That seems like a lot of conversions when your app starts to scale out it's data.
Is this the "Best" way to do this? Am I missing something?
In case it matters, I am using Visual Studio 2008, WCF, LinqToSQL and Windows Mobile 5.0 (NETCF).