Snap Object Dataset

Want you conciliate pure object oriented programming and delphi data aware controls?
Through Snap Object Dataset components you will be able to join your business logic with the true rad powerfull delphi data aware controls; in this way your GUI will continue to completely being detached from the persistence layer.

The package contain two components TSnapVirtualDataset and TSnapObjectDataset and one editor for use of this components in a true RAD way. These components are completely free with source and demos, and with the editor you can create automatically for every properties of your business classes the associated TField descendent.

Your browser does not support applets.

TSnapVirtualDataset TSnapVirtualDataset
This component, descendant from TDataset, allows to connect whichever source given to the delphi data aware controls. The TSnapVirtualDataset takes the data to visualize in the delphi data aware controls through the following events:

  • OnGetDataCount: it allows to specify the number of record in the dataset;
  • OnGetDataValue: it allows the dataset to read the value of a TField of the active record;
  • OnGetDataBlobValue: equal to the previous one but for the blob type TField, it comes passed a stream containing the data;
  • OnSetDataValue: it allows to pass the data from the data aware control to the field;
  • OnSetDataBlobValue: equal to the previous one but for the blob type field;
  • OnAddData: recalled when a record is added;
  • OnCancelData: recalled when the record is cancelled (through key ESC);
  • OnPostData: recalled when the record is posted;
  • OnDeleteData: recalled when a record is deleted;

With the TSnapVirtualDataset yours business logic could be visualized with data aware controls even if implemented in Array, TList descendants or in whichever other way, this component will be the ring of conjunction between yours business logic and the GUI.

TSnapObjectDataset TSnapObjectDataset
This component, that inherits from TDataset, allows to interface whichever TObject's descendant with the delphi data aware controls. The host informations object must inherit from TPersistent or must have the RTTI assets through the compilation directive {$TYPEINFO ON} or {$M+}, in this way all the published properties will be accessible from the dataset by the TField associated. If the host object inherits from TCollection or from TObjectList, is possible to manage an objects list and therefore the insertion and the cancellation of elements from the list. This component use the RTTI in order to read and to write the data on the host object, the types supported and the correspondents TField data types are:

Char

ftString

ShortString

ftString

String

ftString

AnsiString

ftString

WideString

ftString

Boolean

ftBoolean

ByteBool

ftBoolean

WordBool

ftBoolean

LongBool

ftBoolean

Byte

ftSmallInt

ShortInt

ftSmallInt

Smallint

ftSmallInt

Word

ftWord

DWORD

ftInteger

LongWord

ftInteger

Integer

ftInteger

Cardinal

ftLargeInt

Int64

ftLargeInt

LongInt

ftLargeInt

TDate

ftDate

TTime

ftTime

TDateTime

ftDateTime

Real

ftFloat

Float

ftFloat

Single

ftFloat

Double

ftFloat

Extended

ftFloat

Currency

ftFloat

Comp

ftFloat

TStrings

ftMemo

TPicture

ftGraphic

TCollection

ftDataset

TObjectList

ftDataset

TObject

ftDataset

The TSnapObjectDataset supports the Master/detail relations through the MasterDatasource property, or through the DatasetField property. If we suppose of having a class, ours Master, with a property that inherits from TObject, this property could be connected with an other TSnapObjectDataset that will be the Detail of the relation.

TSnapObjectDataset Editor
This is an editor to create in a easy way the dataset fields according to the class properties of your business object classes. With this editor you do not need to register your business object class into the delphi designer so that class properties can be available from the object inspector, but you need only the source of your business object class and the properties of your classes will be available through this editor.

Import editor

If you find useful TSnapObjectDataset components and editor you can email me and if you want can donate anything to the author (money, postcard, bicycle, etc..).
Thank You

cosimo.demichele@libero.it

Download SnapObjectDataset source and demos

Thanks to a good idea of Paul Johnson and of an excellent article written by GExperts (http://www.gexperts.com by Gerald Nunn).

Logo Snap1 64