Lahann_Kai
(Kai Lahann)
January 24, 2025, 7:58pm
1
I'm not sure if this is an Aurelius or Data Modeler topic but it looks more as Aurelius to me ...
I'm working on MSSQL using FDAC:
Here is what I have in pictures, files in the archive at bottom:
DataModeler: Domain definition (note seed:0!):
DataModeler: Table definition
For those records in the database ...
... the first line of this code segment works fine ...
the second line brings up
To me it looks like Aurelius treats an identity value of 0 as not set.
I'd like to agree with that, but then DataModeler should set up the type accordingly.
Did I miss anything and it's my fault or is it a "bug"?
Regards
Kai
Files attached:
IoT.zip (5.2 KB)
wlandgraf
(Wagner Landgraf)
January 24, 2025, 9:17pm
2
Correct.
I'm afraid I don't understand what you mean here?
If zero is a valid id value for your database, then you should make to tell Aurelius so, using IdUnsavedValue
, as discusses in a few topics:
You can. Use the IdUnsavedValue attribute to set a default 'unsaved id' different from zero.
[Entity]
[IdUnsavedValue(-1)] // <-- insert this line.
[Table('employee')]
[Description('')]
[Sequence('employee_id_seq')]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TEmployee = class(TMoonshineObject)
(***)
HTH,
Hi Kounalakis,
Yes, it's possible, just add this mapping to Entities that have integer key fields where value may by zero:
[IdUnsavedValue(-1)]
TMyEntity = class
You may use -1 or any other value (that will not exists as valid Id on your table) to represent unsaved entities.
Regards,
Lahann_Kai
(Kai Lahann)
January 24, 2025, 9:27pm
3
Yes, I missed something.
Thank you for the answer.
1 Like
system
(system)
Closed
January 25, 2025, 9:28pm
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.