Mixed Models Again

In my Sphinx server I have the Sphinx model, accessed via /GASphinx and the default model accessed by /GARegister.

I have a service that runs on the default model, but needs access to the TGAUser (descendant of the Sphinx TUser).

In the Service implementation I obtain the Sphinx Object Manager:

SphinxContext := ServerContainer.SphinxServer1.CreateContext;
SphinxObjectManager := (SphinxContext as TSphinxContext).Manager;

But when I call

SphinxManager.Find<TGAUser>.Where(TLinq.Eq('Email', Value.Email.ToLower)).UniqueResult;

I get

Project GASphinx.exe raised exception class EInvalidEntity with message 'Class TGAUser is not a valid Entity. [Entity] attribute missing or entity does not belong to model.'.

Stepping through the CreateContext code it checks for

if THttpServerContext.Current <> nil then

I think this picks up the Context of the call, so picks up the Manager for teh default model. Am I thinking correctly about that?

If so how do I get a true Sphinx Manager?



If you don't need any context-specific operation, you can simply create the manager yourself:

SphinxManager := TObjectManager.Create(Connection, TMappingExplorer.Get('Biz.Sphinx');