Using TXDataOperationContext

Hi,

Playing around with the console xDataServer found under your demos here: ....\TMS XData\Demos\web\music\XDataMusicServer

I converted this application from a console application to a vcl one, and everything seems to be ok. I then added a new datamodule to this new project. In this new module I do the following:

uses
XData.Server.Module,
Aurelius.Engine.ObjectManager;

procedure TNewDataModule.SomeProcedure;
var
Manager: TObjectManager;
begin
Manager := TXDataOperationContext.Current.GetManager;
//The above raises an exception as TXDataOperationContext.Current is nil;
end;

My question is how can is access the current objectmanger in a my new datamodule?

The context manager, or more specifically, the TXDataOperationContext.Current object is only available when XData is processing a request. My guess is that you are calling SomeProcedure at some point which is not a request processing operation? In this case, there is no context or manager available.

Ahh, that makes sense.
Then I need to reevaluate how should approach this.

Thank you,
Leif Eirik

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.