Detect Model of an object

Hello

I have a multi-model design where the local database
is handled by the SQLite driver but the where I must send text SQL
commands to the remote database. My plan was to detect the Model of the
object being saved and act accordingly. I am having trouble detecting
the model of an object. Here's my code:

interface

uses
    ...
    Aurelius.Mapping.Attributes,
    ...;
   
implementation
...

function TDBObjectBase.GetModel: string;
var
    lContext: TRttiContext;
    lType: TRttiType;
    lAttr: TCustomAttribute;
begin
    lContext := TRttiContext.Create;
    lType := lContext.GetType(self.ClassInfo);
    try
        for lAttr in lType.GetAttributes do
            if lAttr is Model then           //error resolving 'Model' identifier
                Exit(Model(lAttr).Name);
    finally
        lContext.Free;//This is different from normal Free
    end;
end;


I get an error when I use a cast to detect the model of an object attribute. When I use the identifier 'Model' I get the error:

        "Operator not applicable to this operand type"

When I try to scope the identifier with 'Aurelius.Mapping.Attributes.Model' I get a different error:

        "Undeclared identifier 'Mapping'"

This
works fine (without scoping) for other attributes such as 'Table' or
'Entity'. Model seems to be a problem. Can you tell me how I should do
this? If there is a better approach please tell me.

Thanks

David
Nevermind, I see my error. But I would still like to know why the scoping approach did not work.

Thanks

I don't know, both options work here without any problem. Probably there is something else, specific, in your code and/or Delphi version?