Module?

Perhaps a dumb question, but I'm just not seeing it:

In an XData Server, I am trying to implement events. Looking at below example (shown in documentation):

uses {...}, XData.Server.Module, XData.Module.Events;

// Module is an instance of TXDataServerModule object
Module.Events.OnEntityInserting.Subscribe(
  procedure(Args: TEntityInsertingArgs)
  begin
    // Use Args.Entity to retrieve the entity being inserted
  end
);

Where do I get Module from? Do I create one (TXDataServerModule) myself? If so, where and how? I have created the server with the wizard, so I already have a TDataModule (TServerContainer) with a TSparkleHttpSysDispatcher, TXDataServer and a TXDataConnectionPool.

Any example code?

OK, it's as simple as implementing TXDataServer.OnModuleCreate and then use the Module parameter. As I said: "Probably a dumb question...." :upside_down_face:

1 Like