I have three projects:
- WCF Service project (Interface and Implementation)
- aspx web project (client) that consumes the WCF Service
- class library project that holds my business objects (shared by both WCF project and client)
I have a method in the WCF Service implementation class file that retrieves a generic list of data from SQL (referencing the project that holds the business objects), serialize the data using System.Web.Script.Serialization.JavaScriptSerializer and returns the result as a string.
The web client takes this string and deserializes it back to the appropriate business object (referencing the project that holds the business objects)
This is an intranet app and I want to make sure I am doing this correctly.
My questions are:
- Should I be using DataContracts instead of business objects? Not sure when to use DataContracts and when to use the business objects.
- If I am using DataContracts, should I not use System.Web.Script.Serialization.JavaScriptSerializer?
Any clarification would be appreciated.