Skip to content
Carlo Barazzetta edited this page Dec 4, 2018 · 6 revisions

Creating New Objects

Business objects are created just like any other object. The Create constructor of the class creates a new instance of the class. The constructor can be called with an optional Connector parameter. This connector specifies the database in which to make the object persistent.If no connector is specified, the default connector will be used. To make an object persistent, call its Store method. Only instances of classes declared with a persistence property of stored in the business model can be Stored. If an object does not already have its Id assigned, an id value will be generated and assigned to it prior to storage.

Example

var
  Person: TPerson
begin
  Person := TPerson.Create(MyConnector);
  try
    Person.Id := '12345678'
    Person.Name := 'John Doe';
    Person.Store;
  finally
    Person.Free;
  end;
end;
Clone this wiki locally