Social Icons

twitter google plus linkedin rss feed

Pages

13.4.13

Abstract Classes and Collection Types in Service Reference Settings

I have been adding some objects to one of my web services, they were representing a hierarchy of similar items so I used a nice abstract factory.

The code was working perfectly on the server and then I added one object as a response of a web service method.

Nice!

Finally I went to a solution that was using that web service with the naive intention of using it as i always do and updated it but to my surprise, after the update I got a couple of hundred errors in the code.

What used to be ObservableCollections were now Arrays.

I tried to change the Service Reference Settings back to normal but it was as usual with the Collection Type parameter set as Observable Collection. What was happening?

Back to the code I tried everything I could think of in a Saturday afternoon and nothing changed until I commented the abstract class. That made everything go back to normal.

In the end I have changed all the abstract classes to normal classes and the abstract methods to virtual. It's not the same and the code is awkward but now, at least I can use my web services as usual.

By the way, I had a lot of private setters I had to get rid of. I was getting:

error CS0200: Property or indexer "propertyName" cannot be assigned to -- it is read only
So I had to change the properties from this:
public string Label { get; private set; }
To this:
public string Label;

So annoying!

By the way, thanks Fiddler2.

I don't usually post about unsolved issues but I don't use to write one post a day either it is not my fault, it's The Ultimate Blog Challenge's ...



No comments:

Post a Comment