C
CDX
ok, so I'm new to C#, but have some experience with objects. I'd be real
grateful to anyone with some help on the things below.
So I've got some objects I've created that calculate P&L numbers and
some other objects that know how to summarize those numbers up. What I'm
having conceptual problems with are the following....
1. I would assume that I should populate these objects using some form
of ADO call. Does it make sense for me to try and use a DataReader to
place the data into new instances of my objects? Or it there a different
way this should be done. The way I've done it in other languages is to
loop through each row returned from the sql connection, create a new
instance of my object (and populate it), then add that instance to some
collection.
I haven't really seen any examples or tutorials using this technique.
Mostly it is just using adaptors to load the data, but that data isn't
really like the objects that I am defining, to me they appear to be more
like pure data with functionality for being in a dataGrid.
2. With regards to dataGrids. My tendency would be for me to place my
objects in some form of collection that could be placed into a DataGrid.
I obviously would need to set the data grid up to call the correct
getters/setters in my instances. This way I have logic within my objects
to handle formulas and even stuff like saving. Again, what I'm seeing so
far appears to be just data in collections that have functionality for
dataGrids, not objects designed by the programmer to handle application
logic.
So I guess another question I have is if I'm just coming at C# in the
wrong direction. Am I expecting to do things in it that are supposed to
be done in other ways and, if so, is that the way I should write C# code.
Thanks to anyone who made it this far and especially anyone who answers
this.
Chip
grateful to anyone with some help on the things below.
So I've got some objects I've created that calculate P&L numbers and
some other objects that know how to summarize those numbers up. What I'm
having conceptual problems with are the following....
1. I would assume that I should populate these objects using some form
of ADO call. Does it make sense for me to try and use a DataReader to
place the data into new instances of my objects? Or it there a different
way this should be done. The way I've done it in other languages is to
loop through each row returned from the sql connection, create a new
instance of my object (and populate it), then add that instance to some
collection.
I haven't really seen any examples or tutorials using this technique.
Mostly it is just using adaptors to load the data, but that data isn't
really like the objects that I am defining, to me they appear to be more
like pure data with functionality for being in a dataGrid.
2. With regards to dataGrids. My tendency would be for me to place my
objects in some form of collection that could be placed into a DataGrid.
I obviously would need to set the data grid up to call the correct
getters/setters in my instances. This way I have logic within my objects
to handle formulas and even stuff like saving. Again, what I'm seeing so
far appears to be just data in collections that have functionality for
dataGrids, not objects designed by the programmer to handle application
logic.
So I guess another question I have is if I'm just coming at C# in the
wrong direction. Am I expecting to do things in it that are supposed to
be done in other ways and, if so, is that the way I should write C# code.
Thanks to anyone who made it this far and especially anyone who answers
this.
Chip