I’m sure something like this has been asked before, but I can’t seem to find exactly what I need. Say I added a DataSet component to my VS 2010 .NET 3.5 project – it’s executing and filling up alright and is very easy to use.
But what if i wanted to make small modifications to its query at runtime (basing on various user input)?
I know i could do this with Parameters, but what if the modifications to the query have more structural character, – like omitting parameters etc.?
In the generated code i see that it exposes CommandCollection property, but it’s protected, therefore I can’t use it from outside of the dataset – unless 🙂 i make a dummy class that inherits from the generated adapter object and publicly exposes CommandCollection property by force (that’s just what I did) – but isn’t it a bit awkward?
Do you know of a better technique?
so since nobody answered, I post the workaround I used here (inherited class). Foreword: when you drag a DataSet class from VS 2010 toolbox to your Form (e.g. MainForm) in Design view, three things are generated :
The definition of the above generated classes, along with the required queries etc. is ultimately stored in an XSD file, and during each build the code for these classes is generated from the XSD.