How can I get a dataset for objects in memory?

Does anyone know of a TDataset descendant that works with Generics and RTTI so that I can write such code and use data-oriented components in a graphical interface?

... ds:TDataset<TPerson>; ... procedure DoStuff; begin ds:=TDataset<TPerson>.create; ds.add(TPerson.Create('A.','Hitler',77)); ds.add(TPerson.Create('O.','Bin Laden',88)); end; 

It should be possible. Field identifiers can be created via RTTI because the exact data type is known. Values ​​can also be automatically sorted back and forth, so you can view and edit data in a class or record.

I do not like to write a lot of useless marshalling code, while the necessary information for this is available through RTTI already.

Or maybe someone once wrote some TEnumerable ↔ TDataset adapter?

Is there something similar, or should I start writing?

...

<sub> The closest I could find is an (excellent!) example from Marco Cantu, from Mastering Delphi 7, but the code itself does not use new language functions like generic tools, the new RTTI system or attributes, and it does not work with delici unicode. TDataset has changed from D7 too.
Sub>

+8
generics rtti delphi tdataset
source share
5 answers

The TAUREIUSDataSet included in the TMS Aurelius is very close to this.

+4
source share

Take a look at the EverClassy dataset from Inovativa at www.inovativa.com.br/public .

+2
source share

DotNet4Delphi A-Dato Scheduling Technology from the Netherlands is good for you.

enter image description here

Quotes:

From Torrey Delphi

Connect any collection to data controls .

DotNet4Delphi implements many classes in the .Net collection, including common types such as List <> and Dictionary <>. Unlike Delphi, this is that our common collections also implement non-common interfaces (IList, IDictionary) that allow you to access your collections in a variety of ways. This opens the door to using any data collection as a data source for data monitoring, which is exactly what the TListDataset component (also included) provides.

It targets Delphi XE and XE2.

This is an open source initiative, Delphi rock !!!

+1
source share

the other is the Snap Object dataset http://digilander.libero.it/snapobject/

+1
source share

I found a more relevant resource and cannot share it! So appropriate that I think it deserves a separate post, not just an update in my first answer.


The Dduce library for Delphi XE2-XE6 uses TListDataSet<...> common dataset that can be used to display a common list like a TDataSet.

The most relevant units related to the implementation of a generic dataset are:

Class hierarchy:

TDataSet <= TCustomVirtualDataset <= TListDataset <= TListDataset <T>

Yes, it inherits many functions ... my only desire is to have at my disposal a version that works with less demand (Delphi XE without most other bells and whistles).

Appearance:

enter image description here

+1
source share

All Articles