Properties Converted in Public Fields in Proxies
This is an interesting thing which Web Services users should know... Especially if they are working with Visual Studio .Net...
If you have a web service which is passing custom types in the methods... for e.g. you have a method called GetPerson() which returns "Person" object; which internally has FirstName, LastName etc as properties...
Now when you reference the web service, the automatic proxy generator will create Person Class on the client side too but it will create this class with public variables as FirstName, LastName etc rather than properties...
How does this make a difference... Well it does when you start binding those classes with anything else...
You can use CodeDOM to work around it but it sometimes becomes unnecessary deviation...
I would like to invite expert discussion on why not the Microsoft's automatic proxy generator, which generates proxy from WSDL, itself create properties for every public variables... There would be less chances of anyone using public variables; rather mostly they will be used as properties only... And even if they are not used as properties on server side, having properties on the client end is not a bad thing to do... I probably am missing something here but after seeing many people struggling with the same problem, this is what obviously comes to my mind...
PS: Friends and Gifts - I am usually, really confused about what gifts should be bought for whom... So I directly ask "Dear, what would you like as a present?"... reply comes -"Oh no nothing, nothing at all...you are visiting that itself is so nice... " Now when you visit people and that too after a long long time, internally somewhere in their minds they expect that you will bring some presents... What those presents would be is also probably being guessed, but without speaking of it aloud.. Now the funny part in my case is that they are guessing and I am not able to guess what they are guessing... I probably so go to the store and land up buying stuff for myself... :-) I have lately purchased over 5 T-Shirts which I would had never bought if not for those humble buddies of mine... So for benefit of people like me, I would like to appeal that please do precisely tell people what you want as a gift when they ask you... That will make you happy to get the gift you want and even the person in front happier as he will probably no more struggle in a tournament against the whole Consumer Goods Market Vs himself... :-)
No comments:
Post a Comment