Lisandro wrote:
> Go to the WEB and search for TinMemory,TMemoryTable... .There are some
> components thar work as a TTable in memory

Yes. This sort of thing can be done either using some form of memory based
Table/DataSet.

However, you then have to write all the boilerplate code to create TFields
for all the collection object members and code to populate the Dataset from
the collection, both to read in the initial state and write back the
finished state.

Also, if you're only exposing a subset of the Collection object's members
for editing, you need to have a way of handling the mapping from one to the
other so you can preserve the non-exposed members whilst updating the other
members, usually by adding an 'identity' column of some sort.

This sort of boilerplate crap which you have to write each time gets to be
really boring but it's the price you play for inserting another layer of
abstraction between the interface you want and the interface you have.

Going straight from TDataset to TCollection with property 'inspection' (i.e.
having it examine the RTTI property information) to automatically create
TFields that map straight through to the underlying collection entities
makes it really painless to just point a grid at a collection as a quick
component editor (or whatever) UI without much thought and without having to
write all the boilerplate code and update it as you change your component's
properties or structure.

A little work to write in the first place, but much higher re-use 'bang for
your buck' afterwards.

Mind you, we've written lots of TDatasets to different styles of data
'source' (memory, SQL, ISAM db, Collection, Interface-based) so I guess
we've gotten used to whipping them up.

TTFN,
  Paul.


> ----- Original Message -----
> From: Neven MacEwan <[EMAIL PROTECTED]>
> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> Sent: Thursday, February 10, 2000 6:39 PM
> Subject: [DUG]: TCollection as Dataset
>
>
> > Hiya all
> >
> > I was thinking that it would not be too difficult to use a
> TCollection as
> a
> > Dataset
> > (Then I could edit the collection with a DBGrid et al)
> >
> > Has anyone tried/used/written a component to do this
> >
> > TIA
> >
> > Neven


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to