wlandgraf
(Wagner Landgraf)
January 20, 2025, 5:04pm
5
Well, it's a single field and you can manually change the type. Or use customization scripts in TMS Data Modeler and simply automate it, so every time the entities are generated the script automatically change the type from Variant to string (or Char).
References:
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…
You can manage this using customization scripts in TMS Data Modeler.
Here is an example:
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
var
NewType: string;
begin
if (Args.DBField.DataTypeName = 'Number') and (Args.DBField.Size2 = 0) then
begin
if Args.DBField.Size <= 10 then
NewType := 'Integer'
else
NewType := 'Int64';
if not Args.DBField.Required then
NewType := 'Nullable<' + NewType + '>';
A…
Here is a small script that modifies the data type to string when computed fields have their expression starting with enum.
procedure OnColumnGenerated(Args: TColumnGeneratedArgs);
var
Expr: string;
begin
Expr := Args.DBField.Expression;
if LowerCase(Copy(Expr, 1, 5)) = 'enum(' then
begin
Args.Field.FieldType.BaseType := 'string';
Args.Prop.PropertyType.Basetype := 'string';
end;
end;
Use TMS Data Modeler, it's more convenient, save the project file, it saves the location.