hello guys how r u ?
my question is that, i am creating the wcf application, in that application i am using property instead of methods in the IService interface so i am using [OperationContract] as signature for property so there is an error comes "[OperationContract] is only use for methods" so what would be the signature for property ???
Reply Soon
thanks.
Loading
VulpesPosted Oct 20, 2011, 9:44 AM
VulpesPosted Oct 20, 2011, 7:02 AM
Fortunately, properties are just methods 'under the hood' anyway so it's not difficult to work around this apparent limitation.
Faisal AnsariPosted Oct 20, 2011, 6:53 AM
it means that, there is no any usage of property in wcf application right ?
VulpesPosted Oct 20, 2011, 4:46 AM
Faisal AnsariPosted Oct 20, 2011, 3:09 AM
IService1.cs
-------------
[ServiceContract]
public interface IService1
{
[OperationContract]
string Name { get; set; }
}
Service1.svc.cs
---------------
public class Service1 : IService1
{
public string name;
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
}
i am doing like this ... but same error occuring
Hemant KumarPosted Oct 20, 2011, 2:58 AM
You need to give the Signature of a Property in WCF like this
I would recommend you to refer this link for begginers which are excellent for freshers.
http://www.codeproject.com/KB/WCF/first_WCF_Service.aspx
http://wcftutorial.net/