Error!
Success!

Stylecop rule SA1623 and read-only properties in webservices

0
kicks

Stylecop rule SA1623 and read-only properties in webservices  (Unpublished)

Hi there, I'm currently refactoring some code (see my previous post). But during the refactoring something weird/funny/not logical Foot in mouth happened which should have been implemented better, at least that's what I think! Wink According to the following documentation rule: SA1623: Validates that a property's summary description text begins with the correct syntax, depending upon whether the property exposes get or set accessors. which verifies the content and formatting of code documentation, my comment above the property was not correctly written. I had to write my code comment with 'Gets or sets'. But that automatically implies that when someone reads the code documentation, they can set that property. All true, except in this stuation: If the class definition of the object contains a read-only property, the read-only property is not available when you build a proxy assembly for the Web service, cause read-only properties cannot be exposed by XML Web Services. That's why you have to implement a setter for it. To work around this problem, add a SET procedure for the property. You can either leave the procedure empty, so that that the procedure has no effect, or raise a custom exception to inform clients that the property is read-only.


Kicked By:
Drop Kicked By: