In this article you will learn how to create a WCF service for Insertion and Retrieval of data.
Insertion and retrieval of data becomes easier with WCF services. Today we will discuss how to create a WCF service for this purpose.Note: Before the Visual Studio application, first of all Install and create Database and Table in SQL Server Express 2012.The following is the procedure to use. 1. Open Visual Studio 2013 and select WCF Service application project and name it.2. Now right-click on the project's name and "Add" -> "New item".3. Create a LINQ to SQL classes project and add it.4. Now open the Server Explorer in Visual Studio and right-click on "Data Connections" and "Add New Connection".5. Now enter your Server Name (Instance Name) and select your database that is to be used.6. You can "Test your Connection" and then click OK.7. Now your SQL DB is connected to Visual Studio and it is added to the project, visible in the Server Explorer. Expand DB, then tables and drag your table to the middle screen and drop it there.8. Now open IService.cs from the Solution Explorer and add this code.9. Then open Service1.svc.cs and add this code.10. Now you have created a WCF service. Now test whether or not the service works. Right-click on Service1.svc from the Solution Explorer and select "View In Browser". Your expected result will look like this.11. Now copy the link of service from the browser and save it in Notepad for further use.Calling WCF Web Service from Windows Phone 8 Application12. Open Visual Studio 2013 and create a Windows Phone Blank app.13. In Solution Explorer, right-click on references and "Add New Service Reference".14. Then enter that copied URL and click Go. Then enter your Service Name and click OK.15. In MainPage.xaml add this code.16. In MainPage.xaml.cs, add this namespace for service reference.
Essential WCF Practical Implementation