[Webmethod] attribute doen't work for properties inWebservic

  • Thread starter Thread starter sunnyz
  • Start date Start date
S

sunnyz

i am using property in Webservice.But [WebMethod] attribute doesn'
work for properties.Cud any1 tell me plz which attribute to use for
properties

thx

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
sunnyz said:
i am using property in Webservice.But [WebMethod] attribute doesn'
work for properties.Cud any1 tell me plz which attribute to use for
properties

public int Property {
[WebMethod]
get {
}
[WebMethod]
set {
}
}
 
I would say that this is a very bad thing though, if anything, you
should provide accessor functions which take the place of properties. It
fits more in line with the nature of the transport, as well as the thinking
behind web services in general.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Robert Jordan said:
sunnyz said:
i am using property in Webservice.But [WebMethod] attribute doesn'
work for properties.Cud any1 tell me plz which attribute to use for
properties

public int Property {
[WebMethod]
get {
}
[WebMethod]
set {
}
}
 
The technical answer has already been given. However, this sounds to me like you may have a design issue. Why do you want to expose a property as a web service. Remoted calls should be "chunky" in that they send alot of data in one go rather than "chatty" where they send a small amount of data in lots of calls. Properties sound like a very chatty interface to me and lots of network roundtrips = poorly performing cliient application

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

i am using property in Webservice.But [WebMethod] attribute doesn'
work for properties.Cud any1 tell me plz which attribute to use for
properties

thx
 
Nicholas said:
I would say that this is a very bad thing though, if anything, you
should provide accessor functions which take the place of properties. It
fits more in line with the nature of the transport, as well as the thinking
behind web services in general.

Well. That's not my problem ;-)

bye
Rob
 
Back
Top