TMS XData provides several components for design-time usage. The main purpose is to provide a RAD experience, by just dropping components in the form and configuring them, allowing setting up servers with almost no line of code.
Even though you can use the components at runtime, creating them from code, that would usually be not necessary, as the components are just wrappers for the existing non-component classes, like TXDataServerModule or IDBConnectionPool.
Since TMS XData is based on TMS Sparkle components, you might want to read about TMS Sparkle design-time component usage, to learn more details about the architecture, like the common features and middleware system usage.
General usage is:
1. Drop a dispatcher component in the form (for example, TSparkeHttpSysDispatcher).
2. Drop a TXDataServer component in the form.
3. Associated the TXDataServer component to the dispatcher through the Dispatcher property.
4. Specify the BaseUrl property of the server (for example, http://+:2001/tms/xdata).
5. Set Active property of dispatcher component to true.
From now on you can already create server-side business logic using service operations.
Optionally, if you wan to use TMS Aurelius and want to publish TMS Aurelius CRUD Endpoints, follow the next steps:
6. Drop a TAureliusConnection in the form and configure it to connect to your database (you might need to drop additional database-access components, like TFDConnection if you want to use FireDac).
7. Drop a TXDataConnectionPool component and associated it to TAureliusConnection through the Connection property.
8. Associated the TXDataServer component to the pool through the Pool property.
Now your XData server is able to publish database data automatically and you can also use the TXDataOperationContext to use Aurelius to retrieve data from database.
You can also use the TAureliusConnection component to automatically generate Aurelius classes from the database, right-clicking the component and choosing "Generate entities from the database".
TXDataServer component wraps the TXDataServerModule module. Basically all properties in the component has a direct relation with the properties of the TXDataServerModule, in case of doubt refer to TXDataServerModule reference to learn more details about each property.
|Pool: TXDataConnectionPool||Contains a reference to a TXDataConnectionPool component. This will be used as the connection pool for the XData server database operations.|
|ModelName: string||Specifies the name of the model to be used to create the TXDataServerModule instance.|
|All those property values will be used to set the a property with same name in the TXDataServerModule instance when it's created. Refer to TXDataServerModule topic to learn the purpose of each property.|
|DefaultEntitySetPermissions: TEntitySetPermissions||Specifies the default permissions for all entity sets. By default no permissions are provided, which means entity publish will not be available. This is different behavior than when creating TXDataServerModule directly, since it automatically publishes all entities.|
|EntitySetPermissions: TEntitySetPermissionItems||A collection where you can specify entity set permissions for an entity set in particular. This will override the default entity set permissions.|
|EnableEntityKeyAsSegment: Boolean||When True, it's possible to address single entities by using the URL format "/entityset/id" - in addition to the default "/entityset(id)". Default is False.|
|Provide access to configure Swagger and SwaggerUI behavior. See more information at OpenAPI/Swagger Support.|
|OnModuleCreate: TXDataModuleEvent||Fired when the TXDataServerModule instance is created.|
|OnGetPoolInterface: TGetPoolInterfaceEvent||Fired when the IDBConnectionPool interface is created by the TXDataConnectionPool component.|
|These are wrappers around the events described in the server-side events chapter. Please refer to that chapter to know more about the events and how to use them. Arguments (event-handler parameters) are exactly the same.|
TXDataModuleEvent = procedure(Sender: TObject; Module: TXDataServerModule) of object;
Module parameter is the newly created TXDataServerModule instance (OnModuleCreate event).
TGetPoolInterfaceEvent = procedure(Sender: TObject; var Pool: IDBConnectionPool) of object;
Pool parameter is the newly created IDBConnectionPool interface (OnGetPoolInterface event). You can override that value by creating your own interface and passing it in the Pool variable.
TXDataConnectionPool component creates IDBConnectionPool instances using a TAureliusConnection to create the IDBConnection interfaces.
|Connection: TAureliusConnection||Contains a reference to a TAureliusConnection component, used to create IDBConnection interfaces used by the pool.|
|Size: Integer||The size of the pool to be created.|
|OnPoolInterfaceCreate: TPoolInterfaceEvent||Fired when the IDBConnectionPool interface is created by the TXDataConnectionPool component.|
TPoolInterfaceEvent = procedure(Sender: TObject; var Pool: IDBConnectionPool) of object;
Pool parameter is the newly created IDBConnectionPool interface (OnPoolInterfaceCreate event). You can override that value by creating your own interface and passing it in the Pool variable.