C# ASP.NET
Hi
If you create an object with say 8 properties, if you then instanciated the object do you have to populate and use all properties before you can pass it to a webservices.
I have a program that that needs to collect report parameters from a user then store them in a database table so they can be called again later from a service. I have 11 reports and they all use different parameters. So my question is can I create a report parameter object that has 8 properties and only populate 5 of them leaving 3 properties empty for one report and then say populate 4 for another report and leave 4 empty or should I create an object for each set of report paranmeters? Once I have that object can I then pass it to a webservice that persists the parameter data to the database with properties missing?
Happy to answer questions about this as I appreciate it is not that clear!
Cheers
Yes, it should be OK to do that. As long as you control the interface to the web service, and it sounds like you do.
If you don’t control the interface, then the WSDL of that interface will tell you if you can do it or not.
As long as your parameters are relatively generic, I would suggest the approach you describe. Creating an object for each report type is going to get messy, and is unnecessary if the parameters are generic.