Breaking change?

Hi,


I installed Aurelius 3.1 in Berlin. I was previously on Seattle 2.7.1
a query with projections that went oke on seattle 2.7.1 now gives me an error:
Unexpected field type: MobileEntities.TOpdrachtbon.'

This is the line of code:
      result := objMan.Find<TOpdrachtbonRegel>
            .SetProjections(TProjections.Count(TOpdrachtbonRegel.Ass_Opdrachtbon))
            .add(TLinq.Eq(TOpdrachtbonRegel.Ass_Opdrachtbon, FOpdrachtbon.Opdrachtbonnr)
                 and (TLinq.Eq(TOpdrachtbonRegel.Prop_Kostensoort,'M') or TLinq.isnull(TOpdrachtbonRegel.Prop_Kostensoort) )
                 and not (TLinq.IsNull(TOpdrachtbonRegel.Prop_Omschrijving) and TLinq.isNull(TOpdrachtbonRegel.Prop_Aantal)) )
            .UniqueValue.Values[0];

This is the TOpdrachtbonregels entity
  [Entity]
  [Table('OpdrachtbonRegels')]
  [Id('FMobileID', TIdGenerator.Guid)]
  TOpdrachtbonRegel = class
  private
    [Column('MobileID', [TColumnProp.Required])]
    FMobileID: TGuid;

    [Column('Volgnr', [])]
    FVolgnr: integer;

    [Column('Kostensoort', [], 1)]
    FKostensoort: Nullable<string>;

    [Column('Werknr', [], 15)]
    FWerknr: Nullable<string>;

    [Column('Soortcode', [], 1)]
    FSoortcode: Nullable<string>;

    [Column('Meerwerkcode', [], 5)]
    FMeerwerkcode: Nullable<string>;

    [Column('Bewakingscode', [])]
    FBewakingscode: Nullable<integer>;

    [Column('Jaar', [])]
    FJaar: Nullable<integer>;

    [Column('Week', [])]
    FWeek: Nullable<integer>;

    [Column('Dag', [])]
    FDag: Nullable<integer>;

    [Column('Datum', [])]
    FDatum: Nullable<TDateTime>;

    [Column('Personeelsnr', [])]
    FPersoneelsnr: Nullable<integer>;

    [Column('EigenArtikelnr', [], 20)]
    FEigenArtikelnr: Nullable<string>;

    [Column('Leverancier', [], 20)]
    FLeverancier: Nullable<string>;

    [Column('Artikelnr', [], 20)]
    FArtikelnr: Nullable<string>;

    [Column('Omschrijving', [], 80)]
    FOmschrijving: Nullable<string>;

    [Column('Aantal', [])]
    FAantal: Nullable<double>;

    [Column('Eenheid', [], 10)]
    FEenheid: Nullable<string>;

    [Column('Inkprijspeenh', [])]
    FInkprijspeenh: Nullable<double>;

    [Column('Verkprijspeenh', [])]
    FVerkprijspeenh: Nullable<double>;

    [Column('Korting', [])]
    FKorting: Nullable<double>;

    [Column('Opslag', [])]
    FOpslag: Nullable<double>;

    [Column('dbRegeltotaal', [])]
    FdbRegeltotaal: Nullable<double>;

    [Column('BestelregelID', [])]
    FBestelregelID: Nullable<integer>;

    [Column('werkbonregelID', [])]
    FwerkbonregelID: Nullable<integer>;

    [Column('inkfaktregelID', [])]
    FinkfaktregelID: Nullable<integer>;

    [Column('BezoekID', [])]
    FBezoekID: Nullable<TGuid>;

    [Column('OpdrachtID', [])]
    FOpdrachtid: Nullable<TGuid>;

    [Column('Magazijncode',[], 10)]
    FMagazijncode: Nullable<string>;

    [Association([TAssociationProp.Lazy, TAssociationProp.Required], [])]
    [JoinColumn('Opdrachtbonnr', [TColumnProp.Required], 'Opdrachtbonnr')]
    FOpdrachtbon: Proxy<TOpdrachtbon>;

    [Association([TAssociationProp.Lazy], [])]
    [JoinColumn('Uurtarief', [], 'Uurtariefcode')]
    FUurtarief: Proxy<TUurtarief>;

    function GetOpdrachtbon: TOpdrachtbon;
    procedure SetOpdrachtbon(const Value: TOpdrachtbon);
    function GetRegelSamenvatting: string;
    function GetUurtarief: TUurTarief;
    procedure SetUurtarief(const Value: TUurTarief);
  public
