How to make "generate entities from database "to generate String fields from TextFields in the database.
Now when generating all text fields becomes TBlob
Using [DBTypeMemo]
attribute before your TBlob
s may help you with those text columns.
wlandgraf
(Wagner Landgraf)
December 6, 2023, 12:13am
3
Actually I believe Micael is asking to replace the TBlob
type to string
type in the generated classes.
You can do that using TMS Data Modeler and customization scripts .
These topics show examples of how to use the customizations script to change the type of a generated property:
Thanks Wagner,
One last question: Is there any documentation or source code about these scripts other than datamodeller_manual.pdf? For example TGDAOField.
Also I put the following code into script in order to convert every Date field even if I forget to override in the mappings. But documentation will be very helpful.
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
begin
if Args.DBField.DataTypeName = 'Date' then
begin
// What about the required fields then this is a wrong ove…
Hi Mark, Sorry for the delay in answering. The easiest approach is just declare your enumerated types in a separated unit (for example, "Entities.EnumeratedTypes", and then use the script to change the type of the field/property to the enumerated you want. For example:
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
begin
if Args.DBField.FieldName = 'VehicleType' then
begin
Args.Prop.Prop…