M
MattC
Hi,
I have question that I'd like to throw up for a discussion as I cant seem to
figure out the answer myself.
I have implemented an object model in an ASP.NET application. Classes use
inheritance, aggregation and all the other OO means of data encapsulation.
The persistant store for the data is a database, so 3rd Normal form etc...
Here's where thing get interesting (well, kinda). I have create a series of
collection classes that derive from ArrayList and allow objects within my
objectmodel to be stored in their respective collection class. For example
a Department class with have a related DepartmentCollection class for
storage of many objects.
These collections can then be bound to a datagrid and using the bound column
template I can pick any data from the object model, so I can display in the
grid the salary of the manager of each department in the collection.
This is great and very flexible. However, if I wish to use the features
provided by ADO.NET then having an object model is not so useful. For
example a user table exists of the username, securityprofileid and
activeaccountflag, departmentID. Pulling out the user details into my user
class would then fill all the details relating to the class, so the
Department ID is used to get the aggregate Department object and the same
with the SecurityProfile object. With a DataTable I would only have that
data which came from the table, i.e, the four fields with the object model
much more data.
So when I come to use sorting or filtering which is provided by the
DataTable class I can only sort and filter on those fields available. If I
want the same data as in my previous example of the manager's salary, I
would need to create a DataSet that contained then data I wanted to display
in that grid. Somewhat bypassing the object model.
I would love to read any thoughts people have or suggestions, I am by no
means an expert onteh subject so it is entirely possible that I have missed
something very simple.
TIA
MattC
I have question that I'd like to throw up for a discussion as I cant seem to
figure out the answer myself.
I have implemented an object model in an ASP.NET application. Classes use
inheritance, aggregation and all the other OO means of data encapsulation.
The persistant store for the data is a database, so 3rd Normal form etc...
Here's where thing get interesting (well, kinda). I have create a series of
collection classes that derive from ArrayList and allow objects within my
objectmodel to be stored in their respective collection class. For example
a Department class with have a related DepartmentCollection class for
storage of many objects.
These collections can then be bound to a datagrid and using the bound column
template I can pick any data from the object model, so I can display in the
grid the salary of the manager of each department in the collection.
This is great and very flexible. However, if I wish to use the features
provided by ADO.NET then having an object model is not so useful. For
example a user table exists of the username, securityprofileid and
activeaccountflag, departmentID. Pulling out the user details into my user
class would then fill all the details relating to the class, so the
Department ID is used to get the aggregate Department object and the same
with the SecurityProfile object. With a DataTable I would only have that
data which came from the table, i.e, the four fields with the object model
much more data.
So when I come to use sorting or filtering which is provided by the
DataTable class I can only sort and filter on those fields available. If I
want the same data as in my previous example of the manager's salary, I
would need to create a DataSet that contained then data I wanted to display
in that grid. Somewhat bypassing the object model.
I would love to read any thoughts people have or suggestions, I am by no
means an expert onteh subject so it is entirely possible that I have missed
something very simple.
TIA
MattC