Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi Prism/Other    [ Add a report in this area ]  
Report #:  72935   Status: Closed
ASP.NET Web Method attribute in wrong place
Project:  Embarcadero Prism Build #:  3.0.17.591
Version:    1.0 Submitted By:   Bob Swart
Report Type:  Minor failure / Design problem Date Reported:  4/13/2009 6:18:32 AM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   268978
Resolution: As Designed (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
When creating an ASP.NET Web Service, there is a sample method HelloWorld, which should be decorated with the [WebMethod] attribute.

This attribute is not placed at the definition of HelloWorld, but rather at the implementation.

It's commonly considered good practive to place the attribute at the defition.
Steps to Reproduce:
Create a new ASP.NET Web Service item.
The new web service class will contain a method without [WebMethod] attribute:

  Service = public class(System.Web.Services.WebService)
  public
    method HelloWorld: String;
  end;

The implementation shows the [WebMethod] attribute instead:

[WebMethod]
method Service.HelloWorld: String;
begin
  result := 'Hello World';
end;

The attribute should be placed at the definition, not at the implementation.

See also my comment in http://www.drbob42.com/examines/examinA9.htm
Workarounds
None
Attachment
None
Comments

Bob Swart at 10/10/2010 7:29:23 AM -
This is still a problem in Delphi Prism XE, and doesn't look good in my view. It shouldn't be too hard to fix this, should it?

Tomohiro Takahashi at 10/11/2010 6:41:42 PM -
I checked internal status, and I closed this report as Sysop, because #268978 has been already closed by by RemObjects as 'As Designed'.

Server Response from: ETNACODE01