Creating WCF Data Service from scratch and Hosting in Console Application

Objective In this article, I will show how 1. WCF Service can be created from the scratch 2. WCF Service can be hosted in Console Application You can see video of this article here Let us say, we have a table called Student of below structure below in our data base In Student table RollNumber … Continue reading Creating WCF Data Service from scratch and Hosting in Console Application

Video on Hosting WCF Data Service in Console Application

MyDataService.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Web; using System.Data.Services; using System.Data.Services.Common; namespace DemoHostingInConsole { public class MyDataService : DataService<StudentDBEntities> { public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } } Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Web; using System.Data.Services; … Continue reading Video on Hosting WCF Data Service in Console Application

Video tutorial on Hosting WCF Service with netTcpBinding in Windows Service

WCF Service IService1.cs using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; namespace NetTcpServicetoHostinWindowsServices { [ServiceContract] public interface IService1 { [OperationContract] string GetData(int value); } } Service1.svc.cs using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; namespace NetTcpServicetoHostinWindowsServices { public class Service1 : IService1 { public string GetData(int value) … Continue reading Video tutorial on Hosting WCF Service with netTcpBinding in Windows Service

Video tutorial on Consuming WCF Data Service

Source code using System; using System.Collections.Generic; using System.Linq; using System.Text; using secondClient.ServiceReference1; using System.Data.Services.Client; namespace secondClient { class Program { static void Main(string[] args) { DataServiceContext context = new DataServiceContext (new Uri("http://localhost:3803/WcfDataService1.svc/")); StudentDBEntities studentDbEnt = new StudentDBEntities (new Uri("http://localhost:3803/WcfDataService1.svc/")); #region Get all the Records var res = from r in studentDbEnt.Students select r; foreach (var … Continue reading Video tutorial on Consuming WCF Data Service