Enumerated types

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.PropertyType := TCodeTypeReference.Create('TVehicleType');
    Args.Field.FieldType := TCodeTypeReference.Create('TVehicleType');
  end;
end;


procedure OnUnitGenerated(Args: TUnitGeneratedArgs);
begin
  Args.CodeUnit.InterfaceUnits.Add(TCodeUsedUnit.Create('Entities.EnumeratedTypes'));
end;

1 Like