Collections and database

  • Thread starter Thread starter xlar54
  • Start date Start date
X

xlar54

Hey folks,

Im working on a project, and of course am modelling the objects with
the database later in mind. I have a question about collections and
how they should be best used. Lets take for instance, a skus
collection, containing a bunch of sku objects. If I were to display a
grid containing all the skus, would it make much sense to load all the
skus into the collection first? Im not sure how a collection would be
useful in this sense, and would actually be more memory hungry. What
I am thinking is to simply go straight from DB to grid, skipping the
object loading. But this being the case, I feel like I am completely
disregarding the purpose of the collection object.

I appreciate your thoughts. So many ways to skin a cat, but only a
few of those ways actually skin the cat *well*. (sorry to all cat
lovers) ;)
 
in message
Hey folks,

Im working on a project, and of course am modelling the objects with
the database later in mind. I have a question about collections and
how they should be best used. Lets take for instance, a skus
collection, containing a bunch of sku objects. If I were to display a
grid containing all the skus, would it make much sense to load all the
skus into the collection first? Im not sure how a collection would be
useful in this sense, and would actually be more memory hungry. What
I am thinking is to simply go straight from DB to grid, skipping the
object loading. But this being the case, I feel like I am completely
disregarding the purpose of the collection object.

If you're using a dataset, an arraylist of objects or collection of
objects, each one is going to be a representation of data in memory no
matter how you look at it.

You load the dataset, arraylist, or collection with all the data.

Loading a strong type collection of objects is pretty simple, and the use
of the strong typed collection of objects is more powerful, gives better
control and is more easy to use, IMHO.

You can manipulate that data in the objects with properties and methods
within the object along with methods within the collection, when binding the
collection to the datagrid.
..
 
If you're using a dataset, an arraylist of objects or collection of
objects, each one is going to be a representation of data in memory no
matter how you look at it.

You load the dataset, arraylist, or collection with all the data.

Loading a strong type collection of objects is pretty simple, and the use
of the strong typed collection of objects is more powerful, gives better
control and is more easy to use, IMHO.

You can manipulate that data in the objects with properties and methods
within the object along with methods within the collection, when binding the
collection to the datagrid.
.


Interesting. I never really thought of it like that. The dataset
itself being a collection, it really doesnt matter, and of course
there is benefit to using my own collection class instead of a generic
dataset. Thanks for the feedback.
 
Dataset. And.., a Dataset is the 'natural' ( simplest ) way that asp.net
uses to do this kind of thing.

I'll just point out that an ADO.Net Dataset can be used by ASP, Windows,
Console Application and NT Service .Net solutions, not limited to ASP.NET.

And in addition to this, if working or developing .Net N-tier solutions,
most likely, a collection is going to be used to cross tier boundaries.
 
Back
Top