DHTMLAsp.NetSQLC-SharpXMLFrameworkIISXMLWebServiceArchitecture
UMLProject ManagementSDLCMethodologiesDesign PatterenOOPWCF.Net RemotingWWF
MVPMVCSite Map
Asp.net 2.0
User Control
Custom Control
File Handling
Deligate
Site Map
Tell a Friend
You
Friend
Email

Newsletter
Email

 

 

WCF (Windows Communication Foundation) is a service oriented architecture, It provides a manageable approach to distributed development environment.
Windows Communication Foundation
The following code shows the defination of a service, once service created, the service has to registered in web config file
Service sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace ETG.Base.Applications.ETigers.Web.ETech.WCF
{
// NOTE: If you change the interface name "IStudent" here, you must also update the reference to "IStudent" in Web.config.
[ServiceContract]
public interface IStudent
{
[OperationContract]
StudentInfo GetStudent(int id);
}
}
The following example shows how to write a datacontact
Datacontact sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace ETG.Base.Applications.ETigers.Web.ETech.WCF
{
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class StudentInfo
{
string _StudentName="";
int _StudentAge = 0;
[DataMember]
public string StudentName
{
get { return _StudentName; }
set { _StudentName = value; }
}
[DataMember]
public int StudentAge
{
get { return _StudentAge; }
set { _StudentAge = value; }
}
}
}
Now we need to register the service, this is how we can register the service in web.config file
Datacontact sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace ETG.Base.Applications.ETigers.Web.ETech.WCF
{
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class StudentInfo
{
string _StudentName="";
int _StudentAge = 0;
[DataMember]
public string StudentName
{
get { return _StudentName; }
set { _StudentName = value; }
}
[DataMember]
public int StudentAge
{
get { return _StudentAge; }
set { _StudentAge = value; }
}
}
}
Privacy Policy ©2007 E-Tigers.net, All Rights Reserved Terms & Conditions
Supported by ETG Consultancy