//    property RegelID: Nullable<integer> read FRegelID write FRegelID;
    property MobileID: TGuid read FMobileID write FMobileID;
    property Volgnr: integer read FVolgnr write FVolgnr;
    property Kostensoort: Nullable<string> read FKostensoort write FKostensoort;
    property Werknr: Nullable<string> read FWerknr write FWerknr;
    property Soortcode: Nullable<string> read FSoortcode write FSoortcode;
    property Meerwerkcode: Nullable<string> read FMeerwerkcode write FMeerwerkcode;
    property Bewakingscode: Nullable<integer> read FBewakingscode write FBewakingscode;
    property Jaar: Nullable<integer> read FJaar write FJaar;
    property Week: Nullable<integer> read FWeek write FWeek;
    property Dag: Nullable<integer> read FDag write FDag;
    property Datum: Nullable<TDateTime> read FDatum write FDatum;
    property Personeelsnr: Nullable<integer> read FPersoneelsnr write FPersoneelsnr;
    property EigenArtikelnr: Nullable<string> read FEigenArtikelnr write FEigenArtikelnr;
    property Leverancier: Nullable<string> read FLeverancier write FLeverancier;
    property Artikelnr: Nullable<string> read FArtikelnr write FArtikelnr;
    property Omschrijving: Nullable<string> read FOmschrijving write FOmschrijving;
    property Aantal: Nullable<double> read FAantal write FAantal;
    property Eenheid: Nullable<string> read FEenheid write FEenheid;
    property Inkprijspeenh: Nullable<double> read FInkprijspeenh write FInkprijspeenh;
    property Verkprijspeenh: Nullable<double> read FVerkprijspeenh write FVerkprijspeenh;
    property Korting: Nullable<double> read FKorting write FKorting;
    property Opslag: Nullable<double> read FOpslag write FOpslag;
    property dbRegeltotaal: Nullable<double> read FdbRegeltotaal write FdbRegeltotaal;
    property BestelregelID: Nullable<integer> read FBestelregelID write FBestelregelID;
    property werkbonregelID: Nullable<integer> read FwerkbonregelID write FwerkbonregelID;
    property inkfaktregelID: Nullable<integer> read FinkfaktregelID write FinkfaktregelID;
    property BezoekID: Nullable<TGuid> read FBezoekID write FBezoekID;
    property Opdrachtid: Nullable<TGuid> read FOpdrachtid write FOpdrachtid;
    property Magazijncode: Nullable<string> read FMagazijncode write FMagazijncode;
    //Associations
    property Opdrachtbon: TOpdrachtbon read GetOpdrachtbon write SetOpdrachtbon;
    property Uurtarief: TUurTarief read GetUurtarief write SetUurtarief;

    //public properties
    property RegelSamenvatting: string read GetRegelSamenvatting;
    {$region 'Dictionary'}
    const Prop_MobileID       ='MobileID';
    const Prop_Volgnr         ='Volgnr';
    const Prop_Kostensoort    ='Kostensoort';
    const Prop_Werknr         ='Werknr';
    const Prop_Soortcode      ='Soortcode';
    const Prop_Meerwerkcode   ='Meerwerkcode';
    const Prop_Jaar           ='Jaar';
    const Prop_Week           ='Week';
    const Prop_Dag            ='Dag';
    const Prop_Datum          ='Datum';
    const Prop_Personeelsnr   ='Personeelsnr';
    const Prop_EigenArtikelnr ='EigenArtikelnr';
    const Prop_Leverancier    ='Leverancier';
    const Prop_Artikelnr      ='Artikelnr';
    const Prop_Omschrijving   ='Omschrijving';
    const Prop_Aantal         ='Aantal';
    const Prop_Eenheid        ='Eenheid';
    const Prop_Inkprijspeenh  ='Inkprijspeenh';
    const Prop_Verkprijspeenh ='Verkprijspeenh';
    const Prop_Korting        ='Korting';
    const Prop_Opslag         ='Opslag';
    const Prop_dbRegeltotaal  ='dbRegeltotaal';
    const Prop_BestelregelID  ='BestelregelID';
    const Prop_werkbonregelID ='werkbonregelID';
    const Prop_inkfaktregelID ='inkfaktregelID';
    const Prop_BezoekID       ='BezoekID';
    const prop_Opdrachtid     ='OpdrachtID';
    const Ass_Opdrachtbon     ='Opdrachtbon';
    const Ass_Uurtarief       ='Uurtarief';
    {$endregion}
  end;

That should not work in previous versions, if it did it was actually a bug (or at least an undesired behavior). You can only count scalar values (Opdrachtbon.Id for example), not the association itself.

I just want to count all the records (the equivalent of Count(*)) but when I use the id (which is a Quid) I get an error, so I used to use the association (of the master that is always present), which absolutely worked fine in 2.7.1.

What should I do to count all records, if this does not work anymore.

This is the error I get when using the MobileId (guid field) in the count

First chance exception at $751840F8. Exception class EConvertError with message ''1' is not a valid GUID value'.

Indeed there seems to be an issue with counting guid fields. We will fix that. As a workaround, you could just count the "" field this way:


.SetProjections(TProjections.Count(TProjections.Sql<Integer>('')))

This has been fixed and fix will be included in next release. If you need an urgent patch, please contact us directly through e-mail. Thanks.