Einzelnen Beitrag anzeigen

Maliko

Registriert seit: 20. Jun 2019
89 Beiträge
 
Delphi 10.3 Rio
 
#1

Abfragen mittels Join über TMS Aurelius

  Alt 23. Mär 2022, 08:14
Datenbank: Oracle • Version: 12 • Zugriff über: TMS Aurelius
Moin,

ich hoffe, jemand von euch kennt sich mit dem Framework aus. Wir benutzen ganz neu Aurelius und bisher hat auch alles wunderbar funktioniert. Allerdings habe ich jetzt das Problem Daten über Aurelius abzurufen, wo sich die Where-Spalten in unterschiedlichen Tabellen befinden. Ich bekomme dann immer die Fehlermeldung:

Zitat:
Property "MANDANTREFERENZID" not found on class "TBkpo".
Das ist auch korrekt, denn das Property befindet sich in der Klasse TVG. Für die Abfrage benutze ich folgenden Code:

FManager.Find<TBkpo>.Where(Linq['kundennummer'] = aKundennummer).Where(Dic.Vg.MANDANTREFERENZID = aReferenz).Where(Dic.Vg.MANDANTVORGANGID = aKundenvorgangid).OrderBy('datum', false).OrderBy('posid', False).List; Das ist der entsprechende Teil der Entities die ich nutze:

Delphi-Quellcode:
  [Entity]
  [Table('BKPO')]
  [Id(...)]
  TBkpo = class
  private
    [Column('KUNDENNUMMER', [TColumnProp.Required])]
    FKUNDENNUMMER: string;

    [Association([TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAll - [TCascadeType.Remove])]
    [JoinColumn('VGFK_KUNDENNUMMER', [TColumnProp.Required], 'KUNDENNUMMER')]
    [JoinColumn('VGFK_VORGANGID', [TColumnProp.Required], 'VORGANGID')]
    [JoinColumn('VGFK_VERSIONID', [TColumnProp.Required], 'VERSIONID')]
    FVorgang: Proxy<TVg>;
    function GetVorgang: TVg;
    procedure SetVorgang(const Value: TVg);
  public
    property Kundennummer: string read FKUNDENNUMMER write FKUNDENNUMMER;
    property Vorgang: TVg read GetVorgang write SetVorgang;

  [Entity]
  [Table('VG')]
  [Id(...)]
  TVg = class
  private
    [Column('KUNDENNUMMER', [TColumnProp.Required])]
    FKUNDENNUMMER: string;

    [Column('VORGANGID', [TColumnProp.Required])]
    FVORGANGID: Double;

    [Column('VERSIONID', [TColumnProp.Required])]
    FVERSIONID: Double;

    [Column('MANDANTREFERENZID', [], 50)]
    FMANDANTREFERENZID: string;

    [Column('MANDANTVORGANGID', [], 50)]
    FMANDANTVORGANGID: string;
  public
    property Kundennummer: string read FKUNDENNUMMER write FKUNDENNUMMER;
    property Vorgangid: Double read FVORGANGID write FVORGANGID;
    property Versionid: Double read FVERSIONID write FVERSIONID;
    property Mandantreferenzid: string read FMANDANTREFERENZID write FMANDANTREFERENZID;
    property Mandantvorgangid: string read FMANDANTVORGANGID write FMANDANTVORGANGID;
  end;
Nicht wundern, ich hab die Entities etwas zusammengekürzt und nur das aufgeschrieben, was für dieses Query benötigt wird. Alle anderen Properties, IDs und Uniques hab ich weggelassen.

Und das hier ist das betroffene Dictionary das ich abrufe:
Delphi-Quellcode:
  IDictionary = interface(IAureliusDictionary)
    function Vg: IVgDictionary;
  end;

  TDictionary = class(TAureliusDictionary, IDictionary)
  public
    function Vg: IVgDictionary;
  end;

  IVgDictionary = interface(IAureliusEntityDictionary)
    function KUNDENNUMMER : TLinqProjection;
    function VORGANGID : TLinqProjection;
    function VERSIONID : TLinqProjection;
    function MANDANTREFERENZID : TLinqProjection;
    function MANDANTVORGANGID : TLinqProjection;
  end;

  TVgDictionary = class(TAureliusEntityDictionary, IVgDictionary)
  public
    function KUNDENNUMMER: TLinqProjection;
    function VORGANGID: TLinqProjection;
    function VERSIONID: TLinqProjection;
    function MANDANTREFERENZID : TLinqProjection;
    function MANDANTVORGANGID : TLinqProjection;
  end;

{ TVGDictionary }

function TVGDictionary.KUNDENNUMMER: TLinqProjection;
begin
  Result := Prop('KUNDENNUMMER');
end;

function TVgDictionary.MANDANTREFERENZID: TLinqProjection;
begin
  Result := Prop('MANDANTREFERENZID');
end;

function TVgDictionary.MANDANTVORGANGID: TLinqProjection;
begin
  Result := Prop('MANDANTVORGANGID');
end;

function TVGDictionary.VERSIONID: TLinqProjection;
begin
  Result := Prop('VERSIONID');
end;

function TVGDictionary.VORGANGID: TLinqProjection;
begin
  Result := Prop('VORGANGID');
end;
Hat vielleicht jemand ne Ahnung was ich da falsch mache? Wenn noch irgendwelche Infos fehlen, reiche ich die natürlich nach.

Viele Grüße
Maliko

Geändert von Maliko (23. Mär 2022 um 08:20 Uhr)
  Mit Zitat antworten Zitat