Skip to content

Latest commit

 

History

History
228 lines (181 loc) · 14.3 KB

index.md

File metadata and controls

228 lines (181 loc) · 14.3 KB

Examples

The examples/ folder holds more than 40 example programs. Each folder has a README.md that says what the example shows, how it works and how to run it; the links below open it on GitHub.

Where to start

Example Toolchain What it shows
MasterDetail Delphi, VCL A detail list that follows the master, with no code. The demo to start with
MasterDetail FMX Delphi, FMX, Win64 and Linux64 The same demo through TBoldDataSet and LiveBindings
Invoicing Delphi and Lazarus One model with an FMX client, an LCL client and console runners
Tutorial Delphi, VCL A five-step course that builds an invoicing application
OCL Workbench Delphi, VCL Type an OCL expression, run it against a live system, see what comes back

Which examples run today

The examples come from two generations:

  • Maintained examples have a current project file (.dproj for Delphi, .lpi for Lazarus) and use FireDAC, Zeos or XML file persistence. They build and run as they are. These are the tutorial, MasterDetail and its FMX twin, Invoicing, OCL Workbench, Save and Generate, LogBridge, ASP and Conway.
  • Original Boldsoft demos have only a .dpr, and most of them use the InterBase adapter (TBoldDatabaseAdapterIB, IBX), which is under Source/Deprecated and not in the maintained packages. Delphi creates a .dproj when you open the .dpr, but the program needs its data module ported to FireDAC before it runs. Their READMEs are still worth reading: each one explains a feature with the code that implements it.

Every demo with a VCL or COM user interface runs on Windows only.

Database configuration

MasterDetail, OCL Workbench and Save and Generate share one data module, examples/Shared/DemoDataModule.pas. It reads the database settings from the .ini file that has the program's name and sits next to the program, for example MasterDetail.ini. MasterDetail.ini selects SQLite, which needs no server; OclWorkbench.ini and TestSaveAndGenerate.ini select SQL Server, so change their Type to SQLite if you have no SQL Server.

The [Database] section chooses the persistence and the database:

[Database]
; FireDAC, UniDAC (only in a build that defines UNIDAC) or XML
Persistence=FireDAC
; MSSQL, PostgreSQL, Firebird, SQLite, MariaDB or Oracle; ignored for XML
Type=SQLite

Each database type has a section of its own:

=== "SQLite"

```ini
[SQLite]
Database=BoldDemo.db
```

The file is created on the first run.

=== "SQL Server"

```ini
[MSSQL]
Server=localhost
Database=BoldDemo
; True: Windows authentication; False: User and Password
OSAuthent=True
User=sa
Password=
```

=== "PostgreSQL"

```ini
[PostgreSQL]
Server=localhost
Port=5432
Database=bolddemo
User=postgres
Password=<your password>
VendorLib=C:\Program Files\PostgreSQL\18\bin\libpq.dll
```

=== "Firebird"

```ini
[Firebird]
Server=localhost
Database=C:\Data\BoldDemo.fdb
User=SYSDBA
Password=<your password>
VendorLib=C:\Program Files\Firebird\Firebird_5_0\fbclient.dll
```

=== "MariaDB / MySQL"

```ini
[MariaDB]
Server=localhost
Port=3306
Database=bolddemo
User=root
Password=<your password>
; libmariadb.dll from MariaDB Connector/C, or libmysql.dll for MySQL
VendorLib=C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib\libmariadb.dll
```

=== "Oracle"

```ini
[Oracle]
; Easy Connect: host:port/service
Database=localhost:1521/FREEPDB1
; the schema
User=bolddemo
Password=<your password>
; used to create the schema user when it does not exist
AdminUser=SYSTEM
AdminPassword=<admin password>
VendorLib=C:\oracle\instantclient_23_7\oci.dll
```

=== "XML file"

```ini
[Database]
Persistence=XML

[XML]
; defaults to <program name>.xml
FileName=BoldDemo.xml
; keep the data in memory between operations
CacheData=True
```

Leave out a key to use its default. The client libraries named in VendorLib are described under Database client libraries.

Tutorial

examples/Tutorial: a five-step course for newcomers, in Delphi with the VCL and SQLite through FireDAC. Each step has a finished project; steps 1 and 2 also have a starting project to build the step yourself.

Step Topic
1. New project The model, the system, persistence to SQLite
2. Customer CRUD List handles, grids and navigators
3. Invoices Associations and handle chaining for master-detail
4. OCL expressions Filtering, sorting and aggregating with OCL; derived attributes
5. Inheritance and VAT Inheritance (Company and PrivatePerson) and a lookup class for VAT rates

Object space

In examples/Simple/ObjectSpace. All are Delphi VCL programs.

Example What it shows Runs today
MasterDetail A list handle rooted on another list handle Yes (FireDAC, UniDAC or XML)
AssociationClass An association that carries data of its own .dpr, IBX
Constraints OCL constraints on classes and attributes .dpr, IBX
CustomAttributes Attribute types of your own .dpr, IBX
DataSetAndReporting TBoldDataSet: a Bold list as a TDataSet for reports .dpr, IBX, QuickReport
DerivedAttributes Attributes computed from OCL and kept current .dpr, IBX
DerivedHandle TBoldDerivedHandle: a value computed in Delphi code .dpr, IBX
DerivedRelations Associations derived by OCL .dpr, IBX
OclVariables TBoldOclVariables: values from outside the object in an expression .dpr, IBX
OptimisticLocking Detecting that someone else saved the object first .dpr, IBX
ReverseDerivedAttributes Derived attributes that can be written .dpr, IBX
SQLHandle TBoldSQLHandle: fetching objects with a SQL WHERE clause .dpr, IBX
Temporal Object versioning: every save keeps the old version .dpr, IBX
Transaction Object-space transactions: all or nothing in memory .dpr, IBX

User interface controls

In examples/Simple/GUIControls. All are Delphi VCL programs with a .dpr and IBX.

Example What it shows
BoldImage TBoldImage and typed blobs with a MIME content type
ComboBox TBoldComboBox: the edit area and the list follow different handles
MultiLang Attributes with one value per language
Renderers Renderers: custom display, editing and colouring of a value
SimpleTreeView TBoldTreeView built from node descriptions
TreeView TBoldTreeView with caption nodes and more

Tools and infrastructure

Example What it shows Runs today
OclWorkbench An OCL console against a live system Yes, Delphi VCL
SaveAndGenerateTest Saving a model and generating code from application code Yes, Delphi VCL
LogBridge Sending Bold's log to your application's logging Yes, Delphi console (Win32 project)
DefaultProject The minimal skeleton of a Bold application .dpr

Larger applications

In examples/Compound.

Example What it shows Runs today
Invoicing One model, an FMX client, an LCL client, console runners and tests, on SQLite or XML Yes: FMX (Delphi), LCL and Zeos (Lazarus)
ASP An object space served over HTTP by an ISAPI extension Yes, Delphi, Windows
Conway Game of Life computed entirely by OCL derivations Yes, Delphi VCL, no database
Building Nearly every Bold-aware VCL feature in one form .dpr, FireDAC
Bios The Building demo with the object space in a COM server .dpr, IBX, COM
bios2 Remote navigation compared with a COM service object .dpr, IBX, COM
ExternalPersistence Objects read from a database Bold does not own .dpr, BDE and IBX
ExternalPersistence2 The same, with the mapping declared in the model .dpr, IBX
HTTPPMapper Three tiers: Bold's persistence protocol over HTTP .dpr, IBX
Locking Pessimistic locking with a lock manager, and change propagation .dpr, IBX, COM
ModelEvolution Evolving the database and upgrading objects to a new model .dpr, IBX
ProdStruct A bill of materials, derivation in code, a tree view .dpr, IBX
XML A model served to a browser as XML and edited back .dproj, IBX, COM, ISAPI
XML2 A generic XML exporter, OCL sent from the browser .dpr, IBX, COM, ISAPI

PDF guides

The Doc/ folder has the original Boldsoft guides. They describe Bold 4.0 in Delphi 7, so menus and versions differ, but the concepts are the same.

Guide Topic
Starting Bfd, Part 1 Introducing the basics
Starting Bfd, Part 2 Extending models
Starting Bfd, Part 3 OCL
Delphi and Model Driven Architecture MDA with Bold, at length
Creating custom Bold-aware components Writing your own Bold-aware controls
UML 1.1 OCL specification The OCL language reference

More is in the Doc folder on GitHub.