Wednesday, February 10, 2010

WCF: Data Contracts and Serialization-2

As per my Data Contracts and Serialization-1 blog,I am putting up an example of a WCF Service which you would possibly design in a real world application scenario.

In this case I have integrated the WCF with LINQ to SQL Entity classes which provide the backbone for the DataContracts and DataMembers which are serialized between a typical Client -> Server communication for
Selecting/Adding/Deleting/Updating database records.

I have also added the script for the table I am using in this demo that you could just run on your SqlServer and regenerate the table and the associated objects.

This sample assumes that you know LINQ syntaxes and if you are not familiar then there are plenty of resources out on the net to get you started.

For privacy reasons I have modified the SqlConnection string to
Data Source=SERVER;Initial Catalog=Singh;Persist Security Info=True;User ID=YOURID;Password=YOURPASSWORD.
You would need to replace the parameters SERVER/YOURID/YOURPASSWORD to values specific to your environment.Incase you still have problems then get in touch with me for any help that may be required to get the sample running on your machine.

The code can be downloaded from here .
The Database script can be downloaded from here

No comments:

Post a Comment